id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1 value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
37,000 | hpsa/hpe-application-automation-tools-plugin | src/main/java/com/hp/application/automation/tools/results/PerformanceJobReportAction.java | PerformanceJobReportAction.mergeResults | public void mergeResults(LrJobResults resultFiles)
{
for(JobLrScenarioResult scenarioResult : resultFiles.getLrScenarioResults().values())
{
this._resultFiles.addScenario(scenarioResult);
}
} | java | public void mergeResults(LrJobResults resultFiles)
{
for(JobLrScenarioResult scenarioResult : resultFiles.getLrScenarioResults().values())
{
this._resultFiles.addScenario(scenarioResult);
}
} | [
"public",
"void",
"mergeResults",
"(",
"LrJobResults",
"resultFiles",
")",
"{",
"for",
"(",
"JobLrScenarioResult",
"scenarioResult",
":",
"resultFiles",
".",
"getLrScenarioResults",
"(",
")",
".",
"values",
"(",
")",
")",
"{",
"this",
".",
"_resultFiles",
".",
... | Merge results of several runs - espcially useful in pipeline jobs with multiple LR steps
@param resultFiles the result files | [
"Merge",
"results",
"of",
"several",
"runs",
"-",
"espcially",
"useful",
"in",
"pipeline",
"jobs",
"with",
"multiple",
"LR",
"steps"
] | 987536f5551bc76fd028d746a951d1fd72c7567a | https://github.com/hpsa/hpe-application-automation-tools-plugin/blob/987536f5551bc76fd028d746a951d1fd72c7567a/src/main/java/com/hp/application/automation/tools/results/PerformanceJobReportAction.java#L66-L72 |
37,001 | hpsa/hpe-application-automation-tools-plugin | src/main/java/com/hp/application/automation/tools/mc/JobConfigurationProxy.java | JobConfigurationProxy.loginToMC | public JSONObject loginToMC(String mcUrl, String mcUserName, String mcPassword, String proxyAddress, String proxyUsername, String proxyPassword) {
JSONObject returnObject = new JSONObject();
try {
Map<String, String> headers = new HashMap<String, String>();
headers.put(Constants.ACCEPT, "application/json");
headers.put(Constants.CONTENT_TYPE, "application/json;charset=UTF-8");
JSONObject sendObject = new JSONObject();
sendObject.put("name", mcUserName);
sendObject.put("password", mcPassword);
sendObject.put("accountName", "default");
HttpResponse response = HttpUtils.post(HttpUtils.setProxyCfg(proxyAddress, proxyUsername, proxyPassword), mcUrl + Constants.LOGIN_URL, headers, sendObject.toJSONString().getBytes());
if (response != null && response.getHeaders() != null) {
Map<String, List<String>> headerFields = response.getHeaders();
List<String> hp4mSecretList = headerFields.get(Constants.LOGIN_SECRET);
String hp4mSecret = null;
if (hp4mSecretList != null && hp4mSecretList.size() != 0) {
hp4mSecret = hp4mSecretList.get(0);
}
List<String> setCookieList = headerFields.get(Constants.SET_COOKIE);
String setCookie = null;
if (setCookieList != null && setCookieList.size() != 0) {
setCookie = setCookieList.get(0);
for(String str : setCookieList){
if(str.contains(Constants.JSESSIONID) && str.startsWith(Constants.JSESSIONID)){
setCookie = str;
break;
}
}
}
String jsessionId = getJSESSIONID(setCookie);
returnObject.put(Constants.JSESSIONID, jsessionId);
returnObject.put(Constants.LOGIN_SECRET, hp4mSecret);
returnObject.put(Constants.COOKIE, Constants.JESEEIONEQ + jsessionId);
}
} catch (Exception e) {
e.printStackTrace();
}
return returnObject;
} | java | public JSONObject loginToMC(String mcUrl, String mcUserName, String mcPassword, String proxyAddress, String proxyUsername, String proxyPassword) {
JSONObject returnObject = new JSONObject();
try {
Map<String, String> headers = new HashMap<String, String>();
headers.put(Constants.ACCEPT, "application/json");
headers.put(Constants.CONTENT_TYPE, "application/json;charset=UTF-8");
JSONObject sendObject = new JSONObject();
sendObject.put("name", mcUserName);
sendObject.put("password", mcPassword);
sendObject.put("accountName", "default");
HttpResponse response = HttpUtils.post(HttpUtils.setProxyCfg(proxyAddress, proxyUsername, proxyPassword), mcUrl + Constants.LOGIN_URL, headers, sendObject.toJSONString().getBytes());
if (response != null && response.getHeaders() != null) {
Map<String, List<String>> headerFields = response.getHeaders();
List<String> hp4mSecretList = headerFields.get(Constants.LOGIN_SECRET);
String hp4mSecret = null;
if (hp4mSecretList != null && hp4mSecretList.size() != 0) {
hp4mSecret = hp4mSecretList.get(0);
}
List<String> setCookieList = headerFields.get(Constants.SET_COOKIE);
String setCookie = null;
if (setCookieList != null && setCookieList.size() != 0) {
setCookie = setCookieList.get(0);
for(String str : setCookieList){
if(str.contains(Constants.JSESSIONID) && str.startsWith(Constants.JSESSIONID)){
setCookie = str;
break;
}
}
}
String jsessionId = getJSESSIONID(setCookie);
returnObject.put(Constants.JSESSIONID, jsessionId);
returnObject.put(Constants.LOGIN_SECRET, hp4mSecret);
returnObject.put(Constants.COOKIE, Constants.JESEEIONEQ + jsessionId);
}
} catch (Exception e) {
e.printStackTrace();
}
return returnObject;
} | [
"public",
"JSONObject",
"loginToMC",
"(",
"String",
"mcUrl",
",",
"String",
"mcUserName",
",",
"String",
"mcPassword",
",",
"String",
"proxyAddress",
",",
"String",
"proxyUsername",
",",
"String",
"proxyPassword",
")",
"{",
"JSONObject",
"returnObject",
"=",
"new"... | Login to MC | [
"Login",
"to",
"MC"
] | 987536f5551bc76fd028d746a951d1fd72c7567a | https://github.com/hpsa/hpe-application-automation-tools-plugin/blob/987536f5551bc76fd028d746a951d1fd72c7567a/src/main/java/com/hp/application/automation/tools/mc/JobConfigurationProxy.java#L32-L74 |
37,002 | hpsa/hpe-application-automation-tools-plugin | src/main/java/com/hp/application/automation/tools/mc/JobConfigurationProxy.java | JobConfigurationProxy.upload | public JSONObject upload(String mcUrl, String mcUserName, String mcPassword, String proxyAddress, String proxyUsername, String proxyPassword, String appPath) throws Exception {
JSONObject json = null;
String hp4mSecret = null;
String jsessionId = null;
File appFile = new File(appPath);
String uploadUrl = mcUrl + Constants.APP_UPLOAD;
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
StringBuffer content = new StringBuffer();
content.append("\r\n").append("------").append(Constants.BOUNDARYSTR).append("\r\n");
content.append("Content-Disposition: form-data; name=\"file\"; filename=\"" + appFile.getName() + "\"\r\n");
content.append("Content-Type: application/octet-stream\r\n\r\n");
outputStream.write(content.toString().getBytes());
FileInputStream in = new FileInputStream(appFile);
byte[] b = new byte[1024];
int i = 0;
while ((i = in.read(b)) != -1) {
outputStream.write(b, 0, i);
}
in.close();
outputStream.write(("\r\n------" + Constants.BOUNDARYSTR + "--\r\n").getBytes());
byte[] bytes = outputStream.toByteArray();
outputStream.close();
JSONObject loginJson = loginToMC(mcUrl, mcUserName, mcPassword, proxyAddress, proxyUsername, proxyPassword);
if (loginJson != null) {
hp4mSecret = (String) loginJson.get(Constants.LOGIN_SECRET);
jsessionId = (String) loginJson.get(Constants.JSESSIONID);
}
Map<String, String> headers = new HashMap<String, String>();
headers.put(Constants.LOGIN_SECRET, hp4mSecret);
headers.put(Constants.COOKIE, Constants.JESEEIONEQ + jsessionId);
headers.put(Constants.CONTENT_TYPE, Constants.CONTENT_TYPE_DOWNLOAD_VALUE + Constants.BOUNDARYSTR);
headers.put(Constants.FILENAME, appFile.getName());
HttpUtils.ProxyInfo proxyInfo = HttpUtils.setProxyCfg(proxyAddress, proxyUsername, proxyPassword);
HttpResponse response = HttpUtils.post(proxyInfo, uploadUrl, headers, bytes);
if (response != null && response.getJsonObject() != null) {
json = response.getJsonObject();
}
return json;
} | java | public JSONObject upload(String mcUrl, String mcUserName, String mcPassword, String proxyAddress, String proxyUsername, String proxyPassword, String appPath) throws Exception {
JSONObject json = null;
String hp4mSecret = null;
String jsessionId = null;
File appFile = new File(appPath);
String uploadUrl = mcUrl + Constants.APP_UPLOAD;
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
StringBuffer content = new StringBuffer();
content.append("\r\n").append("------").append(Constants.BOUNDARYSTR).append("\r\n");
content.append("Content-Disposition: form-data; name=\"file\"; filename=\"" + appFile.getName() + "\"\r\n");
content.append("Content-Type: application/octet-stream\r\n\r\n");
outputStream.write(content.toString().getBytes());
FileInputStream in = new FileInputStream(appFile);
byte[] b = new byte[1024];
int i = 0;
while ((i = in.read(b)) != -1) {
outputStream.write(b, 0, i);
}
in.close();
outputStream.write(("\r\n------" + Constants.BOUNDARYSTR + "--\r\n").getBytes());
byte[] bytes = outputStream.toByteArray();
outputStream.close();
JSONObject loginJson = loginToMC(mcUrl, mcUserName, mcPassword, proxyAddress, proxyUsername, proxyPassword);
if (loginJson != null) {
hp4mSecret = (String) loginJson.get(Constants.LOGIN_SECRET);
jsessionId = (String) loginJson.get(Constants.JSESSIONID);
}
Map<String, String> headers = new HashMap<String, String>();
headers.put(Constants.LOGIN_SECRET, hp4mSecret);
headers.put(Constants.COOKIE, Constants.JESEEIONEQ + jsessionId);
headers.put(Constants.CONTENT_TYPE, Constants.CONTENT_TYPE_DOWNLOAD_VALUE + Constants.BOUNDARYSTR);
headers.put(Constants.FILENAME, appFile.getName());
HttpUtils.ProxyInfo proxyInfo = HttpUtils.setProxyCfg(proxyAddress, proxyUsername, proxyPassword);
HttpResponse response = HttpUtils.post(proxyInfo, uploadUrl, headers, bytes);
if (response != null && response.getJsonObject() != null) {
json = response.getJsonObject();
}
return json;
} | [
"public",
"JSONObject",
"upload",
"(",
"String",
"mcUrl",
",",
"String",
"mcUserName",
",",
"String",
"mcPassword",
",",
"String",
"proxyAddress",
",",
"String",
"proxyUsername",
",",
"String",
"proxyPassword",
",",
"String",
"appPath",
")",
"throws",
"Exception",... | upload app to MC | [
"upload",
"app",
"to",
"MC"
] | 987536f5551bc76fd028d746a951d1fd72c7567a | https://github.com/hpsa/hpe-application-automation-tools-plugin/blob/987536f5551bc76fd028d746a951d1fd72c7567a/src/main/java/com/hp/application/automation/tools/mc/JobConfigurationProxy.java#L77-L129 |
37,003 | hpsa/hpe-application-automation-tools-plugin | src/main/java/com/hp/application/automation/tools/mc/JobConfigurationProxy.java | JobConfigurationProxy.createTempJob | public String createTempJob(String mcUrl, String mcUserName, String mcPassword, String proxyAddress, String proxyUserName, String proxyPassword) {
JSONObject job = null;
String jobId = null;
String hp4mSecret = null;
String jsessionId = null;
String loginJson = loginToMC(mcUrl, mcUserName, mcPassword, proxyAddress, proxyUserName, proxyPassword).toJSONString();
try {
if (loginJson != null) {
JSONObject jsonObject = (JSONObject) JSONValue.parseStrict(loginJson);
hp4mSecret = (String) jsonObject.get(Constants.LOGIN_SECRET);
jsessionId = (String) jsonObject.get(Constants.JSESSIONID);
}
} catch (Exception e) {
e.printStackTrace();
}
boolean isValid = argumentsCheck(hp4mSecret, jsessionId);
if (isValid) {
try {
Map<String, String> headers = new HashMap<String, String>();
headers.put(Constants.LOGIN_SECRET, hp4mSecret);
headers.put(Constants.COOKIE, Constants.JESEEIONEQ + jsessionId);
HttpResponse response = HttpUtils.get(HttpUtils.setProxyCfg(proxyAddress,proxyUserName,proxyPassword), mcUrl + Constants.CREATE_JOB_URL, headers, null);
if (response != null && response.getJsonObject() != null) {
job = response.getJsonObject();
if(job != null && job.get("data") != null){
JSONObject data = (JSONObject)job.get("data");
jobId = data.getAsString("id");
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
return jobId;
} | java | public String createTempJob(String mcUrl, String mcUserName, String mcPassword, String proxyAddress, String proxyUserName, String proxyPassword) {
JSONObject job = null;
String jobId = null;
String hp4mSecret = null;
String jsessionId = null;
String loginJson = loginToMC(mcUrl, mcUserName, mcPassword, proxyAddress, proxyUserName, proxyPassword).toJSONString();
try {
if (loginJson != null) {
JSONObject jsonObject = (JSONObject) JSONValue.parseStrict(loginJson);
hp4mSecret = (String) jsonObject.get(Constants.LOGIN_SECRET);
jsessionId = (String) jsonObject.get(Constants.JSESSIONID);
}
} catch (Exception e) {
e.printStackTrace();
}
boolean isValid = argumentsCheck(hp4mSecret, jsessionId);
if (isValid) {
try {
Map<String, String> headers = new HashMap<String, String>();
headers.put(Constants.LOGIN_SECRET, hp4mSecret);
headers.put(Constants.COOKIE, Constants.JESEEIONEQ + jsessionId);
HttpResponse response = HttpUtils.get(HttpUtils.setProxyCfg(proxyAddress,proxyUserName,proxyPassword), mcUrl + Constants.CREATE_JOB_URL, headers, null);
if (response != null && response.getJsonObject() != null) {
job = response.getJsonObject();
if(job != null && job.get("data") != null){
JSONObject data = (JSONObject)job.get("data");
jobId = data.getAsString("id");
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
return jobId;
} | [
"public",
"String",
"createTempJob",
"(",
"String",
"mcUrl",
",",
"String",
"mcUserName",
",",
"String",
"mcPassword",
",",
"String",
"proxyAddress",
",",
"String",
"proxyUserName",
",",
"String",
"proxyPassword",
")",
"{",
"JSONObject",
"job",
"=",
"null",
";",... | create one temp job | [
"create",
"one",
"temp",
"job"
] | 987536f5551bc76fd028d746a951d1fd72c7567a | https://github.com/hpsa/hpe-application-automation-tools-plugin/blob/987536f5551bc76fd028d746a951d1fd72c7567a/src/main/java/com/hp/application/automation/tools/mc/JobConfigurationProxy.java#L132-L170 |
37,004 | hpsa/hpe-application-automation-tools-plugin | src/main/java/com/hp/application/automation/tools/mc/JobConfigurationProxy.java | JobConfigurationProxy.getJobById | public JSONObject getJobById(String mcUrl, String mcUserName, String mcPassword, String proxyAddress, String proxyUsername, String proxyPassword, String jobUUID) {
JSONObject jobJsonObject = null;
String hp4mSecret = null;
String jsessionId = null;
String loginJson = loginToMC(mcUrl, mcUserName, mcPassword, proxyAddress, proxyUsername, proxyPassword).toJSONString();
try {
if (loginJson != null) {
JSONObject jsonObject = (JSONObject) JSONValue.parseStrict(loginJson);
hp4mSecret = (String) jsonObject.get(Constants.LOGIN_SECRET);
jsessionId = (String) jsonObject.get(Constants.JSESSIONID);
}
} catch (Exception e) {
e.printStackTrace();
}
boolean b = argumentsCheck(jobUUID, hp4mSecret, jsessionId);
if (b) {
try {
Map<String, String> headers = new HashMap<String, String>();
headers.put(Constants.LOGIN_SECRET, hp4mSecret);
headers.put(Constants.COOKIE, Constants.JESEEIONEQ + jsessionId);
HttpResponse response = HttpUtils.get(HttpUtils.setProxyCfg(proxyAddress, proxyUsername, proxyPassword), mcUrl + Constants.GET_JOB_UEL + jobUUID, headers, null);
if (response != null && response.getJsonObject() != null) {
jobJsonObject = response.getJsonObject();
}
if(jobJsonObject != null){
jobJsonObject = (JSONObject)jobJsonObject.get(Constants.DATA);
}
} catch (Exception e) {
e.printStackTrace();
}
}
return removeIcon(jobJsonObject);
} | java | public JSONObject getJobById(String mcUrl, String mcUserName, String mcPassword, String proxyAddress, String proxyUsername, String proxyPassword, String jobUUID) {
JSONObject jobJsonObject = null;
String hp4mSecret = null;
String jsessionId = null;
String loginJson = loginToMC(mcUrl, mcUserName, mcPassword, proxyAddress, proxyUsername, proxyPassword).toJSONString();
try {
if (loginJson != null) {
JSONObject jsonObject = (JSONObject) JSONValue.parseStrict(loginJson);
hp4mSecret = (String) jsonObject.get(Constants.LOGIN_SECRET);
jsessionId = (String) jsonObject.get(Constants.JSESSIONID);
}
} catch (Exception e) {
e.printStackTrace();
}
boolean b = argumentsCheck(jobUUID, hp4mSecret, jsessionId);
if (b) {
try {
Map<String, String> headers = new HashMap<String, String>();
headers.put(Constants.LOGIN_SECRET, hp4mSecret);
headers.put(Constants.COOKIE, Constants.JESEEIONEQ + jsessionId);
HttpResponse response = HttpUtils.get(HttpUtils.setProxyCfg(proxyAddress, proxyUsername, proxyPassword), mcUrl + Constants.GET_JOB_UEL + jobUUID, headers, null);
if (response != null && response.getJsonObject() != null) {
jobJsonObject = response.getJsonObject();
}
if(jobJsonObject != null){
jobJsonObject = (JSONObject)jobJsonObject.get(Constants.DATA);
}
} catch (Exception e) {
e.printStackTrace();
}
}
return removeIcon(jobJsonObject);
} | [
"public",
"JSONObject",
"getJobById",
"(",
"String",
"mcUrl",
",",
"String",
"mcUserName",
",",
"String",
"mcPassword",
",",
"String",
"proxyAddress",
",",
"String",
"proxyUsername",
",",
"String",
"proxyPassword",
",",
"String",
"jobUUID",
")",
"{",
"JSONObject",... | get one job by id | [
"get",
"one",
"job",
"by",
"id"
] | 987536f5551bc76fd028d746a951d1fd72c7567a | https://github.com/hpsa/hpe-application-automation-tools-plugin/blob/987536f5551bc76fd028d746a951d1fd72c7567a/src/main/java/com/hp/application/automation/tools/mc/JobConfigurationProxy.java#L173-L209 |
37,005 | hpsa/hpe-application-automation-tools-plugin | src/main/java/com/hp/application/automation/tools/results/parser/jenkinsjunit/Result.java | Result.getSuites | public List<Result.Suites> getSuites() {
if (suites == null) {
suites = new ArrayList<Result.Suites>();
}
return this.suites;
} | java | public List<Result.Suites> getSuites() {
if (suites == null) {
suites = new ArrayList<Result.Suites>();
}
return this.suites;
} | [
"public",
"List",
"<",
"Result",
".",
"Suites",
">",
"getSuites",
"(",
")",
"{",
"if",
"(",
"suites",
"==",
"null",
")",
"{",
"suites",
"=",
"new",
"ArrayList",
"<",
"Result",
".",
"Suites",
">",
"(",
")",
";",
"}",
"return",
"this",
".",
"suites",... | Gets the value of the suites property.
<p>
This accessor method returns a reference to the live list,
not a snapshot. Therefore any modification you make to the
returned list will be present inside the JAXB object.
This is why there is not a <CODE>set</CODE> method for the suites property.
<p>
For example, to add a new item, do as follows:
<pre>
getSuites().add(newItem);
</pre>
<p>
Objects of the following type(s) are allowed in the list
{@link Result.Suites } | [
"Gets",
"the",
"value",
"of",
"the",
"suites",
"property",
"."
] | 987536f5551bc76fd028d746a951d1fd72c7567a | https://github.com/hpsa/hpe-application-automation-tools-plugin/blob/987536f5551bc76fd028d746a951d1fd72c7567a/src/main/java/com/hp/application/automation/tools/results/parser/jenkinsjunit/Result.java#L180-L185 |
37,006 | hpsa/hpe-application-automation-tools-plugin | src/main/java/com/hp/application/automation/tools/run/RunFromFileBuilder.java | RunFromFileBuilder.getMCServerSettingsModel | public MCServerSettingsModel getMCServerSettingsModel() {
for (MCServerSettingsModel mcServer : getDescriptor().getMcServers()) {
if (this.runFromFileModel != null
&& runFromFileModel.getMcServerName() != null
&& mcServer.getMcServerName() != null
&& runFromFileModel.getMcServerName().equals(mcServer.getMcServerName())) {
return mcServer;
}
}
return null;
} | java | public MCServerSettingsModel getMCServerSettingsModel() {
for (MCServerSettingsModel mcServer : getDescriptor().getMcServers()) {
if (this.runFromFileModel != null
&& runFromFileModel.getMcServerName() != null
&& mcServer.getMcServerName() != null
&& runFromFileModel.getMcServerName().equals(mcServer.getMcServerName())) {
return mcServer;
}
}
return null;
} | [
"public",
"MCServerSettingsModel",
"getMCServerSettingsModel",
"(",
")",
"{",
"for",
"(",
"MCServerSettingsModel",
"mcServer",
":",
"getDescriptor",
"(",
")",
".",
"getMcServers",
"(",
")",
")",
"{",
"if",
"(",
"this",
".",
"runFromFileModel",
"!=",
"null",
"&&"... | Gets mc server settings model.
@return the mc server settings model | [
"Gets",
"mc",
"server",
"settings",
"model",
"."
] | 987536f5551bc76fd028d746a951d1fd72c7567a | https://github.com/hpsa/hpe-application-automation-tools-plugin/blob/987536f5551bc76fd028d746a951d1fd72c7567a/src/main/java/com/hp/application/automation/tools/run/RunFromFileBuilder.java#L475-L485 |
37,007 | hpsa/hpe-application-automation-tools-plugin | src/main/java/com/hp/application/automation/tools/results/LrGraphUtils.java | LrGraphUtils.constructPercentileTransactionGraph | static void constructPercentileTransactionGraph(Map.Entry<String, LrProjectScenarioResults> scenarioResults,
JSONObject scenarioGraphData) {
Map<Integer, TreeMap<String, PercentileTransactionWholeRun>> percentileTransactionResults =
scenarioResults.getValue().getPercentileTransactionResults();
JSONObject percentileTransactionResultsGraphSet =
extractPercentileTransactionSet(percentileTransactionResults,
scenarioResults.getValue().getTransactions());
if (!percentileTransactionResultsGraphSet.getJSONArray(LABELS).isEmpty()) {
percentileTransactionResultsGraphSet
.put(TITLE, PERCENTILE_TRANSACTION_RESPONSE_TIME);
percentileTransactionResultsGraphSet
.put(X_AXIS_TITLE, BUILD_NUMBER);
percentileTransactionResultsGraphSet.put(Y_AXIS_TITLE,
TRANSACTIONS_RESPONSE_TIME_SECONDS);
percentileTransactionResultsGraphSet
.put(DESCRIPTION, PRECENTILE_GRAPH_DESCRIPTION);
scenarioGraphData.put("percentileTransaction", percentileTransactionResultsGraphSet);
}
} | java | static void constructPercentileTransactionGraph(Map.Entry<String, LrProjectScenarioResults> scenarioResults,
JSONObject scenarioGraphData) {
Map<Integer, TreeMap<String, PercentileTransactionWholeRun>> percentileTransactionResults =
scenarioResults.getValue().getPercentileTransactionResults();
JSONObject percentileTransactionResultsGraphSet =
extractPercentileTransactionSet(percentileTransactionResults,
scenarioResults.getValue().getTransactions());
if (!percentileTransactionResultsGraphSet.getJSONArray(LABELS).isEmpty()) {
percentileTransactionResultsGraphSet
.put(TITLE, PERCENTILE_TRANSACTION_RESPONSE_TIME);
percentileTransactionResultsGraphSet
.put(X_AXIS_TITLE, BUILD_NUMBER);
percentileTransactionResultsGraphSet.put(Y_AXIS_TITLE,
TRANSACTIONS_RESPONSE_TIME_SECONDS);
percentileTransactionResultsGraphSet
.put(DESCRIPTION, PRECENTILE_GRAPH_DESCRIPTION);
scenarioGraphData.put("percentileTransaction", percentileTransactionResultsGraphSet);
}
} | [
"static",
"void",
"constructPercentileTransactionGraph",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"LrProjectScenarioResults",
">",
"scenarioResults",
",",
"JSONObject",
"scenarioGraphData",
")",
"{",
"Map",
"<",
"Integer",
",",
"TreeMap",
"<",
"String",
",",
... | creates dataset for Percentile transaction graph
@param scenarioResults the relative scenario results to create the graph
@param scenarioGraphData the target graph data set | [
"creates",
"dataset",
"for",
"Percentile",
"transaction",
"graph"
] | 987536f5551bc76fd028d746a951d1fd72c7567a | https://github.com/hpsa/hpe-application-automation-tools-plugin/blob/987536f5551bc76fd028d746a951d1fd72c7567a/src/main/java/com/hp/application/automation/tools/results/LrGraphUtils.java#L96-L114 |
37,008 | hpsa/hpe-application-automation-tools-plugin | src/main/java/com/hp/application/automation/tools/results/LrGraphUtils.java | LrGraphUtils.constructAvgTransactionGraph | static void constructAvgTransactionGraph(Map.Entry<String, LrProjectScenarioResults> scenarioResults,
JSONObject scenarioGraphData) {
Map<Integer, TreeMap<String, AvgTransactionResponseTime>> avgTransactionResponseTimeResults =
scenarioResults.getValue().getAvgTransactionResponseTimeResults();
JSONObject avgTransactionResponseTimeGraphSet =
extractAvgTrtData(avgTransactionResponseTimeResults, scenarioResults.getValue().getTransactions());
if (!avgTransactionResponseTimeGraphSet.getJSONArray(LABELS).isEmpty()) {
avgTransactionResponseTimeGraphSet.put(TITLE, "Average Transaction Response TIme");
avgTransactionResponseTimeGraphSet.put(X_AXIS_TITLE, "Build number");
avgTransactionResponseTimeGraphSet
.put(Y_AXIS_TITLE, "Time (Sec.)");
avgTransactionResponseTimeGraphSet.put(DESCRIPTION,
"Displays the average time taken to perform transactions during each second of the load test." +
" This graph helps you determine whether the performance of the server is within " +
"acceptable minimum and maximum transaction performance time ranges defined for your " +
"system.");
scenarioGraphData.put("averageTransactionResponseTime", avgTransactionResponseTimeGraphSet);
}
} | java | static void constructAvgTransactionGraph(Map.Entry<String, LrProjectScenarioResults> scenarioResults,
JSONObject scenarioGraphData) {
Map<Integer, TreeMap<String, AvgTransactionResponseTime>> avgTransactionResponseTimeResults =
scenarioResults.getValue().getAvgTransactionResponseTimeResults();
JSONObject avgTransactionResponseTimeGraphSet =
extractAvgTrtData(avgTransactionResponseTimeResults, scenarioResults.getValue().getTransactions());
if (!avgTransactionResponseTimeGraphSet.getJSONArray(LABELS).isEmpty()) {
avgTransactionResponseTimeGraphSet.put(TITLE, "Average Transaction Response TIme");
avgTransactionResponseTimeGraphSet.put(X_AXIS_TITLE, "Build number");
avgTransactionResponseTimeGraphSet
.put(Y_AXIS_TITLE, "Time (Sec.)");
avgTransactionResponseTimeGraphSet.put(DESCRIPTION,
"Displays the average time taken to perform transactions during each second of the load test." +
" This graph helps you determine whether the performance of the server is within " +
"acceptable minimum and maximum transaction performance time ranges defined for your " +
"system.");
scenarioGraphData.put("averageTransactionResponseTime", avgTransactionResponseTimeGraphSet);
}
} | [
"static",
"void",
"constructAvgTransactionGraph",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"LrProjectScenarioResults",
">",
"scenarioResults",
",",
"JSONObject",
"scenarioGraphData",
")",
"{",
"Map",
"<",
"Integer",
",",
"TreeMap",
"<",
"String",
",",
"AvgTra... | Construct avg transaction graph.
@param scenarioResults the scenario results
@param scenarioGraphData the scenario graph data | [
"Construct",
"avg",
"transaction",
"graph",
"."
] | 987536f5551bc76fd028d746a951d1fd72c7567a | https://github.com/hpsa/hpe-application-automation-tools-plugin/blob/987536f5551bc76fd028d746a951d1fd72c7567a/src/main/java/com/hp/application/automation/tools/results/LrGraphUtils.java#L164-L182 |
37,009 | hpsa/hpe-application-automation-tools-plugin | src/main/java/com/hp/application/automation/tools/results/LrGraphUtils.java | LrGraphUtils.constructErrorGraph | static void constructErrorGraph(Map.Entry<String, LrProjectScenarioResults> scenarioResults,
JSONObject scenarioGraphData) {
Map<Integer, TimeRangeResult> errPerSecResults = scenarioResults.getValue().getErrPerSecResults();
JSONObject errPerSecResultsResultsGraphSet =
extractTimeRangeResult(errPerSecResults);
if (!errPerSecResultsResultsGraphSet.getJSONArray(LABELS).isEmpty()) {
errPerSecResultsResultsGraphSet.put(TITLE, "Total errors per second");
errPerSecResultsResultsGraphSet.put(X_AXIS_TITLE, "Build number");
errPerSecResultsResultsGraphSet.put(Y_AXIS_TITLE, "Errors");
errPerSecResultsResultsGraphSet.put(DESCRIPTION, "");
scenarioGraphData.put("errorPerSecResults", errPerSecResultsResultsGraphSet);
}
} | java | static void constructErrorGraph(Map.Entry<String, LrProjectScenarioResults> scenarioResults,
JSONObject scenarioGraphData) {
Map<Integer, TimeRangeResult> errPerSecResults = scenarioResults.getValue().getErrPerSecResults();
JSONObject errPerSecResultsResultsGraphSet =
extractTimeRangeResult(errPerSecResults);
if (!errPerSecResultsResultsGraphSet.getJSONArray(LABELS).isEmpty()) {
errPerSecResultsResultsGraphSet.put(TITLE, "Total errors per second");
errPerSecResultsResultsGraphSet.put(X_AXIS_TITLE, "Build number");
errPerSecResultsResultsGraphSet.put(Y_AXIS_TITLE, "Errors");
errPerSecResultsResultsGraphSet.put(DESCRIPTION, "");
scenarioGraphData.put("errorPerSecResults", errPerSecResultsResultsGraphSet);
}
} | [
"static",
"void",
"constructErrorGraph",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"LrProjectScenarioResults",
">",
"scenarioResults",
",",
"JSONObject",
"scenarioGraphData",
")",
"{",
"Map",
"<",
"Integer",
",",
"TimeRangeResult",
">",
"errPerSecResults",
"=",
... | Construct error graph.
@param scenarioResults the scenario results
@param scenarioGraphData the scenario graph data | [
"Construct",
"error",
"graph",
"."
] | 987536f5551bc76fd028d746a951d1fd72c7567a | https://github.com/hpsa/hpe-application-automation-tools-plugin/blob/987536f5551bc76fd028d746a951d1fd72c7567a/src/main/java/com/hp/application/automation/tools/results/LrGraphUtils.java#L220-L232 |
37,010 | hpsa/hpe-application-automation-tools-plugin | src/main/java/com/hp/application/automation/tools/results/LrGraphUtils.java | LrGraphUtils.constructAverageThroughput | static void constructAverageThroughput(Map.Entry<String, LrProjectScenarioResults> scenarioResults,
JSONObject scenarioGraphData) {
Map<Integer, WholeRunResult> averageThroughputResults = scenarioResults.getValue().getAverageThroughputResults();
JSONObject averageThroughputResultsGraphSet =
extractWholeRunSlaResult(averageThroughputResults, "Bytes/Sec");
if (!averageThroughputResultsGraphSet.getJSONArray(LABELS).isEmpty()) {
averageThroughputResultsGraphSet.put(TITLE, "Average Throughput per second");
averageThroughputResultsGraphSet.put(X_AXIS_TITLE, "Build number");
averageThroughputResultsGraphSet.put(Y_AXIS_TITLE, "Bytes");
averageThroughputResultsGraphSet.put(DESCRIPTION,
" Displays the amount of throughput (in bytes) on the Web server during the load test. " +
"Throughput represents the amount of data that the Vusers received from the server at" +
" any given second. This graph helps you to evaluate the amount of load Vusers " +
"generate, in terms of server throughput.\n");
scenarioGraphData.put("averageThroughput", averageThroughputResultsGraphSet);
}
} | java | static void constructAverageThroughput(Map.Entry<String, LrProjectScenarioResults> scenarioResults,
JSONObject scenarioGraphData) {
Map<Integer, WholeRunResult> averageThroughputResults = scenarioResults.getValue().getAverageThroughputResults();
JSONObject averageThroughputResultsGraphSet =
extractWholeRunSlaResult(averageThroughputResults, "Bytes/Sec");
if (!averageThroughputResultsGraphSet.getJSONArray(LABELS).isEmpty()) {
averageThroughputResultsGraphSet.put(TITLE, "Average Throughput per second");
averageThroughputResultsGraphSet.put(X_AXIS_TITLE, "Build number");
averageThroughputResultsGraphSet.put(Y_AXIS_TITLE, "Bytes");
averageThroughputResultsGraphSet.put(DESCRIPTION,
" Displays the amount of throughput (in bytes) on the Web server during the load test. " +
"Throughput represents the amount of data that the Vusers received from the server at" +
" any given second. This graph helps you to evaluate the amount of load Vusers " +
"generate, in terms of server throughput.\n");
scenarioGraphData.put("averageThroughput", averageThroughputResultsGraphSet);
}
} | [
"static",
"void",
"constructAverageThroughput",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"LrProjectScenarioResults",
">",
"scenarioResults",
",",
"JSONObject",
"scenarioGraphData",
")",
"{",
"Map",
"<",
"Integer",
",",
"WholeRunResult",
">",
"averageThroughputRes... | Construct average throughput.
@param scenarioResults the scenario results
@param scenarioGraphData the scenario graph data | [
"Construct",
"average",
"throughput",
"."
] | 987536f5551bc76fd028d746a951d1fd72c7567a | https://github.com/hpsa/hpe-application-automation-tools-plugin/blob/987536f5551bc76fd028d746a951d1fd72c7567a/src/main/java/com/hp/application/automation/tools/results/LrGraphUtils.java#L261-L277 |
37,011 | hpsa/hpe-application-automation-tools-plugin | src/main/java/com/hp/application/automation/tools/results/LrGraphUtils.java | LrGraphUtils.constructTotalThroughputGraph | static void constructTotalThroughputGraph(Map.Entry<String, LrProjectScenarioResults> scenarioResults,
JSONObject scenarioGraphData) {
Map<Integer, WholeRunResult> totalThroughputResults = scenarioResults.getValue().getTotalThroughtputResults();
JSONObject totalThroughputResultsGraphSet =
extractWholeRunSlaResult(totalThroughputResults, "Bytes");
if (!totalThroughputResultsGraphSet.getJSONArray(LABELS).isEmpty()) {
totalThroughputResultsGraphSet.put(TITLE, "Total Throughput");
totalThroughputResultsGraphSet.put(X_AXIS_TITLE, "Build number");
totalThroughputResultsGraphSet.put(Y_AXIS_TITLE, "Bytes");
totalThroughputResultsGraphSet.put(DESCRIPTION,
" Displays the amount of throughput (in bytes) on the Web server during the load test. " +
"Throughput represents the amount of data that the Vusers received from the server at" +
" any given second. This graph helps you to evaluate the amount of load Vusers " +
"generate, in terms of server throughput.\n");
scenarioGraphData.put("totalThroughput", totalThroughputResultsGraphSet);
}
} | java | static void constructTotalThroughputGraph(Map.Entry<String, LrProjectScenarioResults> scenarioResults,
JSONObject scenarioGraphData) {
Map<Integer, WholeRunResult> totalThroughputResults = scenarioResults.getValue().getTotalThroughtputResults();
JSONObject totalThroughputResultsGraphSet =
extractWholeRunSlaResult(totalThroughputResults, "Bytes");
if (!totalThroughputResultsGraphSet.getJSONArray(LABELS).isEmpty()) {
totalThroughputResultsGraphSet.put(TITLE, "Total Throughput");
totalThroughputResultsGraphSet.put(X_AXIS_TITLE, "Build number");
totalThroughputResultsGraphSet.put(Y_AXIS_TITLE, "Bytes");
totalThroughputResultsGraphSet.put(DESCRIPTION,
" Displays the amount of throughput (in bytes) on the Web server during the load test. " +
"Throughput represents the amount of data that the Vusers received from the server at" +
" any given second. This graph helps you to evaluate the amount of load Vusers " +
"generate, in terms of server throughput.\n");
scenarioGraphData.put("totalThroughput", totalThroughputResultsGraphSet);
}
} | [
"static",
"void",
"constructTotalThroughputGraph",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"LrProjectScenarioResults",
">",
"scenarioResults",
",",
"JSONObject",
"scenarioGraphData",
")",
"{",
"Map",
"<",
"Integer",
",",
"WholeRunResult",
">",
"totalThroughputRe... | Construct total throughput graph.
@param scenarioResults the scenario results
@param scenarioGraphData the scenario graph data | [
"Construct",
"total",
"throughput",
"graph",
"."
] | 987536f5551bc76fd028d746a951d1fd72c7567a | https://github.com/hpsa/hpe-application-automation-tools-plugin/blob/987536f5551bc76fd028d746a951d1fd72c7567a/src/main/java/com/hp/application/automation/tools/results/LrGraphUtils.java#L308-L324 |
37,012 | hpsa/hpe-application-automation-tools-plugin | src/main/java/com/hp/application/automation/tools/results/LrGraphUtils.java | LrGraphUtils.constructAvgHitsGraph | static void constructAvgHitsGraph(Map.Entry<String, LrProjectScenarioResults> scenarioResults,
JSONObject scenarioGraphData) {
Map<Integer, WholeRunResult> avgHitsPerSec = scenarioResults.getValue().getAverageHitsPerSecondResults();
JSONObject avgHitsPerSecGraphSet = extractWholeRunSlaResult(avgHitsPerSec, "Hits/Sec");
if (!avgHitsPerSecGraphSet.getJSONArray(LABELS).isEmpty()) {
avgHitsPerSecGraphSet.put(TITLE, "Average Hits per Second");
avgHitsPerSecGraphSet.put(X_AXIS_TITLE, "Build number");
avgHitsPerSecGraphSet.put(Y_AXIS_TITLE, "Hits");
avgHitsPerSecGraphSet.put(DESCRIPTION,
"Displays the number of hits made on the Web server by Vusers " +
"during each second of the load test. This graph helps you evaluate the amount of load " +
"Vusers" +
" " +
"generate, in terms of the number of hits.");
scenarioGraphData.put("avgHitsPerSec", avgHitsPerSecGraphSet);
}
} | java | static void constructAvgHitsGraph(Map.Entry<String, LrProjectScenarioResults> scenarioResults,
JSONObject scenarioGraphData) {
Map<Integer, WholeRunResult> avgHitsPerSec = scenarioResults.getValue().getAverageHitsPerSecondResults();
JSONObject avgHitsPerSecGraphSet = extractWholeRunSlaResult(avgHitsPerSec, "Hits/Sec");
if (!avgHitsPerSecGraphSet.getJSONArray(LABELS).isEmpty()) {
avgHitsPerSecGraphSet.put(TITLE, "Average Hits per Second");
avgHitsPerSecGraphSet.put(X_AXIS_TITLE, "Build number");
avgHitsPerSecGraphSet.put(Y_AXIS_TITLE, "Hits");
avgHitsPerSecGraphSet.put(DESCRIPTION,
"Displays the number of hits made on the Web server by Vusers " +
"during each second of the load test. This graph helps you evaluate the amount of load " +
"Vusers" +
" " +
"generate, in terms of the number of hits.");
scenarioGraphData.put("avgHitsPerSec", avgHitsPerSecGraphSet);
}
} | [
"static",
"void",
"constructAvgHitsGraph",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"LrProjectScenarioResults",
">",
"scenarioResults",
",",
"JSONObject",
"scenarioGraphData",
")",
"{",
"Map",
"<",
"Integer",
",",
"WholeRunResult",
">",
"avgHitsPerSec",
"=",
... | Construct avg hits graph.
@param scenarioResults the scenario results
@param scenarioGraphData the scenario graph data | [
"Construct",
"avg",
"hits",
"graph",
"."
] | 987536f5551bc76fd028d746a951d1fd72c7567a | https://github.com/hpsa/hpe-application-automation-tools-plugin/blob/987536f5551bc76fd028d746a951d1fd72c7567a/src/main/java/com/hp/application/automation/tools/results/LrGraphUtils.java#L332-L348 |
37,013 | hpsa/hpe-application-automation-tools-plugin | src/main/java/com/hp/application/automation/tools/results/LrGraphUtils.java | LrGraphUtils.constructTotalHitsGraph | static void constructTotalHitsGraph(Map.Entry<String, LrProjectScenarioResults> scenarioResults,
JSONObject scenarioGraphData) {
Map<Integer, WholeRunResult> totalHitsResults = scenarioResults.getValue().getTotalHitsResults();
JSONObject totalHitsGraphSet = extractWholeRunSlaResult(totalHitsResults, "Hits");
if (!totalHitsGraphSet.getJSONArray(LABELS).isEmpty()) {
totalHitsGraphSet.put(TITLE, "Total Hits");
totalHitsGraphSet.put(X_AXIS_TITLE, "Build number");
totalHitsGraphSet.put(Y_AXIS_TITLE, "Hits");
totalHitsGraphSet.put(DESCRIPTION,
"Displays the number of hits made on the Web server by Vusers " +
"during each second of the load test. This graph helps you evaluate the amount of load " +
"Vusers" +
" " +
"generate, in terms of the number of hits.");
scenarioGraphData.put("totalHits", totalHitsGraphSet);
}
} | java | static void constructTotalHitsGraph(Map.Entry<String, LrProjectScenarioResults> scenarioResults,
JSONObject scenarioGraphData) {
Map<Integer, WholeRunResult> totalHitsResults = scenarioResults.getValue().getTotalHitsResults();
JSONObject totalHitsGraphSet = extractWholeRunSlaResult(totalHitsResults, "Hits");
if (!totalHitsGraphSet.getJSONArray(LABELS).isEmpty()) {
totalHitsGraphSet.put(TITLE, "Total Hits");
totalHitsGraphSet.put(X_AXIS_TITLE, "Build number");
totalHitsGraphSet.put(Y_AXIS_TITLE, "Hits");
totalHitsGraphSet.put(DESCRIPTION,
"Displays the number of hits made on the Web server by Vusers " +
"during each second of the load test. This graph helps you evaluate the amount of load " +
"Vusers" +
" " +
"generate, in terms of the number of hits.");
scenarioGraphData.put("totalHits", totalHitsGraphSet);
}
} | [
"static",
"void",
"constructTotalHitsGraph",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"LrProjectScenarioResults",
">",
"scenarioResults",
",",
"JSONObject",
"scenarioGraphData",
")",
"{",
"Map",
"<",
"Integer",
",",
"WholeRunResult",
">",
"totalHitsResults",
"=... | Construct total hits graph.
@param scenarioResults the scenario results
@param scenarioGraphData the scenario graph data | [
"Construct",
"total",
"hits",
"graph",
"."
] | 987536f5551bc76fd028d746a951d1fd72c7567a | https://github.com/hpsa/hpe-application-automation-tools-plugin/blob/987536f5551bc76fd028d746a951d1fd72c7567a/src/main/java/com/hp/application/automation/tools/results/LrGraphUtils.java#L356-L372 |
37,014 | hpsa/hpe-application-automation-tools-plugin | src/main/java/com/hp/application/automation/tools/sse/sdk/HttpRequestDecorator.java | HttpRequestDecorator.digestToString | private static String digestToString(byte[] b) {
StringBuilder result = new StringBuilder(128);
for (byte aB : b) {
result.append(Integer.toString((aB & 0xff) + 0x100, 16).substring(1));
}
return result.toString();
} | java | private static String digestToString(byte[] b) {
StringBuilder result = new StringBuilder(128);
for (byte aB : b) {
result.append(Integer.toString((aB & 0xff) + 0x100, 16).substring(1));
}
return result.toString();
} | [
"private",
"static",
"String",
"digestToString",
"(",
"byte",
"[",
"]",
"b",
")",
"{",
"StringBuilder",
"result",
"=",
"new",
"StringBuilder",
"(",
"128",
")",
";",
"for",
"(",
"byte",
"aB",
":",
"b",
")",
"{",
"result",
".",
"append",
"(",
"Integer",
... | This method convert byte array to string regardless the charset
@param b
byte array input
@return the corresponding string | [
"This",
"method",
"convert",
"byte",
"array",
"to",
"string",
"regardless",
"the",
"charset"
] | 987536f5551bc76fd028d746a951d1fd72c7567a | https://github.com/hpsa/hpe-application-automation-tools-plugin/blob/987536f5551bc76fd028d746a951d1fd72c7567a/src/main/java/com/hp/application/automation/tools/sse/sdk/HttpRequestDecorator.java#L56-L64 |
37,015 | hpsa/hpe-application-automation-tools-plugin | src/main/java/com/hp/application/automation/tools/results/PerformanceProjectAction.java | PerformanceProjectAction.getScenarioList | @JavaScriptMethod
public JSONArray getScenarioList() {
JSONArray scenarioList = new JSONArray();
for (String scenarioName : _projectResult.getScenarioResults().keySet()) {
JSONObject scenario = new JSONObject();
scenario.put("ScenarioName", scenarioName);
scenarioList.add(scenario);
}
return scenarioList;
} | java | @JavaScriptMethod
public JSONArray getScenarioList() {
JSONArray scenarioList = new JSONArray();
for (String scenarioName : _projectResult.getScenarioResults().keySet()) {
JSONObject scenario = new JSONObject();
scenario.put("ScenarioName", scenarioName);
scenarioList.add(scenario);
}
return scenarioList;
} | [
"@",
"JavaScriptMethod",
"public",
"JSONArray",
"getScenarioList",
"(",
")",
"{",
"JSONArray",
"scenarioList",
"=",
"new",
"JSONArray",
"(",
")",
";",
"for",
"(",
"String",
"scenarioName",
":",
"_projectResult",
".",
"getScenarioResults",
"(",
")",
".",
"keySet"... | Gets scenario list.
@return the scenario list | [
"Gets",
"scenario",
"list",
"."
] | 987536f5551bc76fd028d746a951d1fd72c7567a | https://github.com/hpsa/hpe-application-automation-tools-plugin/blob/987536f5551bc76fd028d746a951d1fd72c7567a/src/main/java/com/hp/application/automation/tools/results/PerformanceProjectAction.java#L103-L112 |
37,016 | hpsa/hpe-application-automation-tools-plugin | src/main/java/com/hp/application/automation/tools/results/PerformanceProjectAction.java | PerformanceProjectAction.getGraphData | @JavaScriptMethod
public JSONObject getGraphData() {
JSONObject projectDataSet = new JSONObject();
if (_projectResult == null) {
// getUpdatedData();
return new JSONObject();
}
for (SortedMap.Entry<String, LrProjectScenarioResults> scenarioResults : _projectResult.getScenarioResults()
.entrySet()) {
JSONObject scenarioData = new JSONObject();
JSONObject scenarioStats = new JSONObject();
// LrGraphUtils
// .constructVuserSummary(scenarioResults.getValue().getvUserSummary(), scenarioStats, _workedBuilds
// .size());
// LrGraphUtils.constructDurationSummary(scenarioResults.getValue().getDurationData(), scenarioStats);
// LrGraphUtils.constructConnectionSummary(scenarioResults.getValue().getMaxConnectionsCount(), scenarioStats);
// LrGraphUtils.constructTransactionSummary(scenarioResults.getValue().getTransactionSum(), scenarioStats,
// _workedBuilds.size());
scenarioData.put("scenarioStats", scenarioStats);
JSONObject scenarioGraphData = new JSONObject();
//Scenario data graphs
// LrGraphUtils.constructVuserGraph(scenarioResults, scenarioGraphData);
// LrGraphUtils.constructConnectionsGraph(scenarioResults, scenarioGraphData);
//Scenario SLA graphs
LrGraphUtils.constructTotalHitsGraph(scenarioResults, scenarioGraphData);
LrGraphUtils.constructAvgHitsGraph(scenarioResults, scenarioGraphData);
LrGraphUtils.constructTotalThroughputGraph(scenarioResults, scenarioGraphData);
LrGraphUtils.constructAverageThroughput(scenarioResults, scenarioGraphData);
LrGraphUtils.constructErrorGraph(scenarioResults, scenarioGraphData);
LrGraphUtils.constructAvgTransactionGraph(scenarioResults, scenarioGraphData);
LrGraphUtils.constructPercentileTransactionGraph(scenarioResults, scenarioGraphData);
scenarioData.put("scenarioData", scenarioGraphData);
String scenarioName = scenarioResults.getKey();
projectDataSet.put(scenarioName, scenarioData);
}
return projectDataSet;
} | java | @JavaScriptMethod
public JSONObject getGraphData() {
JSONObject projectDataSet = new JSONObject();
if (_projectResult == null) {
// getUpdatedData();
return new JSONObject();
}
for (SortedMap.Entry<String, LrProjectScenarioResults> scenarioResults : _projectResult.getScenarioResults()
.entrySet()) {
JSONObject scenarioData = new JSONObject();
JSONObject scenarioStats = new JSONObject();
// LrGraphUtils
// .constructVuserSummary(scenarioResults.getValue().getvUserSummary(), scenarioStats, _workedBuilds
// .size());
// LrGraphUtils.constructDurationSummary(scenarioResults.getValue().getDurationData(), scenarioStats);
// LrGraphUtils.constructConnectionSummary(scenarioResults.getValue().getMaxConnectionsCount(), scenarioStats);
// LrGraphUtils.constructTransactionSummary(scenarioResults.getValue().getTransactionSum(), scenarioStats,
// _workedBuilds.size());
scenarioData.put("scenarioStats", scenarioStats);
JSONObject scenarioGraphData = new JSONObject();
//Scenario data graphs
// LrGraphUtils.constructVuserGraph(scenarioResults, scenarioGraphData);
// LrGraphUtils.constructConnectionsGraph(scenarioResults, scenarioGraphData);
//Scenario SLA graphs
LrGraphUtils.constructTotalHitsGraph(scenarioResults, scenarioGraphData);
LrGraphUtils.constructAvgHitsGraph(scenarioResults, scenarioGraphData);
LrGraphUtils.constructTotalThroughputGraph(scenarioResults, scenarioGraphData);
LrGraphUtils.constructAverageThroughput(scenarioResults, scenarioGraphData);
LrGraphUtils.constructErrorGraph(scenarioResults, scenarioGraphData);
LrGraphUtils.constructAvgTransactionGraph(scenarioResults, scenarioGraphData);
LrGraphUtils.constructPercentileTransactionGraph(scenarioResults, scenarioGraphData);
scenarioData.put("scenarioData", scenarioGraphData);
String scenarioName = scenarioResults.getKey();
projectDataSet.put(scenarioName, scenarioData);
}
return projectDataSet;
} | [
"@",
"JavaScriptMethod",
"public",
"JSONObject",
"getGraphData",
"(",
")",
"{",
"JSONObject",
"projectDataSet",
"=",
"new",
"JSONObject",
"(",
")",
";",
"if",
"(",
"_projectResult",
"==",
"null",
")",
"{",
"// getUpdatedData();",
"return",
"new",
"JSONO... | Collates graph data per scenario per build for the whole project.
Adds the respected graphs with scenario as the key
@return the graph data | [
"Collates",
"graph",
"data",
"per",
"scenario",
"per",
"build",
"for",
"the",
"whole",
"project",
".",
"Adds",
"the",
"respected",
"graphs",
"with",
"scenario",
"as",
"the",
"key"
] | 987536f5551bc76fd028d746a951d1fd72c7567a | https://github.com/hpsa/hpe-application-automation-tools-plugin/blob/987536f5551bc76fd028d746a951d1fd72c7567a/src/main/java/com/hp/application/automation/tools/results/PerformanceProjectAction.java#L120-L164 |
37,017 | hpsa/hpe-application-automation-tools-plugin | src/main/java/com/hp/application/automation/tools/results/PerformanceProjectAction.java | PerformanceProjectAction.isVisible | boolean isVisible() {
List<? extends Run<?, ?>> builds = currentProject.getBuilds();
for (Run run : builds) {
if (run.getAction(PerformanceJobReportAction.class) != null) {
return true;
}
}
return false;
} | java | boolean isVisible() {
List<? extends Run<?, ?>> builds = currentProject.getBuilds();
for (Run run : builds) {
if (run.getAction(PerformanceJobReportAction.class) != null) {
return true;
}
}
return false;
} | [
"boolean",
"isVisible",
"(",
")",
"{",
"List",
"<",
"?",
"extends",
"Run",
"<",
"?",
",",
"?",
">",
">",
"builds",
"=",
"currentProject",
".",
"getBuilds",
"(",
")",
";",
"for",
"(",
"Run",
"run",
":",
"builds",
")",
"{",
"if",
"(",
"run",
".",
... | Is visible boolean.
@return the boolean | [
"Is",
"visible",
"boolean",
"."
] | 987536f5551bc76fd028d746a951d1fd72c7567a | https://github.com/hpsa/hpe-application-automation-tools-plugin/blob/987536f5551bc76fd028d746a951d1fd72c7567a/src/main/java/com/hp/application/automation/tools/results/PerformanceProjectAction.java#L214-L222 |
37,018 | hpsa/hpe-application-automation-tools-plugin | src/main/java/com/hp/application/automation/tools/results/PerformanceProjectAction.java | PerformanceProjectAction.getUpdatedData | public synchronized void getUpdatedData() {
if (!isUpdateDataNeeded()) {
return;
}
this._projectResult = new ProjectLrResults();
_workedBuilds = new ArrayList<Integer>();
RunList<? extends Run> projectBuilds = currentProject.getBuilds();
// updateLastBuild();
for (Run run : projectBuilds) {
PerformanceJobReportAction performanceJobReportAction = run.getAction(PerformanceJobReportAction.class);
if (performanceJobReportAction == null) {
continue;
}
if (run.isBuilding()) {
continue;
}
int runNumber = run.getNumber();
if (_workedBuilds.contains(runNumber)) {
continue;
}
_workedBuilds.add(runNumber);
LrJobResults jobLrResult = performanceJobReportAction.getLrResultBuildDataset();
// get all the ran scenario results from this run and insert them into the project
for (Map.Entry<String, JobLrScenarioResult> runResult : jobLrResult.getLrScenarioResults().entrySet()) {
// add the scenario if it's the first time it's ran in this build (allows scenarios to be also added
// at diffrent time)
if (!_projectResult.getScenarioResults().containsKey(runResult.getKey())) {
_projectResult.addScenario(new LrProjectScenarioResults(runResult.getKey()));
}
// Join the SLA rule results
LrProjectScenarioResults lrProjectScenarioResults =
_projectResult.getScenarioResults().get(runResult.getKey());
if(lrProjectScenarioResults.getBuildCount() > MAX_DISPLAY_BUILDS)
{
continue;
}
lrProjectScenarioResults.incBuildCount();
JobLrScenarioResult scenarioRunResult = runResult.getValue();
for (GoalResult goalResult : scenarioRunResult.scenarioSlaResults) {
scenarioGoalResult(runNumber, lrProjectScenarioResults, goalResult);
}
// Join sceanrio stats
joinSceanrioConnectionsStats(runNumber, lrProjectScenarioResults, scenarioRunResult);
joinVUserScenarioStats(runNumber, lrProjectScenarioResults, scenarioRunResult);
joinTransactionScenarioStats(runNumber, lrProjectScenarioResults, scenarioRunResult);
joinDurationStats(runNumber, lrProjectScenarioResults, scenarioRunResult);
}
}
} | java | public synchronized void getUpdatedData() {
if (!isUpdateDataNeeded()) {
return;
}
this._projectResult = new ProjectLrResults();
_workedBuilds = new ArrayList<Integer>();
RunList<? extends Run> projectBuilds = currentProject.getBuilds();
// updateLastBuild();
for (Run run : projectBuilds) {
PerformanceJobReportAction performanceJobReportAction = run.getAction(PerformanceJobReportAction.class);
if (performanceJobReportAction == null) {
continue;
}
if (run.isBuilding()) {
continue;
}
int runNumber = run.getNumber();
if (_workedBuilds.contains(runNumber)) {
continue;
}
_workedBuilds.add(runNumber);
LrJobResults jobLrResult = performanceJobReportAction.getLrResultBuildDataset();
// get all the ran scenario results from this run and insert them into the project
for (Map.Entry<String, JobLrScenarioResult> runResult : jobLrResult.getLrScenarioResults().entrySet()) {
// add the scenario if it's the first time it's ran in this build (allows scenarios to be also added
// at diffrent time)
if (!_projectResult.getScenarioResults().containsKey(runResult.getKey())) {
_projectResult.addScenario(new LrProjectScenarioResults(runResult.getKey()));
}
// Join the SLA rule results
LrProjectScenarioResults lrProjectScenarioResults =
_projectResult.getScenarioResults().get(runResult.getKey());
if(lrProjectScenarioResults.getBuildCount() > MAX_DISPLAY_BUILDS)
{
continue;
}
lrProjectScenarioResults.incBuildCount();
JobLrScenarioResult scenarioRunResult = runResult.getValue();
for (GoalResult goalResult : scenarioRunResult.scenarioSlaResults) {
scenarioGoalResult(runNumber, lrProjectScenarioResults, goalResult);
}
// Join sceanrio stats
joinSceanrioConnectionsStats(runNumber, lrProjectScenarioResults, scenarioRunResult);
joinVUserScenarioStats(runNumber, lrProjectScenarioResults, scenarioRunResult);
joinTransactionScenarioStats(runNumber, lrProjectScenarioResults, scenarioRunResult);
joinDurationStats(runNumber, lrProjectScenarioResults, scenarioRunResult);
}
}
} | [
"public",
"synchronized",
"void",
"getUpdatedData",
"(",
")",
"{",
"if",
"(",
"!",
"isUpdateDataNeeded",
"(",
")",
")",
"{",
"return",
";",
"}",
"this",
".",
"_projectResult",
"=",
"new",
"ProjectLrResults",
"(",
")",
";",
"_workedBuilds",
"=",
"new",
"Arr... | Gets updated data. | [
"Gets",
"updated",
"data",
"."
] | 987536f5551bc76fd028d746a951d1fd72c7567a | https://github.com/hpsa/hpe-application-automation-tools-plugin/blob/987536f5551bc76fd028d746a951d1fd72c7567a/src/main/java/com/hp/application/automation/tools/results/PerformanceProjectAction.java#L227-L288 |
37,019 | hpsa/hpe-application-automation-tools-plugin | src/main/java/com/hp/application/automation/tools/model/RunFromFileSystemModel.java | RunFromFileSystemModel.getJobDetails | public JSONObject getJobDetails(String mcUrl, String proxyAddress, String proxyUserName, String proxyPassword){
if(StringUtils.isBlank(fsUserName) || StringUtils.isBlank(fsPassword.getPlainText())){
return null;
}
return JobConfigurationProxy.getInstance().getJobById(mcUrl, fsUserName, fsPassword.getPlainText(), proxyAddress, proxyUserName, proxyPassword, fsJobId);
} | java | public JSONObject getJobDetails(String mcUrl, String proxyAddress, String proxyUserName, String proxyPassword){
if(StringUtils.isBlank(fsUserName) || StringUtils.isBlank(fsPassword.getPlainText())){
return null;
}
return JobConfigurationProxy.getInstance().getJobById(mcUrl, fsUserName, fsPassword.getPlainText(), proxyAddress, proxyUserName, proxyPassword, fsJobId);
} | [
"public",
"JSONObject",
"getJobDetails",
"(",
"String",
"mcUrl",
",",
"String",
"proxyAddress",
",",
"String",
"proxyUserName",
",",
"String",
"proxyPassword",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"fsUserName",
")",
"||",
"StringUtils",
".",
... | Get proxy details json object.
@param mcUrl the mc url
@param proxyAddress the proxy address
@param proxyUserName the proxy user name
@param proxyPassword the proxy password
@return the json object | [
"Get",
"proxy",
"details",
"json",
"object",
"."
] | 987536f5551bc76fd028d746a951d1fd72c7567a | https://github.com/hpsa/hpe-application-automation-tools-plugin/blob/987536f5551bc76fd028d746a951d1fd72c7567a/src/main/java/com/hp/application/automation/tools/model/RunFromFileSystemModel.java#L646-L651 |
37,020 | Intel-HLS/GKL | src/main/java/com/intel/gkl/smithwaterman/IntelSmithWaterman.java | IntelSmithWaterman.align | @Override
public SWNativeAlignerResult align(byte[] refArray, byte[] altArray, SWParameters parameters, SWOverhangStrategy overhangStrategy)
{
int intStrategy = getStrategy(overhangStrategy);
byte[] cigar = new byte[2*Integer.max(refArray.length, altArray.length)];
int offset = alignNative(refArray, altArray, cigar, parameters.getMatchValue(), parameters.getMismatchPenalty(), parameters.getGapOpenPenalty(), parameters.getGapExtendPenalty(), intStrategy);
return new SWNativeAlignerResult(new String(cigar).trim(), offset);
} | java | @Override
public SWNativeAlignerResult align(byte[] refArray, byte[] altArray, SWParameters parameters, SWOverhangStrategy overhangStrategy)
{
int intStrategy = getStrategy(overhangStrategy);
byte[] cigar = new byte[2*Integer.max(refArray.length, altArray.length)];
int offset = alignNative(refArray, altArray, cigar, parameters.getMatchValue(), parameters.getMismatchPenalty(), parameters.getGapOpenPenalty(), parameters.getGapExtendPenalty(), intStrategy);
return new SWNativeAlignerResult(new String(cigar).trim(), offset);
} | [
"@",
"Override",
"public",
"SWNativeAlignerResult",
"align",
"(",
"byte",
"[",
"]",
"refArray",
",",
"byte",
"[",
"]",
"altArray",
",",
"SWParameters",
"parameters",
",",
"SWOverhangStrategy",
"overhangStrategy",
")",
"{",
"int",
"intStrategy",
"=",
"getStrategy",... | Implements the native implementation of SmithWaterman, and returns the Cigar String and alignment_offset
@param refArray array of reference data
@param altArray array of alternate data | [
"Implements",
"the",
"native",
"implementation",
"of",
"SmithWaterman",
"and",
"returns",
"the",
"Cigar",
"String",
"and",
"alignment_offset"
] | c071276633f01d8198198fb40df468a0dffb0d41 | https://github.com/Intel-HLS/GKL/blob/c071276633f01d8198198fb40df468a0dffb0d41/src/main/java/com/intel/gkl/smithwaterman/IntelSmithWaterman.java#L95-L104 |
37,021 | Intel-HLS/GKL | src/main/java/com/intel/gkl/compression/IntelDeflaterFactory.java | IntelDeflaterFactory.makeDeflater | public Deflater makeDeflater(final int compressionLevel, final boolean gzipCompatible) {
if (intelDeflaterSupported) {
if ((compressionLevel == 1 && gzipCompatible) || compressionLevel != 1) {
return new IntelDeflater(compressionLevel, gzipCompatible);
}
}
logger.warn("IntelDeflater is not supported, using Java.util.zip.Deflater");
return new Deflater(compressionLevel, gzipCompatible);
} | java | public Deflater makeDeflater(final int compressionLevel, final boolean gzipCompatible) {
if (intelDeflaterSupported) {
if ((compressionLevel == 1 && gzipCompatible) || compressionLevel != 1) {
return new IntelDeflater(compressionLevel, gzipCompatible);
}
}
logger.warn("IntelDeflater is not supported, using Java.util.zip.Deflater");
return new Deflater(compressionLevel, gzipCompatible);
} | [
"public",
"Deflater",
"makeDeflater",
"(",
"final",
"int",
"compressionLevel",
",",
"final",
"boolean",
"gzipCompatible",
")",
"{",
"if",
"(",
"intelDeflaterSupported",
")",
"{",
"if",
"(",
"(",
"compressionLevel",
"==",
"1",
"&&",
"gzipCompatible",
")",
"||",
... | Returns an IntelDeflater if supported on the platform, otherwise returns a Java Deflater
@param compressionLevel the compression level (0-9)
@param gzipCompatible if true the use GZIP compatible compression
@return a Deflater object | [
"Returns",
"an",
"IntelDeflater",
"if",
"supported",
"on",
"the",
"platform",
"otherwise",
"returns",
"a",
"Java",
"Deflater"
] | c071276633f01d8198198fb40df468a0dffb0d41 | https://github.com/Intel-HLS/GKL/blob/c071276633f01d8198198fb40df468a0dffb0d41/src/main/java/com/intel/gkl/compression/IntelDeflaterFactory.java#L32-L40 |
37,022 | Intel-HLS/GKL | src/main/java/com/intel/gkl/pairhmm/IntelPairHmm.java | IntelPairHmm.initialize | public void initialize(PairHMMNativeArguments args) {
if (args == null) {
args = new PairHMMNativeArguments();
args.useDoublePrecision = false;
args.maxNumberOfThreads = 1;
}
if(!useFpga && gklUtils.isAvx512Supported()) {
logger.info("Using CPU-supported AVX-512 instructions");
}
if (args.useDoublePrecision && useFpga) {
logger.warn("FPGA PairHMM does not support double precision floating-point. Using AVX PairHMM");
}
if(!gklUtils.getFlushToZero()) {
logger.info("Flush-to-zero (FTZ) is enabled when running PairHMM");
}
initNative(ReadDataHolder.class, HaplotypeDataHolder.class, args.useDoublePrecision, args.maxNumberOfThreads, useFpga);
// log information about threads
int reqThreads = args.maxNumberOfThreads;
if (useOmp) {
int availThreads = gklUtils.getAvailableOmpThreads();
int maxThreads = Math.min(reqThreads, availThreads);
logger.info("Available threads: " + availThreads);
logger.info("Requested threads: " + reqThreads);
if (reqThreads > availThreads) {
logger.warn("Using " + maxThreads + " available threads, but " + reqThreads + " were requested");
}
}
else {
if (reqThreads != 1) {
logger.warn("Ignoring request for " + reqThreads + " threads; not using OpenMP implementation");
}
}
} | java | public void initialize(PairHMMNativeArguments args) {
if (args == null) {
args = new PairHMMNativeArguments();
args.useDoublePrecision = false;
args.maxNumberOfThreads = 1;
}
if(!useFpga && gklUtils.isAvx512Supported()) {
logger.info("Using CPU-supported AVX-512 instructions");
}
if (args.useDoublePrecision && useFpga) {
logger.warn("FPGA PairHMM does not support double precision floating-point. Using AVX PairHMM");
}
if(!gklUtils.getFlushToZero()) {
logger.info("Flush-to-zero (FTZ) is enabled when running PairHMM");
}
initNative(ReadDataHolder.class, HaplotypeDataHolder.class, args.useDoublePrecision, args.maxNumberOfThreads, useFpga);
// log information about threads
int reqThreads = args.maxNumberOfThreads;
if (useOmp) {
int availThreads = gklUtils.getAvailableOmpThreads();
int maxThreads = Math.min(reqThreads, availThreads);
logger.info("Available threads: " + availThreads);
logger.info("Requested threads: " + reqThreads);
if (reqThreads > availThreads) {
logger.warn("Using " + maxThreads + " available threads, but " + reqThreads + " were requested");
}
}
else {
if (reqThreads != 1) {
logger.warn("Ignoring request for " + reqThreads + " threads; not using OpenMP implementation");
}
}
} | [
"public",
"void",
"initialize",
"(",
"PairHMMNativeArguments",
"args",
")",
"{",
"if",
"(",
"args",
"==",
"null",
")",
"{",
"args",
"=",
"new",
"PairHMMNativeArguments",
"(",
")",
";",
"args",
".",
"useDoublePrecision",
"=",
"false",
";",
"args",
".",
"max... | Initialize native PairHMM with the supplied args.
@param args the args used to configure native PairHMM | [
"Initialize",
"native",
"PairHMM",
"with",
"the",
"supplied",
"args",
"."
] | c071276633f01d8198198fb40df468a0dffb0d41 | https://github.com/Intel-HLS/GKL/blob/c071276633f01d8198198fb40df468a0dffb0d41/src/main/java/com/intel/gkl/pairhmm/IntelPairHmm.java#L63-L101 |
37,023 | sbt-compiler-maven-plugin/sbt-compiler-maven-plugin | sbt-compiler-maven-plugin/src/main/java/com/google/code/sbt/compiler/plugin/SBTAddManagedSourcesMojo.java | SBTAddManagedSourcesMojo.execute | @Override
public void execute()
{
if ( "pom".equals( project.getPackaging() ) )
{
return;
}
File managedPath = new File( project.getBuild().getDirectory(), "src_managed" );
String managedPathStr = managedPath.getAbsolutePath();
if ( !project.getCompileSourceRoots().contains( managedPathStr ) )
{
project.addCompileSourceRoot( managedPathStr );
getLog().debug( "Added source directory: " + managedPathStr );
}
} | java | @Override
public void execute()
{
if ( "pom".equals( project.getPackaging() ) )
{
return;
}
File managedPath = new File( project.getBuild().getDirectory(), "src_managed" );
String managedPathStr = managedPath.getAbsolutePath();
if ( !project.getCompileSourceRoots().contains( managedPathStr ) )
{
project.addCompileSourceRoot( managedPathStr );
getLog().debug( "Added source directory: " + managedPathStr );
}
} | [
"@",
"Override",
"public",
"void",
"execute",
"(",
")",
"{",
"if",
"(",
"\"pom\"",
".",
"equals",
"(",
"project",
".",
"getPackaging",
"(",
")",
")",
")",
"{",
"return",
";",
"}",
"File",
"managedPath",
"=",
"new",
"File",
"(",
"project",
".",
"getBu... | Adds default SBT managed sources location to Maven project.
<code>${project.build.directory}/src_managed</code> is added to project's compile source roots | [
"Adds",
"default",
"SBT",
"managed",
"sources",
"location",
"to",
"Maven",
"project",
"."
] | cf8b8766956841c13f388eb311d214644dba9137 | https://github.com/sbt-compiler-maven-plugin/sbt-compiler-maven-plugin/blob/cf8b8766956841c13f388eb311d214644dba9137/sbt-compiler-maven-plugin/src/main/java/com/google/code/sbt/compiler/plugin/SBTAddManagedSourcesMojo.java#L53-L68 |
37,024 | sbt-compiler-maven-plugin/sbt-compiler-maven-plugin | sbt-compiler-maven-plugin/src/main/java/com/google/code/sbt/compiler/plugin/SBTAddScalaSourcesMojo.java | SBTAddScalaSourcesMojo.execute | @Override
public void execute()
{
if ( "pom".equals( project.getPackaging() ) )
{
return;
}
File baseDir = project.getBasedir();
File mainScalaPath = new File( baseDir, "src/main/scala" );
if ( mainScalaPath.isDirectory() )
{
String mainScalaPathStr = mainScalaPath.getAbsolutePath();
if ( !project.getCompileSourceRoots().contains( mainScalaPathStr ) )
{
project.addCompileSourceRoot( mainScalaPathStr );
getLog().debug( "Added source directory: " + mainScalaPathStr );
}
}
File testScalaPath = new File( baseDir, "src/test/scala" );
if ( testScalaPath.isDirectory() )
{
String testScalaPathStr = testScalaPath.getAbsolutePath();
if ( !project.getTestCompileSourceRoots().contains( testScalaPathStr ) )
{
project.addTestCompileSourceRoot( testScalaPathStr );
getLog().debug( "Added test source directory: " + testScalaPathStr );
}
}
} | java | @Override
public void execute()
{
if ( "pom".equals( project.getPackaging() ) )
{
return;
}
File baseDir = project.getBasedir();
File mainScalaPath = new File( baseDir, "src/main/scala" );
if ( mainScalaPath.isDirectory() )
{
String mainScalaPathStr = mainScalaPath.getAbsolutePath();
if ( !project.getCompileSourceRoots().contains( mainScalaPathStr ) )
{
project.addCompileSourceRoot( mainScalaPathStr );
getLog().debug( "Added source directory: " + mainScalaPathStr );
}
}
File testScalaPath = new File( baseDir, "src/test/scala" );
if ( testScalaPath.isDirectory() )
{
String testScalaPathStr = testScalaPath.getAbsolutePath();
if ( !project.getTestCompileSourceRoots().contains( testScalaPathStr ) )
{
project.addTestCompileSourceRoot( testScalaPathStr );
getLog().debug( "Added test source directory: " + testScalaPathStr );
}
}
} | [
"@",
"Override",
"public",
"void",
"execute",
"(",
")",
"{",
"if",
"(",
"\"pom\"",
".",
"equals",
"(",
"project",
".",
"getPackaging",
"(",
")",
")",
")",
"{",
"return",
";",
"}",
"File",
"baseDir",
"=",
"project",
".",
"getBasedir",
"(",
")",
";",
... | Adds default Scala sources locations to Maven project.
<ul>
<li>{@code src/main/scala} is added to project's compile source roots</li>
<li>{@code src/test/scala} is added to project's test compile source roots</li>
</ul> | [
"Adds",
"default",
"Scala",
"sources",
"locations",
"to",
"Maven",
"project",
"."
] | cf8b8766956841c13f388eb311d214644dba9137 | https://github.com/sbt-compiler-maven-plugin/sbt-compiler-maven-plugin/blob/cf8b8766956841c13f388eb311d214644dba9137/sbt-compiler-maven-plugin/src/main/java/com/google/code/sbt/compiler/plugin/SBTAddScalaSourcesMojo.java#L59-L90 |
37,025 | sbt-compiler-maven-plugin/sbt-compiler-maven-plugin | sbt-compiler-api/src/main/java/com/google/code/sbt/compiler/api/Compilers.java | Compilers.getCacheDirectory | public static File getCacheDirectory( File classesDirectory )
{
String classesDirectoryName = classesDirectory.getName();
String cacheDirectoryName = classesDirectoryName.replace( TEST_CLASSES, CACHE ).replace( CLASSES, CACHE );
return new File( classesDirectory.getParentFile(), cacheDirectoryName );
} | java | public static File getCacheDirectory( File classesDirectory )
{
String classesDirectoryName = classesDirectory.getName();
String cacheDirectoryName = classesDirectoryName.replace( TEST_CLASSES, CACHE ).replace( CLASSES, CACHE );
return new File( classesDirectory.getParentFile(), cacheDirectoryName );
} | [
"public",
"static",
"File",
"getCacheDirectory",
"(",
"File",
"classesDirectory",
")",
"{",
"String",
"classesDirectoryName",
"=",
"classesDirectory",
".",
"getName",
"(",
")",
";",
"String",
"cacheDirectoryName",
"=",
"classesDirectoryName",
".",
"replace",
"(",
"T... | Returns directory for incremental compilation cache files.
@param classesDirectory compilation output directory
@return directory for incremental compilation cache files | [
"Returns",
"directory",
"for",
"incremental",
"compilation",
"cache",
"files",
"."
] | cf8b8766956841c13f388eb311d214644dba9137 | https://github.com/sbt-compiler-maven-plugin/sbt-compiler-maven-plugin/blob/cf8b8766956841c13f388eb311d214644dba9137/sbt-compiler-api/src/main/java/com/google/code/sbt/compiler/api/Compilers.java#L84-L89 |
37,026 | sbt-compiler-maven-plugin/sbt-compiler-maven-plugin | sbt-compilers/sbt-compiler-sbt012/src/main/java/com/google/code/sbt/compiler/sbt012/SBT012Compiler.java | SBT012Compiler.getScalacProblems | private CompilationProblem[] getScalacProblems( Problem[] problems )
{
CompilationProblem[] result = new CompilationProblem[problems.length];
for ( int i = 0; i < problems.length; i++ )
{
Problem problem = problems[i];
Position position = problem.position();
Maybe<Integer> line = position.line();
String lineContent = position.lineContent();
Maybe<Integer> offset = position.offset();
Maybe<Integer> pointer = position.pointer();
Maybe<File> sourceFile = position.sourceFile();
SourcePosition sp =
new DefaultSourcePosition( line.isDefined() ? line.get().intValue() : -1, lineContent,
offset.isDefined() ? offset.get().intValue() : -1,
pointer.isDefined() ? pointer.get().intValue() : -1,
sourceFile.isDefined() ? sourceFile.get() : null );
result[i] =
new DefaultCompilationProblem( problem.category(), problem.message(), sp, problem.severity().name() );
}
return result;
} | java | private CompilationProblem[] getScalacProblems( Problem[] problems )
{
CompilationProblem[] result = new CompilationProblem[problems.length];
for ( int i = 0; i < problems.length; i++ )
{
Problem problem = problems[i];
Position position = problem.position();
Maybe<Integer> line = position.line();
String lineContent = position.lineContent();
Maybe<Integer> offset = position.offset();
Maybe<Integer> pointer = position.pointer();
Maybe<File> sourceFile = position.sourceFile();
SourcePosition sp =
new DefaultSourcePosition( line.isDefined() ? line.get().intValue() : -1, lineContent,
offset.isDefined() ? offset.get().intValue() : -1,
pointer.isDefined() ? pointer.get().intValue() : -1,
sourceFile.isDefined() ? sourceFile.get() : null );
result[i] =
new DefaultCompilationProblem( problem.category(), problem.message(), sp, problem.severity().name() );
}
return result;
} | [
"private",
"CompilationProblem",
"[",
"]",
"getScalacProblems",
"(",
"Problem",
"[",
"]",
"problems",
")",
"{",
"CompilationProblem",
"[",
"]",
"result",
"=",
"new",
"CompilationProblem",
"[",
"problems",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",... | scalac problems conversion | [
"scalac",
"problems",
"conversion"
] | cf8b8766956841c13f388eb311d214644dba9137 | https://github.com/sbt-compiler-maven-plugin/sbt-compiler-maven-plugin/blob/cf8b8766956841c13f388eb311d214644dba9137/sbt-compilers/sbt-compiler-sbt012/src/main/java/com/google/code/sbt/compiler/sbt012/SBT012Compiler.java#L141-L163 |
37,027 | qubole/qds-sdk-java | examples/src/main/java/com/qubole/qds/sdk/java/examples/SparkCommandExample.java | SparkCommandExample.submitScalaProgram | private static void submitScalaProgram(QdsClient client) throws Exception {
String sampleProgram = "println(\"hello world\")";
SparkCommandBuilder sparkBuilder = client.command().spark();
// Give a name to the command. (Optional)
sparkBuilder.name("spark-scala-test");
//Setting the program here
sparkBuilder.program(sampleProgram);
//setting the language here
sparkBuilder.language("scala");
CommandResponse commandResponse = sparkBuilder.invoke().get();
ResultLatch resultLatch = new ResultLatch(client, commandResponse.getId());
ResultValue resultValue = resultLatch.awaitResult();
System.out.println(resultValue.getResults());
String s = client.command().logs("" + commandResponse.getId()).invoke().get();
System.err.println(s);
} | java | private static void submitScalaProgram(QdsClient client) throws Exception {
String sampleProgram = "println(\"hello world\")";
SparkCommandBuilder sparkBuilder = client.command().spark();
// Give a name to the command. (Optional)
sparkBuilder.name("spark-scala-test");
//Setting the program here
sparkBuilder.program(sampleProgram);
//setting the language here
sparkBuilder.language("scala");
CommandResponse commandResponse = sparkBuilder.invoke().get();
ResultLatch resultLatch = new ResultLatch(client, commandResponse.getId());
ResultValue resultValue = resultLatch.awaitResult();
System.out.println(resultValue.getResults());
String s = client.command().logs("" + commandResponse.getId()).invoke().get();
System.err.println(s);
} | [
"private",
"static",
"void",
"submitScalaProgram",
"(",
"QdsClient",
"client",
")",
"throws",
"Exception",
"{",
"String",
"sampleProgram",
"=",
"\"println(\\\"hello world\\\")\"",
";",
"SparkCommandBuilder",
"sparkBuilder",
"=",
"client",
".",
"command",
"(",
")",
"."... | An Example of submitting Spark Command as a Scala program.
Similarly, we can submit Spark Command as a SQL query, R program
and Java program. | [
"An",
"Example",
"of",
"submitting",
"Spark",
"Command",
"as",
"a",
"Scala",
"program",
".",
"Similarly",
"we",
"can",
"submit",
"Spark",
"Command",
"as",
"a",
"SQL",
"query",
"R",
"program",
"and",
"Java",
"program",
"."
] | c652374075c7b72071f73db960f5f3a43f922afd | https://github.com/qubole/qds-sdk-java/blob/c652374075c7b72071f73db960f5f3a43f922afd/examples/src/main/java/com/qubole/qds/sdk/java/examples/SparkCommandExample.java#L51-L72 |
37,028 | qubole/qds-sdk-java | examples/src/main/java/com/qubole/qds/sdk/java/examples/SparkCommandExample.java | SparkCommandExample.submitSQLQuery | private static void submitSQLQuery(QdsClient client) throws Exception {
String sampleSqlQuery =
"select * from default_qubole_airline_origin_destination limit 100";
SparkCommandBuilder sparkBuilder = client.command().spark();
// Give a name to the command. (Optional)
sparkBuilder.name("spark-sql-test");
// Setting the sql query
sparkBuilder.sql(sampleSqlQuery);
CommandResponse commandResponse = sparkBuilder.invoke().get();
ResultLatch resultLatch = new ResultLatch(client, commandResponse.getId());
ResultValue resultValue = resultLatch.awaitResult();
System.out.println(resultValue.getResults());
String s = client.command().logs("" + commandResponse.getId()).invoke().get();
System.err.println(s);
} | java | private static void submitSQLQuery(QdsClient client) throws Exception {
String sampleSqlQuery =
"select * from default_qubole_airline_origin_destination limit 100";
SparkCommandBuilder sparkBuilder = client.command().spark();
// Give a name to the command. (Optional)
sparkBuilder.name("spark-sql-test");
// Setting the sql query
sparkBuilder.sql(sampleSqlQuery);
CommandResponse commandResponse = sparkBuilder.invoke().get();
ResultLatch resultLatch = new ResultLatch(client, commandResponse.getId());
ResultValue resultValue = resultLatch.awaitResult();
System.out.println(resultValue.getResults());
String s = client.command().logs("" + commandResponse.getId()).invoke().get();
System.err.println(s);
} | [
"private",
"static",
"void",
"submitSQLQuery",
"(",
"QdsClient",
"client",
")",
"throws",
"Exception",
"{",
"String",
"sampleSqlQuery",
"=",
"\"select * from default_qubole_airline_origin_destination limit 100\"",
";",
"SparkCommandBuilder",
"sparkBuilder",
"=",
"client",
"."... | An example of submitting Spark Command as a SQL query. | [
"An",
"example",
"of",
"submitting",
"Spark",
"Command",
"as",
"a",
"SQL",
"query",
"."
] | c652374075c7b72071f73db960f5f3a43f922afd | https://github.com/qubole/qds-sdk-java/blob/c652374075c7b72071f73db960f5f3a43f922afd/examples/src/main/java/com/qubole/qds/sdk/java/examples/SparkCommandExample.java#L77-L96 |
37,029 | abego/treelayout | org.abego.treelayout/src/main/java/org/abego/treelayout/TreeLayout.java | TreeLayout.secondWalk | private void secondWalk(TreeNode v, double m, int level, double levelStart) {
// construct the position from the prelim and the level information
// The rootLocation affects the way how x and y are changed and in what
// direction.
double levelChangeSign = getLevelChangeSign();
boolean levelChangeOnYAxis = isLevelChangeInYAxis();
double levelSize = getSizeOfLevel(level);
double x = getPrelim(v) + m;
double y;
AlignmentInLevel alignment = configuration.getAlignmentInLevel();
if (alignment == AlignmentInLevel.Center) {
y = levelStart + levelChangeSign * (levelSize / 2);
} else if (alignment == AlignmentInLevel.TowardsRoot) {
y = levelStart + levelChangeSign * (getNodeThickness(v) / 2);
} else {
y = levelStart + levelSize - levelChangeSign
* (getNodeThickness(v) / 2);
}
if (!levelChangeOnYAxis) {
double t = x;
x = y;
y = t;
}
positions.put(v, new NormalizedPosition(x, y));
// update the bounds
updateBounds(v, x, y);
// recurse
if (!tree.isLeaf(v)) {
double nextLevelStart = levelStart
+ (levelSize + configuration.getGapBetweenLevels(level + 1))
* levelChangeSign;
for (TreeNode w : tree.getChildren(v)) {
secondWalk(w, m + getMod(v), level + 1, nextLevelStart);
}
}
} | java | private void secondWalk(TreeNode v, double m, int level, double levelStart) {
// construct the position from the prelim and the level information
// The rootLocation affects the way how x and y are changed and in what
// direction.
double levelChangeSign = getLevelChangeSign();
boolean levelChangeOnYAxis = isLevelChangeInYAxis();
double levelSize = getSizeOfLevel(level);
double x = getPrelim(v) + m;
double y;
AlignmentInLevel alignment = configuration.getAlignmentInLevel();
if (alignment == AlignmentInLevel.Center) {
y = levelStart + levelChangeSign * (levelSize / 2);
} else if (alignment == AlignmentInLevel.TowardsRoot) {
y = levelStart + levelChangeSign * (getNodeThickness(v) / 2);
} else {
y = levelStart + levelSize - levelChangeSign
* (getNodeThickness(v) / 2);
}
if (!levelChangeOnYAxis) {
double t = x;
x = y;
y = t;
}
positions.put(v, new NormalizedPosition(x, y));
// update the bounds
updateBounds(v, x, y);
// recurse
if (!tree.isLeaf(v)) {
double nextLevelStart = levelStart
+ (levelSize + configuration.getGapBetweenLevels(level + 1))
* levelChangeSign;
for (TreeNode w : tree.getChildren(v)) {
secondWalk(w, m + getMod(v), level + 1, nextLevelStart);
}
}
} | [
"private",
"void",
"secondWalk",
"(",
"TreeNode",
"v",
",",
"double",
"m",
",",
"int",
"level",
",",
"double",
"levelStart",
")",
"{",
"// construct the position from the prelim and the level information",
"// The rootLocation affects the way how x and y are changed and in what",... | In difference to the original algorithm we also pass in extra level
information.
@param v
@param m
@param level
@param levelStart | [
"In",
"difference",
"to",
"the",
"original",
"algorithm",
"we",
"also",
"pass",
"in",
"extra",
"level",
"information",
"."
] | aa73af5803c6ec30db0b4ad192c7cba55d0862d2 | https://github.com/abego/treelayout/blob/aa73af5803c6ec30db0b4ad192c7cba55d0862d2/org.abego.treelayout/src/main/java/org/abego/treelayout/TreeLayout.java#L642-L684 |
37,030 | abego/treelayout | org.abego.treelayout/src/main/java/org/abego/treelayout/TreeLayout.java | TreeLayout.dumpTree | public void dumpTree(PrintStream printStream, DumpConfiguration dumpConfiguration) {
dumpTree(printStream,tree.getRoot(),0, dumpConfiguration);
} | java | public void dumpTree(PrintStream printStream, DumpConfiguration dumpConfiguration) {
dumpTree(printStream,tree.getRoot(),0, dumpConfiguration);
} | [
"public",
"void",
"dumpTree",
"(",
"PrintStream",
"printStream",
",",
"DumpConfiguration",
"dumpConfiguration",
")",
"{",
"dumpTree",
"(",
"printStream",
",",
"tree",
".",
"getRoot",
"(",
")",
",",
"0",
",",
"dumpConfiguration",
")",
";",
"}"
] | Prints a dump of the tree to the given printStream, using the node's
"toString" method.
@param printStream
@param dumpConfiguration
[default: new DumpConfiguration()] | [
"Prints",
"a",
"dump",
"of",
"the",
"tree",
"to",
"the",
"given",
"printStream",
"using",
"the",
"node",
"s",
"toString",
"method",
"."
] | aa73af5803c6ec30db0b4ad192c7cba55d0862d2 | https://github.com/abego/treelayout/blob/aa73af5803c6ec30db0b4ad192c7cba55d0862d2/org.abego.treelayout/src/main/java/org/abego/treelayout/TreeLayout.java#L894-L896 |
37,031 | abego/treelayout | org.abego.treelayout.demo/src/main/java/org/abego/treelayout/demo/svg/SVGUtil.java | SVGUtil.main | public static void main(String[] args) throws IOException {
String s = doc(svg(
160,
200,
rect(0, 0, 160, 200, "fill:red;")
+ svg(10,
10,
100,
100,
rect(0, 0, 100, 100,
"fill:orange; stroke:rgb(0,0,0);"))
+ line(20, 20, 100, 100,
"stroke:black; stroke-width:2px;")
+ line(20, 100, 100, 20,
"stroke:black; stroke-width:2px;")
+ text(10,
140,
"font-family:verdana; font-size:20px; font-weight:bold;",
"Hello world")));
File file = new File("demo.svg");
FileWriter w = null;
try {
w = new FileWriter(file);
w.write(s);
} finally {
if (w != null) {
w.close();
}
}
System.out.println(String.format("File written: %s",
file.getAbsolutePath()));
// optionally view the just created file
if (args.length > 0 && args[0].equals("-view")) {
if (!viewSVG(file)) {
System.err.println("'-view' not supported on this platform");
}
}
} | java | public static void main(String[] args) throws IOException {
String s = doc(svg(
160,
200,
rect(0, 0, 160, 200, "fill:red;")
+ svg(10,
10,
100,
100,
rect(0, 0, 100, 100,
"fill:orange; stroke:rgb(0,0,0);"))
+ line(20, 20, 100, 100,
"stroke:black; stroke-width:2px;")
+ line(20, 100, 100, 20,
"stroke:black; stroke-width:2px;")
+ text(10,
140,
"font-family:verdana; font-size:20px; font-weight:bold;",
"Hello world")));
File file = new File("demo.svg");
FileWriter w = null;
try {
w = new FileWriter(file);
w.write(s);
} finally {
if (w != null) {
w.close();
}
}
System.out.println(String.format("File written: %s",
file.getAbsolutePath()));
// optionally view the just created file
if (args.length > 0 && args[0].equals("-view")) {
if (!viewSVG(file)) {
System.err.println("'-view' not supported on this platform");
}
}
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"IOException",
"{",
"String",
"s",
"=",
"doc",
"(",
"svg",
"(",
"160",
",",
"200",
",",
"rect",
"(",
"0",
",",
"0",
",",
"160",
",",
"200",
",",
"\"fill:red;\"",
... | Creates a sample SVG file "demo.svg"
@param args option '-view': view the just created file
(may not be supported on all platforms)
@throws IOException | [
"Creates",
"a",
"sample",
"SVG",
"file",
"demo",
".",
"svg"
] | aa73af5803c6ec30db0b4ad192c7cba55d0862d2 | https://github.com/abego/treelayout/blob/aa73af5803c6ec30db0b4ad192c7cba55d0862d2/org.abego.treelayout.demo/src/main/java/org/abego/treelayout/demo/svg/SVGUtil.java#L218-L257 |
37,032 | qubole/qds-sdk-java | src/main/java/com/qubole/qds/sdk/java/client/ResultStreamer.java | ResultStreamer.getResults | public Reader getResults(ResultValue resultValue) throws Exception
{
if (resultValue.isInline())
{
return new StringReader(resultValue.getResults());
}
return readFromS3(resultValue.getResult_location());
} | java | public Reader getResults(ResultValue resultValue) throws Exception
{
if (resultValue.isInline())
{
return new StringReader(resultValue.getResults());
}
return readFromS3(resultValue.getResult_location());
} | [
"public",
"Reader",
"getResults",
"(",
"ResultValue",
"resultValue",
")",
"throws",
"Exception",
"{",
"if",
"(",
"resultValue",
".",
"isInline",
"(",
")",
")",
"{",
"return",
"new",
"StringReader",
"(",
"resultValue",
".",
"getResults",
"(",
")",
")",
";",
... | Return a stream over the given results. If the results are not inline, the
results will come from S3
@param resultValue result
@return stream
@throws Exception errors | [
"Return",
"a",
"stream",
"over",
"the",
"given",
"results",
".",
"If",
"the",
"results",
"are",
"not",
"inline",
"the",
"results",
"will",
"come",
"from",
"S3"
] | c652374075c7b72071f73db960f5f3a43f922afd | https://github.com/qubole/qds-sdk-java/blob/c652374075c7b72071f73db960f5f3a43f922afd/src/main/java/com/qubole/qds/sdk/java/client/ResultStreamer.java#L81-L89 |
37,033 | qubole/qds-sdk-java | src/main/java/com/qubole/qds/sdk/java/details/CompositeCommandBuilderImpl.java | CompositeCommandBuilderImpl.checkCommandTypeSupported | private boolean checkCommandTypeSupported(BaseCommand command)
{
// for command type none or composite
// we dont support adding it as base command
if ((command.getCommandType() == BaseCommand.COMMAND_TYPE.NONE)
|| (command.getCommandType() == BaseCommand.COMMAND_TYPE.COMPOSITE))
{
return false;
}
return true;
} | java | private boolean checkCommandTypeSupported(BaseCommand command)
{
// for command type none or composite
// we dont support adding it as base command
if ((command.getCommandType() == BaseCommand.COMMAND_TYPE.NONE)
|| (command.getCommandType() == BaseCommand.COMMAND_TYPE.COMPOSITE))
{
return false;
}
return true;
} | [
"private",
"boolean",
"checkCommandTypeSupported",
"(",
"BaseCommand",
"command",
")",
"{",
"// for command type none or composite",
"// we dont support adding it as base command",
"if",
"(",
"(",
"command",
".",
"getCommandType",
"(",
")",
"==",
"BaseCommand",
".",
"COMMAN... | workflow or not | [
"workflow",
"or",
"not"
] | c652374075c7b72071f73db960f5f3a43f922afd | https://github.com/qubole/qds-sdk-java/blob/c652374075c7b72071f73db960f5f3a43f922afd/src/main/java/com/qubole/qds/sdk/java/details/CompositeCommandBuilderImpl.java#L79-L89 |
37,034 | abego/treelayout | org.abego.treelayout/src/main/java/org/abego/treelayout/internal/util/java/lang/string/StringUtil.java | StringUtil.quote | public static String quote(String s, String nullResult) {
if (s == null) {
return nullResult;
}
StringBuffer result = new StringBuffer();
result.append('"');
int length = s.length();
for (int i = 0; i < length; i++) {
char c = s.charAt(i);
switch (c) {
case '\b': {
result.append("\\b");
break;
}
case '\f': {
result.append("\\f");
break;
}
case '\n': {
result.append("\\n");
break;
}
case '\r': {
result.append("\\r");
break;
}
case '\t': {
result.append("\\t");
break;
}
case '\\': {
result.append("\\\\");
break;
}
case '"': {
result.append("\\\"");
break;
}
default: {
if (c < ' ' || c >= '\u0080') {
String n = Integer.toHexString(c);
result.append("\\u");
result.append("0000".substring(n.length()));
result.append(n);
} else {
result.append(c);
}
}
}
}
result.append('"');
return result.toString();
} | java | public static String quote(String s, String nullResult) {
if (s == null) {
return nullResult;
}
StringBuffer result = new StringBuffer();
result.append('"');
int length = s.length();
for (int i = 0; i < length; i++) {
char c = s.charAt(i);
switch (c) {
case '\b': {
result.append("\\b");
break;
}
case '\f': {
result.append("\\f");
break;
}
case '\n': {
result.append("\\n");
break;
}
case '\r': {
result.append("\\r");
break;
}
case '\t': {
result.append("\\t");
break;
}
case '\\': {
result.append("\\\\");
break;
}
case '"': {
result.append("\\\"");
break;
}
default: {
if (c < ' ' || c >= '\u0080') {
String n = Integer.toHexString(c);
result.append("\\u");
result.append("0000".substring(n.length()));
result.append(n);
} else {
result.append(c);
}
}
}
}
result.append('"');
return result.toString();
} | [
"public",
"static",
"String",
"quote",
"(",
"String",
"s",
",",
"String",
"nullResult",
")",
"{",
"if",
"(",
"s",
"==",
"null",
")",
"{",
"return",
"nullResult",
";",
"}",
"StringBuffer",
"result",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"result",
"... | Returns a quoted version of a given string, i.e. as a Java String
Literal.
@param s
[nullable] the string to quote
@param nullResult
[default="null"] the String to be returned for null values.
@return the nullResult when s is null, otherwise s as a quoted string
(i.e. Java String Literal) | [
"Returns",
"a",
"quoted",
"version",
"of",
"a",
"given",
"string",
"i",
".",
"e",
".",
"as",
"a",
"Java",
"String",
"Literal",
"."
] | aa73af5803c6ec30db0b4ad192c7cba55d0862d2 | https://github.com/abego/treelayout/blob/aa73af5803c6ec30db0b4ad192c7cba55d0862d2/org.abego.treelayout/src/main/java/org/abego/treelayout/internal/util/java/lang/string/StringUtil.java#L45-L97 |
37,035 | digitalheir/java-xml-to-json | src/main/java/org/leibnizcenter/xml/TerseJson.java | TerseJson.parse | public static Document parse(JsonReader reader) throws IOException, NotImplemented {
reader.beginArray();
int nodeType = reader.nextInt();
CoreDocumentImpl doc = new DocumentImpl();
if (nodeType == Node.ELEMENT_NODE) {
addInitialElement(reader, doc);
} else if (nodeType == Node.DOCUMENT_NODE) {
addInitialDocNode(doc, reader);
} else {
throw new IllegalStateException("Don't know how to handle root node with type " + nodeType);
}
reader.endArray();
return doc;
} | java | public static Document parse(JsonReader reader) throws IOException, NotImplemented {
reader.beginArray();
int nodeType = reader.nextInt();
CoreDocumentImpl doc = new DocumentImpl();
if (nodeType == Node.ELEMENT_NODE) {
addInitialElement(reader, doc);
} else if (nodeType == Node.DOCUMENT_NODE) {
addInitialDocNode(doc, reader);
} else {
throw new IllegalStateException("Don't know how to handle root node with type " + nodeType);
}
reader.endArray();
return doc;
} | [
"public",
"static",
"Document",
"parse",
"(",
"JsonReader",
"reader",
")",
"throws",
"IOException",
",",
"NotImplemented",
"{",
"reader",
".",
"beginArray",
"(",
")",
";",
"int",
"nodeType",
"=",
"reader",
".",
"nextInt",
"(",
")",
";",
"CoreDocumentImpl",
"... | First element must be a document node or element node
@param reader JSON stream
@return XML document | [
"First",
"element",
"must",
"be",
"a",
"document",
"node",
"or",
"element",
"node"
] | 94b4cef671bea9b79fb6daa685cd5bf78c222179 | https://github.com/digitalheir/java-xml-to-json/blob/94b4cef671bea9b79fb6daa685cd5bf78c222179/src/main/java/org/leibnizcenter/xml/TerseJson.java#L35-L51 |
37,036 | digitalheir/java-xml-to-json | src/main/java/org/leibnizcenter/xml/TerseJson.java | TerseJson.toXml | public Document toXml(InputStream json) throws IOException, NotImplemented {
JsonReader reader = null;
try {
reader = new JsonReader(new InputStreamReader(json, "utf-8"));
return parse(reader);
} catch (UnsupportedEncodingException e) {
throw new IllegalStateException(e);
} finally {
if (reader != null) reader.close();
if (json != null) json.close();
}
} | java | public Document toXml(InputStream json) throws IOException, NotImplemented {
JsonReader reader = null;
try {
reader = new JsonReader(new InputStreamReader(json, "utf-8"));
return parse(reader);
} catch (UnsupportedEncodingException e) {
throw new IllegalStateException(e);
} finally {
if (reader != null) reader.close();
if (json != null) json.close();
}
} | [
"public",
"Document",
"toXml",
"(",
"InputStream",
"json",
")",
"throws",
"IOException",
",",
"NotImplemented",
"{",
"JsonReader",
"reader",
"=",
"null",
";",
"try",
"{",
"reader",
"=",
"new",
"JsonReader",
"(",
"new",
"InputStreamReader",
"(",
"json",
",",
... | First element must be a document
@param json JSON stream
@return XML document | [
"First",
"element",
"must",
"be",
"a",
"document"
] | 94b4cef671bea9b79fb6daa685cd5bf78c222179 | https://github.com/digitalheir/java-xml-to-json/blob/94b4cef671bea9b79fb6daa685cd5bf78c222179/src/main/java/org/leibnizcenter/xml/TerseJson.java#L214-L225 |
37,037 | zalando-stups/booties | misc/github-client-parent/github-client-spring/src/main/java/org/zalando/github/spring/StatusesTemplate.java | StatusesTemplate.getCombinedStatus | @Override
public CombinedStatus getCombinedStatus(String owner, String repository, String ref) {
Map<String, Object> uriVariables = new HashMap<>();
uriVariables.put("owner", owner);
uriVariables.put("repository", repository);
uriVariables.put("ref", ref);
return getRestOperations().exchange(buildUri("/repos/{owner}/{repository}/commits/{ref}/status", uriVariables),
HttpMethod.GET, null, CombinedStatus.class).getBody();
} | java | @Override
public CombinedStatus getCombinedStatus(String owner, String repository, String ref) {
Map<String, Object> uriVariables = new HashMap<>();
uriVariables.put("owner", owner);
uriVariables.put("repository", repository);
uriVariables.put("ref", ref);
return getRestOperations().exchange(buildUri("/repos/{owner}/{repository}/commits/{ref}/status", uriVariables),
HttpMethod.GET, null, CombinedStatus.class).getBody();
} | [
"@",
"Override",
"public",
"CombinedStatus",
"getCombinedStatus",
"(",
"String",
"owner",
",",
"String",
"repository",
",",
"String",
"ref",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"uriVariables",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"ur... | 'ref' can be SHA, branch or tag. | [
"ref",
"can",
"be",
"SHA",
"branch",
"or",
"tag",
"."
] | 4147ceccfa3c1b0139df86d86bd10f673b05549f | https://github.com/zalando-stups/booties/blob/4147ceccfa3c1b0139df86d86bd10f673b05549f/misc/github-client-parent/github-client-spring/src/main/java/org/zalando/github/spring/StatusesTemplate.java#L73-L82 |
37,038 | tdomzal/junit-docker-rule | src/main/java/pl/domzal/junit/docker/rule/DockerRule.java | DockerRule.waitForLogMessage | public void waitForLogMessage(final String logSearchString, int waitTime) throws TimeoutException {
WaitForContainer.waitForCondition(new LogChecker(this, logSearchString), waitTime, describe());
} | java | public void waitForLogMessage(final String logSearchString, int waitTime) throws TimeoutException {
WaitForContainer.waitForCondition(new LogChecker(this, logSearchString), waitTime, describe());
} | [
"public",
"void",
"waitForLogMessage",
"(",
"final",
"String",
"logSearchString",
",",
"int",
"waitTime",
")",
"throws",
"TimeoutException",
"{",
"WaitForContainer",
".",
"waitForCondition",
"(",
"new",
"LogChecker",
"(",
"this",
",",
"logSearchString",
")",
",",
... | Stop and wait till given string will show in container output.
@param logSearchString String to wait for in container output.
@param waitTime Wait time.
@throws TimeoutException On wait timeout. | [
"Stop",
"and",
"wait",
"till",
"given",
"string",
"will",
"show",
"in",
"container",
"output",
"."
] | 5a0ba2fd095d201530d3f9e614bc5e88d0afaeb2 | https://github.com/tdomzal/junit-docker-rule/blob/5a0ba2fd095d201530d3f9e614bc5e88d0afaeb2/src/main/java/pl/domzal/junit/docker/rule/DockerRule.java#L361-L363 |
37,039 | tdomzal/junit-docker-rule | src/main/java/pl/domzal/junit/docker/rule/DockerRule.java | DockerRule.waitForExit | public void waitForExit() throws InterruptedException {
try {
dockerClient.waitContainer(container.id());
} catch (DockerException e) {
throw new IllegalStateException(e);
}
} | java | public void waitForExit() throws InterruptedException {
try {
dockerClient.waitContainer(container.id());
} catch (DockerException e) {
throw new IllegalStateException(e);
}
} | [
"public",
"void",
"waitForExit",
"(",
")",
"throws",
"InterruptedException",
"{",
"try",
"{",
"dockerClient",
".",
"waitContainer",
"(",
"container",
".",
"id",
"(",
")",
")",
";",
"}",
"catch",
"(",
"DockerException",
"e",
")",
"{",
"throw",
"new",
"Illeg... | Block until container exit. | [
"Block",
"until",
"container",
"exit",
"."
] | 5a0ba2fd095d201530d3f9e614bc5e88d0afaeb2 | https://github.com/tdomzal/junit-docker-rule/blob/5a0ba2fd095d201530d3f9e614bc5e88d0afaeb2/src/main/java/pl/domzal/junit/docker/rule/DockerRule.java#L368-L374 |
37,040 | tdomzal/junit-docker-rule | src/main/java/pl/domzal/junit/docker/rule/DockerRule.java | DockerRule.getLog | public String getLog() {
try (LogStream stream = dockerClient.logs(container.id(), LogsParam.stdout(), LogsParam.stderr());) {
String fullLog = stream.readFully();
if (log.isTraceEnabled()) {
log.trace("{} full log: {}", containerShortId, StringUtils.replace(fullLog, "\n", "|"));
}
return fullLog;
} catch (DockerException | InterruptedException e) {
throw new IllegalStateException(e);
}
} | java | public String getLog() {
try (LogStream stream = dockerClient.logs(container.id(), LogsParam.stdout(), LogsParam.stderr());) {
String fullLog = stream.readFully();
if (log.isTraceEnabled()) {
log.trace("{} full log: {}", containerShortId, StringUtils.replace(fullLog, "\n", "|"));
}
return fullLog;
} catch (DockerException | InterruptedException e) {
throw new IllegalStateException(e);
}
} | [
"public",
"String",
"getLog",
"(",
")",
"{",
"try",
"(",
"LogStream",
"stream",
"=",
"dockerClient",
".",
"logs",
"(",
"container",
".",
"id",
"(",
")",
",",
"LogsParam",
".",
"stdout",
"(",
")",
",",
"LogsParam",
".",
"stderr",
"(",
")",
")",
";",
... | Container log. | [
"Container",
"log",
"."
] | 5a0ba2fd095d201530d3f9e614bc5e88d0afaeb2 | https://github.com/tdomzal/junit-docker-rule/blob/5a0ba2fd095d201530d3f9e614bc5e88d0afaeb2/src/main/java/pl/domzal/junit/docker/rule/DockerRule.java#L379-L390 |
37,041 | tdomzal/junit-docker-rule | src/main/java/pl/domzal/junit/docker/rule/DockerRuleBuilder.java | DockerRuleBuilder.keepContainer | public DockerRuleBuilder keepContainer(boolean keepContainer) {
if (keepContainer) {
this.stopOptions.setOptions(StopOption.KEEP);
} else {
this.stopOptions.setOptions(StopOption.REMOVE);
}
return this;
} | java | public DockerRuleBuilder keepContainer(boolean keepContainer) {
if (keepContainer) {
this.stopOptions.setOptions(StopOption.KEEP);
} else {
this.stopOptions.setOptions(StopOption.REMOVE);
}
return this;
} | [
"public",
"DockerRuleBuilder",
"keepContainer",
"(",
"boolean",
"keepContainer",
")",
"{",
"if",
"(",
"keepContainer",
")",
"{",
"this",
".",
"stopOptions",
".",
"setOptions",
"(",
"StopOption",
".",
"KEEP",
")",
";",
"}",
"else",
"{",
"this",
".",
"stopOpti... | Keep stopped container after test.
@deprecated Use {@link #stopOptions(StopOption...)} instead. | [
"Keep",
"stopped",
"container",
"after",
"test",
"."
] | 5a0ba2fd095d201530d3f9e614bc5e88d0afaeb2 | https://github.com/tdomzal/junit-docker-rule/blob/5a0ba2fd095d201530d3f9e614bc5e88d0afaeb2/src/main/java/pl/domzal/junit/docker/rule/DockerRuleBuilder.java#L153-L160 |
37,042 | tdomzal/junit-docker-rule | src/main/java/pl/domzal/junit/docker/rule/DockerRuleBuilder.java | DockerRuleBuilder.env | public DockerRuleBuilder env(String envName, String envValue) {
env.add(String.format("%s=%s", envName, envValue));
return this;
} | java | public DockerRuleBuilder env(String envName, String envValue) {
env.add(String.format("%s=%s", envName, envValue));
return this;
} | [
"public",
"DockerRuleBuilder",
"env",
"(",
"String",
"envName",
",",
"String",
"envValue",
")",
"{",
"env",
".",
"add",
"(",
"String",
".",
"format",
"(",
"\"%s=%s\"",
",",
"envName",
",",
"envValue",
")",
")",
";",
"return",
"this",
";",
"}"
] | Set environment variable in the container. | [
"Set",
"environment",
"variable",
"in",
"the",
"container",
"."
] | 5a0ba2fd095d201530d3f9e614bc5e88d0afaeb2 | https://github.com/tdomzal/junit-docker-rule/blob/5a0ba2fd095d201530d3f9e614bc5e88d0afaeb2/src/main/java/pl/domzal/junit/docker/rule/DockerRuleBuilder.java#L209-L212 |
37,043 | tdomzal/junit-docker-rule | src/main/java/pl/domzal/junit/docker/rule/WaitForContainer.java | WaitForContainer.waitForCondition | static void waitForCondition(final StartConditionCheck condition, int timeoutSeconds, final String containerDescription) throws TimeoutException {
try {
log.info("wait for {} started", condition.describe());
new WaitForUnit(TimeUnit.SECONDS, timeoutSeconds, TimeUnit.SECONDS, 1, new WaitForUnit.WaitForCondition() {
@Override
public boolean isConditionMet() {
return condition.check();
}
@Override
public String timeoutMessage() {
return String.format("timeout waiting for %s in container %s", condition.describe(), containerDescription);
}
}).startWaiting();
log.info("wait for {} - condition met", condition.describe());
} catch (InterruptedException e) {
throw new IllegalStateException(String.format("Interrupted while waiting for %s", condition.describe()), e);
}
} | java | static void waitForCondition(final StartConditionCheck condition, int timeoutSeconds, final String containerDescription) throws TimeoutException {
try {
log.info("wait for {} started", condition.describe());
new WaitForUnit(TimeUnit.SECONDS, timeoutSeconds, TimeUnit.SECONDS, 1, new WaitForUnit.WaitForCondition() {
@Override
public boolean isConditionMet() {
return condition.check();
}
@Override
public String timeoutMessage() {
return String.format("timeout waiting for %s in container %s", condition.describe(), containerDescription);
}
}).startWaiting();
log.info("wait for {} - condition met", condition.describe());
} catch (InterruptedException e) {
throw new IllegalStateException(String.format("Interrupted while waiting for %s", condition.describe()), e);
}
} | [
"static",
"void",
"waitForCondition",
"(",
"final",
"StartConditionCheck",
"condition",
",",
"int",
"timeoutSeconds",
",",
"final",
"String",
"containerDescription",
")",
"throws",
"TimeoutException",
"{",
"try",
"{",
"log",
".",
"info",
"(",
"\"wait for {} started\""... | Wait till all given conditions are met.
@param condition Conditions to wait for - all must be met to continue.
@param timeoutSeconds Wait timeout.
@param containerDescription Container description. For log and exception message usage only. | [
"Wait",
"till",
"all",
"given",
"conditions",
"are",
"met",
"."
] | 5a0ba2fd095d201530d3f9e614bc5e88d0afaeb2 | https://github.com/tdomzal/junit-docker-rule/blob/5a0ba2fd095d201530d3f9e614bc5e88d0afaeb2/src/main/java/pl/domzal/junit/docker/rule/WaitForContainer.java#L25-L42 |
37,044 | paymill/paymill-java | src/main/java/com/paymill/services/ClientService.java | ClientService.update | public void update( Client client ) {
RestfulUtils.update( ClientService.PATH, client, Client.class, super.httpClient );
} | java | public void update( Client client ) {
RestfulUtils.update( ClientService.PATH, client, Client.class, super.httpClient );
} | [
"public",
"void",
"update",
"(",
"Client",
"client",
")",
"{",
"RestfulUtils",
".",
"update",
"(",
"ClientService",
".",
"PATH",
",",
"client",
",",
"Client",
".",
"class",
",",
"super",
".",
"httpClient",
")",
";",
"}"
] | This function updates the data of a client. To change only a specific attribute you can set this attribute in the update
request. All other attributes that should not be edited are not inserted. You can only edit the description, email and credit
card. The subscription can not be changed by updating the client data. This has to be done in the subscription call.
@param client
A {@link Client} with Id. | [
"This",
"function",
"updates",
"the",
"data",
"of",
"a",
"client",
".",
"To",
"change",
"only",
"a",
"specific",
"attribute",
"you",
"can",
"set",
"this",
"attribute",
"in",
"the",
"update",
"request",
".",
"All",
"other",
"attributes",
"that",
"should",
"... | 17281a0d4376c76f1711af9f09bfc138c90ba65a | https://github.com/paymill/paymill-java/blob/17281a0d4376c76f1711af9f09bfc138c90ba65a/src/main/java/com/paymill/services/ClientService.java#L149-L151 |
37,045 | paymill/paymill-java | src/main/java/com/paymill/services/ClientService.java | ClientService.delete | public void delete( Client client ) {
RestfulUtils.delete( ClientService.PATH, client, Client.class, super.httpClient );
} | java | public void delete( Client client ) {
RestfulUtils.delete( ClientService.PATH, client, Client.class, super.httpClient );
} | [
"public",
"void",
"delete",
"(",
"Client",
"client",
")",
"{",
"RestfulUtils",
".",
"delete",
"(",
"ClientService",
".",
"PATH",
",",
"client",
",",
"Client",
".",
"class",
",",
"super",
".",
"httpClient",
")",
";",
"}"
] | This function deletes a client, but its transactions are not deleted.
@param client
A {@link Client} with Id. | [
"This",
"function",
"deletes",
"a",
"client",
"but",
"its",
"transactions",
"are",
"not",
"deleted",
"."
] | 17281a0d4376c76f1711af9f09bfc138c90ba65a | https://github.com/paymill/paymill-java/blob/17281a0d4376c76f1711af9f09bfc138c90ba65a/src/main/java/com/paymill/services/ClientService.java#L158-L160 |
37,046 | paymill/paymill-java | src/main/java/com/paymill/services/PreauthorizationService.java | PreauthorizationService.delete | public void delete( final Preauthorization preauthorization ) {
RestfulUtils.delete( PreauthorizationService.PATH, preauthorization, Preauthorization.class, super.httpClient );
} | java | public void delete( final Preauthorization preauthorization ) {
RestfulUtils.delete( PreauthorizationService.PATH, preauthorization, Preauthorization.class, super.httpClient );
} | [
"public",
"void",
"delete",
"(",
"final",
"Preauthorization",
"preauthorization",
")",
"{",
"RestfulUtils",
".",
"delete",
"(",
"PreauthorizationService",
".",
"PATH",
",",
"preauthorization",
",",
"Preauthorization",
".",
"class",
",",
"super",
".",
"httpClient",
... | This function deletes a preauthorization.
@param preauthorization
The {@link Preauthorization} object to be deleted. | [
"This",
"function",
"deletes",
"a",
"preauthorization",
"."
] | 17281a0d4376c76f1711af9f09bfc138c90ba65a | https://github.com/paymill/paymill-java/blob/17281a0d4376c76f1711af9f09bfc138c90ba65a/src/main/java/com/paymill/services/PreauthorizationService.java#L196-L198 |
37,047 | paymill/paymill-java | src/main/java/com/paymill/services/OfferService.java | OfferService.delete | public void delete(Offer offer, boolean removeWithSubscriptions) {
ParameterMap<String, String> params = new ParameterMap<String, String>();
params.add("remove_with_subscriptions", String.valueOf(removeWithSubscriptions));
RestfulUtils.delete(OfferService.PATH, offer, params, Offer.class, super.httpClient);
} | java | public void delete(Offer offer, boolean removeWithSubscriptions) {
ParameterMap<String, String> params = new ParameterMap<String, String>();
params.add("remove_with_subscriptions", String.valueOf(removeWithSubscriptions));
RestfulUtils.delete(OfferService.PATH, offer, params, Offer.class, super.httpClient);
} | [
"public",
"void",
"delete",
"(",
"Offer",
"offer",
",",
"boolean",
"removeWithSubscriptions",
")",
"{",
"ParameterMap",
"<",
"String",
",",
"String",
">",
"params",
"=",
"new",
"ParameterMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"params",
"."... | Remove an offer.
@param offer the {@link Offer}.
@param removeWithSubscriptions if true, the plan and all subscriptions associated with it will be deleted. If
false, only the plan will be deleted. | [
"Remove",
"an",
"offer",
"."
] | 17281a0d4376c76f1711af9f09bfc138c90ba65a | https://github.com/paymill/paymill-java/blob/17281a0d4376c76f1711af9f09bfc138c90ba65a/src/main/java/com/paymill/services/OfferService.java#L193-L197 |
37,048 | apptik/JustJson | json-schema/src/main/java/io/apptik/json/schema/Schema.java | Schema.setId | public <O extends Schema> O setId(String schemaId) {
getJson().put("id", schemaId);
return (O)this;
} | java | public <O extends Schema> O setId(String schemaId) {
getJson().put("id", schemaId);
return (O)this;
} | [
"public",
"<",
"O",
"extends",
"Schema",
">",
"O",
"setId",
"(",
"String",
"schemaId",
")",
"{",
"getJson",
"(",
")",
".",
"put",
"(",
"\"id\"",
",",
"schemaId",
")",
";",
"return",
"(",
"O",
")",
"this",
";",
"}"
] | Should be URI
@param schemaId
@param <O>
@return | [
"Should",
"be",
"URI"
] | c90f0dd7f84df26da4749be8cd9b026fff499a79 | https://github.com/apptik/JustJson/blob/c90f0dd7f84df26da4749be8cd9b026fff499a79/json-schema/src/main/java/io/apptik/json/schema/Schema.java#L245-L248 |
37,049 | apptik/JustJson | json-schema/src/main/java/io/apptik/json/schema/validation/CommonMatchers.java | CommonMatchers.withCharsLessOrEqualTo | public static Matcher<JsonElement> withCharsLessOrEqualTo(final int value) {
return new TypeSafeDiagnosingMatcher<JsonElement>() {
@Override
protected boolean matchesSafely(JsonElement item, Description mismatchDescription) {
//we do not care for the properties if parent item is not String
if (!item.isString()) return true;
if (item.asString().length() > value) {
mismatchDescription.appendText("String length more than maximum value: " + value);
return false;
}
return true;
}
@Override
public void describeTo(Description description) {
description.appendText("String maximum length");
}
};
} | java | public static Matcher<JsonElement> withCharsLessOrEqualTo(final int value) {
return new TypeSafeDiagnosingMatcher<JsonElement>() {
@Override
protected boolean matchesSafely(JsonElement item, Description mismatchDescription) {
//we do not care for the properties if parent item is not String
if (!item.isString()) return true;
if (item.asString().length() > value) {
mismatchDescription.appendText("String length more than maximum value: " + value);
return false;
}
return true;
}
@Override
public void describeTo(Description description) {
description.appendText("String maximum length");
}
};
} | [
"public",
"static",
"Matcher",
"<",
"JsonElement",
">",
"withCharsLessOrEqualTo",
"(",
"final",
"int",
"value",
")",
"{",
"return",
"new",
"TypeSafeDiagnosingMatcher",
"<",
"JsonElement",
">",
"(",
")",
"{",
"@",
"Override",
"protected",
"boolean",
"matchesSafely"... | ==> STRING ==> | [
"==",
">",
"STRING",
"==",
">"
] | c90f0dd7f84df26da4749be8cd9b026fff499a79 | https://github.com/apptik/JustJson/blob/c90f0dd7f84df26da4749be8cd9b026fff499a79/json-schema/src/main/java/io/apptik/json/schema/validation/CommonMatchers.java#L40-L59 |
37,050 | apptik/JustJson | json-schema/src/main/java/io/apptik/json/schema/validation/CommonMatchers.java | CommonMatchers.isOfType | public static Matcher<JsonElement> isOfType(final String type) {
return new TypeSafeDiagnosingMatcher<JsonElement>() {
@Override
protected boolean matchesSafely(JsonElement item, Description mismatchDescription) {
if (type.equals(item.getJsonType()))
return true;
else {
mismatchDescription.appendText(", mismatch type '" + item.getJsonType() + "'");
return false;
}
}
@Override
public void describeTo(Description description) {
description.appendText("\nMatch to type: " + type);
}
};
} | java | public static Matcher<JsonElement> isOfType(final String type) {
return new TypeSafeDiagnosingMatcher<JsonElement>() {
@Override
protected boolean matchesSafely(JsonElement item, Description mismatchDescription) {
if (type.equals(item.getJsonType()))
return true;
else {
mismatchDescription.appendText(", mismatch type '" + item.getJsonType() + "'");
return false;
}
}
@Override
public void describeTo(Description description) {
description.appendText("\nMatch to type: " + type);
}
};
} | [
"public",
"static",
"Matcher",
"<",
"JsonElement",
">",
"isOfType",
"(",
"final",
"String",
"type",
")",
"{",
"return",
"new",
"TypeSafeDiagnosingMatcher",
"<",
"JsonElement",
">",
"(",
")",
"{",
"@",
"Override",
"protected",
"boolean",
"matchesSafely",
"(",
"... | ==> COMMON ==> | [
"==",
">",
"COMMON",
"==",
">"
] | c90f0dd7f84df26da4749be8cd9b026fff499a79 | https://github.com/apptik/JustJson/blob/c90f0dd7f84df26da4749be8cd9b026fff499a79/json-schema/src/main/java/io/apptik/json/schema/validation/CommonMatchers.java#L220-L237 |
37,051 | apptik/JustJson | json-schema/src/main/java/io/apptik/json/schema/validation/CommonMatchers.java | CommonMatchers.areItemsValid | public static Matcher<JsonElement> areItemsValid(final Validator validator) {
return new TypeSafeDiagnosingMatcher<JsonElement>() {
@Override
protected boolean matchesSafely(JsonElement item, Description mismatchDescription) {
//we do not care for the properties if parent item is not JsonArray
if (!item.isJsonArray()) return true;
for (int i = 0; i < item.asJsonArray().length(); i++) {
StringBuilder sb = new StringBuilder();
if (!validator.validate(item.asJsonArray().opt(i), sb)) {
mismatchDescription.appendText("item at pos: " + i + ", does not validate by validator " + validator.getTitle())
.appendText("\nDetails: ")
.appendText(sb.toString());
return false;
}
}
return true;
}
@Override
public void describeTo(Description description) {
description.appendText("are array items valid");
}
};
} | java | public static Matcher<JsonElement> areItemsValid(final Validator validator) {
return new TypeSafeDiagnosingMatcher<JsonElement>() {
@Override
protected boolean matchesSafely(JsonElement item, Description mismatchDescription) {
//we do not care for the properties if parent item is not JsonArray
if (!item.isJsonArray()) return true;
for (int i = 0; i < item.asJsonArray().length(); i++) {
StringBuilder sb = new StringBuilder();
if (!validator.validate(item.asJsonArray().opt(i), sb)) {
mismatchDescription.appendText("item at pos: " + i + ", does not validate by validator " + validator.getTitle())
.appendText("\nDetails: ")
.appendText(sb.toString());
return false;
}
}
return true;
}
@Override
public void describeTo(Description description) {
description.appendText("are array items valid");
}
};
} | [
"public",
"static",
"Matcher",
"<",
"JsonElement",
">",
"areItemsValid",
"(",
"final",
"Validator",
"validator",
")",
"{",
"return",
"new",
"TypeSafeDiagnosingMatcher",
"<",
"JsonElement",
">",
"(",
")",
"{",
"@",
"Override",
"protected",
"boolean",
"matchesSafely... | ==> ARRAY ==> | [
"==",
">",
"ARRAY",
"==",
">"
] | c90f0dd7f84df26da4749be8cd9b026fff499a79 | https://github.com/apptik/JustJson/blob/c90f0dd7f84df26da4749be8cd9b026fff499a79/json-schema/src/main/java/io/apptik/json/schema/validation/CommonMatchers.java#L282-L306 |
37,052 | apptik/JustJson | json-schema/src/main/java/io/apptik/json/schema/validation/CommonMatchers.java | CommonMatchers.maxProperties | public static Matcher<JsonElement> maxProperties(final int maxProperties) {
return new TypeSafeDiagnosingMatcher<JsonElement>() {
@Override
protected boolean matchesSafely(JsonElement item, Description mismatchDescription) {
//we do not care for the properties if parent item is not JsonObject
if (!item.isJsonObject()) return true;
if (item.asJsonObject().length() > maxProperties) {
mismatchDescription.appendText("properties in Json object more than defined");
return false;
}
return true;
}
@Override
public void describeTo(Description description) {
description.appendText("object properties max count");
}
};
} | java | public static Matcher<JsonElement> maxProperties(final int maxProperties) {
return new TypeSafeDiagnosingMatcher<JsonElement>() {
@Override
protected boolean matchesSafely(JsonElement item, Description mismatchDescription) {
//we do not care for the properties if parent item is not JsonObject
if (!item.isJsonObject()) return true;
if (item.asJsonObject().length() > maxProperties) {
mismatchDescription.appendText("properties in Json object more than defined");
return false;
}
return true;
}
@Override
public void describeTo(Description description) {
description.appendText("object properties max count");
}
};
} | [
"public",
"static",
"Matcher",
"<",
"JsonElement",
">",
"maxProperties",
"(",
"final",
"int",
"maxProperties",
")",
"{",
"return",
"new",
"TypeSafeDiagnosingMatcher",
"<",
"JsonElement",
">",
"(",
")",
"{",
"@",
"Override",
"protected",
"boolean",
"matchesSafely",... | ==> OBJECT ==> | [
"==",
">",
"OBJECT",
"==",
">"
] | c90f0dd7f84df26da4749be8cd9b026fff499a79 | https://github.com/apptik/JustJson/blob/c90f0dd7f84df26da4749be8cd9b026fff499a79/json-schema/src/main/java/io/apptik/json/schema/validation/CommonMatchers.java#L426-L447 |
37,053 | apptik/JustJson | json-core/src/main/java/io/apptik/json/JsonElement.java | JsonElement.wrap | public static JsonElement wrap(Object o) throws JsonException {
if (o == null) {
//null value means not specified i.e.-> no valued will be mapped
//Json.null is specific value
return null;
}
if (o instanceof JsonElement) {
return (JsonElement) o;
}
if (o instanceof ElementWrapper) {
return ((ElementWrapper) o).getJson();
}
if (o instanceof Collection) {
return new JsonArray((Collection) o);
} else if (o.getClass().isArray()) {
return new JsonArray(o);
}
if (o instanceof Map) {
return new JsonObject((Map) o);
}
if (o instanceof Boolean) {
return new JsonBoolean((Boolean) o);
}
if (o instanceof Number) {
return new JsonNumber((Number) o);
}
if (o instanceof String) {
return new JsonString((String) o);
}
if (o instanceof Character) {
return new JsonString(Character.toString((Character) o));
}
if (o instanceof ByteBuffer) {
return new JsonString(((ByteBuffer) o).asCharBuffer().toString());
}
return new JsonString(o.toString());
} | java | public static JsonElement wrap(Object o) throws JsonException {
if (o == null) {
//null value means not specified i.e.-> no valued will be mapped
//Json.null is specific value
return null;
}
if (o instanceof JsonElement) {
return (JsonElement) o;
}
if (o instanceof ElementWrapper) {
return ((ElementWrapper) o).getJson();
}
if (o instanceof Collection) {
return new JsonArray((Collection) o);
} else if (o.getClass().isArray()) {
return new JsonArray(o);
}
if (o instanceof Map) {
return new JsonObject((Map) o);
}
if (o instanceof Boolean) {
return new JsonBoolean((Boolean) o);
}
if (o instanceof Number) {
return new JsonNumber((Number) o);
}
if (o instanceof String) {
return new JsonString((String) o);
}
if (o instanceof Character) {
return new JsonString(Character.toString((Character) o));
}
if (o instanceof ByteBuffer) {
return new JsonString(((ByteBuffer) o).asCharBuffer().toString());
}
return new JsonString(o.toString());
} | [
"public",
"static",
"JsonElement",
"wrap",
"(",
"Object",
"o",
")",
"throws",
"JsonException",
"{",
"if",
"(",
"o",
"==",
"null",
")",
"{",
"//null value means not specified i.e.-> no valued will be mapped",
"//Json.null is specific value",
"return",
"null",
";",
"}",
... | Wraps the given object if to JsonXXX object. | [
"Wraps",
"the",
"given",
"object",
"if",
"to",
"JsonXXX",
"object",
"."
] | c90f0dd7f84df26da4749be8cd9b026fff499a79 | https://github.com/apptik/JustJson/blob/c90f0dd7f84df26da4749be8cd9b026fff499a79/json-core/src/main/java/io/apptik/json/JsonElement.java#L129-L166 |
37,054 | apptik/JustJson | json-schema/src/main/java/io/apptik/json/schema/fetch/SchemaUriFetcher.java | SchemaUriFetcher.fetch | @Override
public Schema fetch(URI targetUri, URI srcOrigUri, URI srcId) {
Schema res = null;
URI schemaUri = convertUri(resolveUri(targetUri, srcOrigUri, srcId));
if(!schemaUri.isAbsolute()) throw new RuntimeException("Json Schema Fetcher works only with absolute URIs");
try {
String fragment = schemaUri.getFragment();
JsonObject schemaJson = JsonElement.readFrom(new InputStreamReader(schemaUri.toURL().openStream())).asJsonObject();
if(fragment!=null && !fragment.trim().isEmpty()) {
String[] pointers = fragment.split("/");
for (String pointer : pointers) {
if (pointer != null && !pointer.trim().isEmpty()) {
schemaJson = schemaJson.getJsonObject(pointer);
}
}
}
String version = schemaJson.optString("$schema","");
if(version.equals(Schema.VER_4)) {
res = new SchemaV4().setSchemaFetcher(this).setOrigSrc(schemaUri).wrap(schemaJson);
} else {
res = new SchemaV4().setSchemaFetcher(this).setOrigSrc(schemaUri).wrap(schemaJson);
}
} catch (IOException e) {
e.printStackTrace();
} catch (JsonException e) {
e.printStackTrace();
}
return res;
} | java | @Override
public Schema fetch(URI targetUri, URI srcOrigUri, URI srcId) {
Schema res = null;
URI schemaUri = convertUri(resolveUri(targetUri, srcOrigUri, srcId));
if(!schemaUri.isAbsolute()) throw new RuntimeException("Json Schema Fetcher works only with absolute URIs");
try {
String fragment = schemaUri.getFragment();
JsonObject schemaJson = JsonElement.readFrom(new InputStreamReader(schemaUri.toURL().openStream())).asJsonObject();
if(fragment!=null && !fragment.trim().isEmpty()) {
String[] pointers = fragment.split("/");
for (String pointer : pointers) {
if (pointer != null && !pointer.trim().isEmpty()) {
schemaJson = schemaJson.getJsonObject(pointer);
}
}
}
String version = schemaJson.optString("$schema","");
if(version.equals(Schema.VER_4)) {
res = new SchemaV4().setSchemaFetcher(this).setOrigSrc(schemaUri).wrap(schemaJson);
} else {
res = new SchemaV4().setSchemaFetcher(this).setOrigSrc(schemaUri).wrap(schemaJson);
}
} catch (IOException e) {
e.printStackTrace();
} catch (JsonException e) {
e.printStackTrace();
}
return res;
} | [
"@",
"Override",
"public",
"Schema",
"fetch",
"(",
"URI",
"targetUri",
",",
"URI",
"srcOrigUri",
",",
"URI",
"srcId",
")",
"{",
"Schema",
"res",
"=",
"null",
";",
"URI",
"schemaUri",
"=",
"convertUri",
"(",
"resolveUri",
"(",
"targetUri",
",",
"srcOrigUri"... | accepts only absolute URI or converted absolute URI | [
"accepts",
"only",
"absolute",
"URI",
"or",
"converted",
"absolute",
"URI"
] | c90f0dd7f84df26da4749be8cd9b026fff499a79 | https://github.com/apptik/JustJson/blob/c90f0dd7f84df26da4749be8cd9b026fff499a79/json-schema/src/main/java/io/apptik/json/schema/fetch/SchemaUriFetcher.java#L88-L120 |
37,055 | apptik/JustJson | json-wrapper/src/main/java/io/apptik/json/wrapper/JsonElementWrapper.java | JsonElementWrapper.tryFetchMetaInfo | private MetaInfo tryFetchMetaInfo(URI jsonSchemaUri) {
if (jsonSchemaUri == null) return null;
try {
metaInfo = doFetchMetaInfo(jsonSchemaUri);
Validator validator = metaInfo.getDefaultValidator();
if (validator != null) {
getValidators().add(validator);
}
} catch (Exception ex) {
return null;
}
return metaInfo;
} | java | private MetaInfo tryFetchMetaInfo(URI jsonSchemaUri) {
if (jsonSchemaUri == null) return null;
try {
metaInfo = doFetchMetaInfo(jsonSchemaUri);
Validator validator = metaInfo.getDefaultValidator();
if (validator != null) {
getValidators().add(validator);
}
} catch (Exception ex) {
return null;
}
return metaInfo;
} | [
"private",
"MetaInfo",
"tryFetchMetaInfo",
"(",
"URI",
"jsonSchemaUri",
")",
"{",
"if",
"(",
"jsonSchemaUri",
"==",
"null",
")",
"return",
"null",
";",
"try",
"{",
"metaInfo",
"=",
"doFetchMetaInfo",
"(",
"jsonSchemaUri",
")",
";",
"Validator",
"validator",
"=... | Tries to fetch a schema and add the default Schema validator for it
@param jsonSchemaUri
@return | [
"Tries",
"to",
"fetch",
"a",
"schema",
"and",
"add",
"the",
"default",
"Schema",
"validator",
"for",
"it"
] | c90f0dd7f84df26da4749be8cd9b026fff499a79 | https://github.com/apptik/JustJson/blob/c90f0dd7f84df26da4749be8cd9b026fff499a79/json-wrapper/src/main/java/io/apptik/json/wrapper/JsonElementWrapper.java#L109-L122 |
37,056 | apptik/JustJson | json-core/src/main/java/io/apptik/json/util/Util.java | Util.numberToString | public static String numberToString(Number number) throws JsonException {
if (number == null) {
throw new JsonException("Number must be non-null");
}
double doubleValue = number.doubleValue();
// the original returns "-0" instead of "-0.0" for negative zero
if (number.equals(NEGATIVE_ZERO)) {
return "-0";
}
long longValue = number.longValue();
if (doubleValue == (double) longValue) {
return Long.toString(longValue);
}
return number.toString();
} | java | public static String numberToString(Number number) throws JsonException {
if (number == null) {
throw new JsonException("Number must be non-null");
}
double doubleValue = number.doubleValue();
// the original returns "-0" instead of "-0.0" for negative zero
if (number.equals(NEGATIVE_ZERO)) {
return "-0";
}
long longValue = number.longValue();
if (doubleValue == (double) longValue) {
return Long.toString(longValue);
}
return number.toString();
} | [
"public",
"static",
"String",
"numberToString",
"(",
"Number",
"number",
")",
"throws",
"JsonException",
"{",
"if",
"(",
"number",
"==",
"null",
")",
"{",
"throw",
"new",
"JsonException",
"(",
"\"Number must be non-null\"",
")",
";",
"}",
"double",
"doubleValue"... | Encodes the number as a Json string.
@param number a finite value. May not be {@link Double#isNaN() NaNs} or
{@link Double#isInfinite() infinities}. | [
"Encodes",
"the",
"number",
"as",
"a",
"Json",
"string",
"."
] | c90f0dd7f84df26da4749be8cd9b026fff499a79 | https://github.com/apptik/JustJson/blob/c90f0dd7f84df26da4749be8cd9b026fff499a79/json-core/src/main/java/io/apptik/json/util/Util.java#L137-L155 |
37,057 | apptik/JustJson | json-core/src/main/java/io/apptik/json/JsonObject.java | JsonObject.merge | public JsonObject merge(JsonObject another) {
for (Map.Entry<String, JsonElement> anotherEntry : another) {
JsonElement curr = this.opt(anotherEntry.getKey());
if (curr == null) {
try {
this.put(anotherEntry.getKey(), anotherEntry.getValue());
} catch (JsonException e) {
e.printStackTrace();
}
} else if (curr.isJsonObject() && anotherEntry.getValue().isJsonObject()) {
curr.asJsonObject().merge(anotherEntry.getValue().asJsonObject());
}
}
return this;
} | java | public JsonObject merge(JsonObject another) {
for (Map.Entry<String, JsonElement> anotherEntry : another) {
JsonElement curr = this.opt(anotherEntry.getKey());
if (curr == null) {
try {
this.put(anotherEntry.getKey(), anotherEntry.getValue());
} catch (JsonException e) {
e.printStackTrace();
}
} else if (curr.isJsonObject() && anotherEntry.getValue().isJsonObject()) {
curr.asJsonObject().merge(anotherEntry.getValue().asJsonObject());
}
}
return this;
} | [
"public",
"JsonObject",
"merge",
"(",
"JsonObject",
"another",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"JsonElement",
">",
"anotherEntry",
":",
"another",
")",
"{",
"JsonElement",
"curr",
"=",
"this",
".",
"opt",
"(",
"anotherEntry",... | Merge Json Object with another Json Object.
It does not change element of another with the same name exists.
However if the element is Json Object then it will go down and merge that object.
@param another
@return | [
"Merge",
"Json",
"Object",
"with",
"another",
"Json",
"Object",
".",
"It",
"does",
"not",
"change",
"element",
"of",
"another",
"with",
"the",
"same",
"name",
"exists",
".",
"However",
"if",
"the",
"element",
"is",
"Json",
"Object",
"then",
"it",
"will",
... | c90f0dd7f84df26da4749be8cd9b026fff499a79 | https://github.com/apptik/JustJson/blob/c90f0dd7f84df26da4749be8cd9b026fff499a79/json-core/src/main/java/io/apptik/json/JsonObject.java#L783-L797 |
37,058 | marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/MarkLogicClient.java | MarkLogicClient.sync | public void sync() throws MarkLogicSesameException {
if(WRITE_CACHE_ENABLED && timerWriteCache != null)
timerWriteCache.forceRun();
if(DELETE_CACHE_ENABLED && timerDeleteCache != null)
timerDeleteCache.forceRun();
} | java | public void sync() throws MarkLogicSesameException {
if(WRITE_CACHE_ENABLED && timerWriteCache != null)
timerWriteCache.forceRun();
if(DELETE_CACHE_ENABLED && timerDeleteCache != null)
timerDeleteCache.forceRun();
} | [
"public",
"void",
"sync",
"(",
")",
"throws",
"MarkLogicSesameException",
"{",
"if",
"(",
"WRITE_CACHE_ENABLED",
"&&",
"timerWriteCache",
"!=",
"null",
")",
"timerWriteCache",
".",
"forceRun",
"(",
")",
";",
"if",
"(",
"DELETE_CACHE_ENABLED",
"&&",
"timerDeleteCac... | forces write cache to flush triples
@throws MarkLogicSesameException | [
"forces",
"write",
"cache",
"to",
"flush",
"triples"
] | d5b668ed2b3d5e90c9f1d5096012813c272062a2 | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/MarkLogicClient.java#L171-L176 |
37,059 | marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/MarkLogicClient.java | MarkLogicClient.sendAdd | public void sendAdd(File file, String baseURI, RDFFormat dataFormat, Resource... contexts) throws RDFParseException {
getClient().performAdd(file, baseURI, dataFormat, this.tx, contexts);
} | java | public void sendAdd(File file, String baseURI, RDFFormat dataFormat, Resource... contexts) throws RDFParseException {
getClient().performAdd(file, baseURI, dataFormat, this.tx, contexts);
} | [
"public",
"void",
"sendAdd",
"(",
"File",
"file",
",",
"String",
"baseURI",
",",
"RDFFormat",
"dataFormat",
",",
"Resource",
"...",
"contexts",
")",
"throws",
"RDFParseException",
"{",
"getClient",
"(",
")",
".",
"performAdd",
"(",
"file",
",",
"baseURI",
",... | add triples from file
@param file
@param baseURI
@param dataFormat
@param contexts
@throws RDFParseException | [
"add",
"triples",
"from",
"file"
] | d5b668ed2b3d5e90c9f1d5096012813c272062a2 | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/MarkLogicClient.java#L302-L304 |
37,060 | marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/MarkLogicClient.java | MarkLogicClient.sendAdd | public void sendAdd(InputStream in, String baseURI, RDFFormat dataFormat, Resource... contexts) throws RDFParseException, MarkLogicSesameException {
getClient().performAdd(in, baseURI, dataFormat, this.tx, contexts);
} | java | public void sendAdd(InputStream in, String baseURI, RDFFormat dataFormat, Resource... contexts) throws RDFParseException, MarkLogicSesameException {
getClient().performAdd(in, baseURI, dataFormat, this.tx, contexts);
} | [
"public",
"void",
"sendAdd",
"(",
"InputStream",
"in",
",",
"String",
"baseURI",
",",
"RDFFormat",
"dataFormat",
",",
"Resource",
"...",
"contexts",
")",
"throws",
"RDFParseException",
",",
"MarkLogicSesameException",
"{",
"getClient",
"(",
")",
".",
"performAdd",... | add triples from InputStream
@param in
@param baseURI
@param dataFormat
@param contexts | [
"add",
"triples",
"from",
"InputStream"
] | d5b668ed2b3d5e90c9f1d5096012813c272062a2 | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/MarkLogicClient.java#L314-L316 |
37,061 | marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/MarkLogicClient.java | MarkLogicClient.sendAdd | public void sendAdd(String baseURI, Resource subject, URI predicate, Value object, Resource... contexts) throws MarkLogicSesameException {
if (WRITE_CACHE_ENABLED) {
timerWriteCache.add(subject, predicate, object, contexts);
} else {
getClient().performAdd(baseURI, (Resource) skolemize(subject), (URI) skolemize(predicate), skolemize(object), this.tx, contexts);
}
} | java | public void sendAdd(String baseURI, Resource subject, URI predicate, Value object, Resource... contexts) throws MarkLogicSesameException {
if (WRITE_CACHE_ENABLED) {
timerWriteCache.add(subject, predicate, object, contexts);
} else {
getClient().performAdd(baseURI, (Resource) skolemize(subject), (URI) skolemize(predicate), skolemize(object), this.tx, contexts);
}
} | [
"public",
"void",
"sendAdd",
"(",
"String",
"baseURI",
",",
"Resource",
"subject",
",",
"URI",
"predicate",
",",
"Value",
"object",
",",
"Resource",
"...",
"contexts",
")",
"throws",
"MarkLogicSesameException",
"{",
"if",
"(",
"WRITE_CACHE_ENABLED",
")",
"{",
... | add single triple, if cache is enabled will add triple to cache model
@param baseURI
@param subject
@param predicate
@param object
@param contexts | [
"add",
"single",
"triple",
"if",
"cache",
"is",
"enabled",
"will",
"add",
"triple",
"to",
"cache",
"model"
] | d5b668ed2b3d5e90c9f1d5096012813c272062a2 | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/MarkLogicClient.java#L340-L346 |
37,062 | marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/MarkLogicClient.java | MarkLogicClient.sendRemove | public void sendRemove(String baseURI, Resource subject,URI predicate, Value object, Resource... contexts) throws MarkLogicSesameException {
if (DELETE_CACHE_ENABLED) {
timerDeleteCache.add(subject, predicate, object, contexts);
} else {
if (WRITE_CACHE_ENABLED)
sync();
getClient().performRemove(baseURI, (Resource) skolemize(subject), (URI) skolemize(predicate), skolemize(object), this.tx, contexts);
}
} | java | public void sendRemove(String baseURI, Resource subject,URI predicate, Value object, Resource... contexts) throws MarkLogicSesameException {
if (DELETE_CACHE_ENABLED) {
timerDeleteCache.add(subject, predicate, object, contexts);
} else {
if (WRITE_CACHE_ENABLED)
sync();
getClient().performRemove(baseURI, (Resource) skolemize(subject), (URI) skolemize(predicate), skolemize(object), this.tx, contexts);
}
} | [
"public",
"void",
"sendRemove",
"(",
"String",
"baseURI",
",",
"Resource",
"subject",
",",
"URI",
"predicate",
",",
"Value",
"object",
",",
"Resource",
"...",
"contexts",
")",
"throws",
"MarkLogicSesameException",
"{",
"if",
"(",
"DELETE_CACHE_ENABLED",
")",
"{"... | remove single triple
@param baseURI
@param subject
@param predicate
@param object
@param contexts | [
"remove",
"single",
"triple"
] | d5b668ed2b3d5e90c9f1d5096012813c272062a2 | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/MarkLogicClient.java#L357-L365 |
37,063 | marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/MarkLogicClient.java | MarkLogicClient.commitTransaction | public void commitTransaction() throws MarkLogicTransactionException {
if (isActiveTransaction()) {
try {
sync();
this.tx.commit();
this.tx=null;
} catch (MarkLogicSesameException e) {
logger.error(e.getLocalizedMessage());
throw new MarkLogicTransactionException(e);
}
}else{
throw new MarkLogicTransactionException("No active transaction to commit.");
}
} | java | public void commitTransaction() throws MarkLogicTransactionException {
if (isActiveTransaction()) {
try {
sync();
this.tx.commit();
this.tx=null;
} catch (MarkLogicSesameException e) {
logger.error(e.getLocalizedMessage());
throw new MarkLogicTransactionException(e);
}
}else{
throw new MarkLogicTransactionException("No active transaction to commit.");
}
} | [
"public",
"void",
"commitTransaction",
"(",
")",
"throws",
"MarkLogicTransactionException",
"{",
"if",
"(",
"isActiveTransaction",
"(",
")",
")",
"{",
"try",
"{",
"sync",
"(",
")",
";",
"this",
".",
"tx",
".",
"commit",
"(",
")",
";",
"this",
".",
"tx",
... | commits a transaction
@throws MarkLogicTransactionException | [
"commits",
"a",
"transaction"
] | d5b668ed2b3d5e90c9f1d5096012813c272062a2 | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/MarkLogicClient.java#L402-L415 |
37,064 | marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/MarkLogicClient.java | MarkLogicClient.setGraphPerms | public void setGraphPerms(GraphPermissions graphPerms){
if (graphPerms != null) {
getClient().setGraphPerms(graphPerms);
}else {
getClient().setGraphPerms(getClient().getDatabaseClient().newGraphManager().newGraphPermissions());
}
} | java | public void setGraphPerms(GraphPermissions graphPerms){
if (graphPerms != null) {
getClient().setGraphPerms(graphPerms);
}else {
getClient().setGraphPerms(getClient().getDatabaseClient().newGraphManager().newGraphPermissions());
}
} | [
"public",
"void",
"setGraphPerms",
"(",
"GraphPermissions",
"graphPerms",
")",
"{",
"if",
"(",
"graphPerms",
"!=",
"null",
")",
"{",
"getClient",
"(",
")",
".",
"setGraphPerms",
"(",
"graphPerms",
")",
";",
"}",
"else",
"{",
"getClient",
"(",
")",
".",
"... | setter for GraphPermissions
@param graphPerms | [
"setter",
"for",
"GraphPermissions"
] | d5b668ed2b3d5e90c9f1d5096012813c272062a2 | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/MarkLogicClient.java#L517-L524 |
37,065 | marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepository.java | MarkLogicRepository.getMarkLogicClient | @Override
public synchronized MarkLogicClient getMarkLogicClient() {
if(null != databaseClient){
this.client = new MarkLogicClient(databaseClient);
}else{
this.client = new MarkLogicClient(host, port, user, password, auth);
}
return this.client;
} | java | @Override
public synchronized MarkLogicClient getMarkLogicClient() {
if(null != databaseClient){
this.client = new MarkLogicClient(databaseClient);
}else{
this.client = new MarkLogicClient(host, port, user, password, auth);
}
return this.client;
} | [
"@",
"Override",
"public",
"synchronized",
"MarkLogicClient",
"getMarkLogicClient",
"(",
")",
"{",
"if",
"(",
"null",
"!=",
"databaseClient",
")",
"{",
"this",
".",
"client",
"=",
"new",
"MarkLogicClient",
"(",
"databaseClient",
")",
";",
"}",
"else",
"{",
"... | returns MarkLogicClient object which manages communication to ML server via Java api client
@return MarkLogicClient | [
"returns",
"MarkLogicClient",
"object",
"which",
"manages",
"communication",
"to",
"ML",
"server",
"via",
"Java",
"api",
"client"
] | d5b668ed2b3d5e90c9f1d5096012813c272062a2 | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepository.java#L231-L239 |
37,066 | marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/MarkLogicClientImpl.java | MarkLogicClientImpl.setDatabaseClient | private void setDatabaseClient(DatabaseClient databaseClient) {
this.databaseClient = databaseClient;
this.sparqlManager = getDatabaseClient().newSPARQLQueryManager();
this.graphManager = getDatabaseClient().newGraphManager();
} | java | private void setDatabaseClient(DatabaseClient databaseClient) {
this.databaseClient = databaseClient;
this.sparqlManager = getDatabaseClient().newSPARQLQueryManager();
this.graphManager = getDatabaseClient().newGraphManager();
} | [
"private",
"void",
"setDatabaseClient",
"(",
"DatabaseClient",
"databaseClient",
")",
"{",
"this",
".",
"databaseClient",
"=",
"databaseClient",
";",
"this",
".",
"sparqlManager",
"=",
"getDatabaseClient",
"(",
")",
".",
"newSPARQLQueryManager",
"(",
")",
";",
"th... | set databaseclient and instantate related managers
@param databaseClient | [
"set",
"databaseclient",
"and",
"instantate",
"related",
"managers"
] | d5b668ed2b3d5e90c9f1d5096012813c272062a2 | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/MarkLogicClientImpl.java#L107-L111 |
37,067 | marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/MarkLogicClientImpl.java | MarkLogicClientImpl.performAdd | public void performAdd(File file, String baseURI, RDFFormat dataFormat, Transaction tx, Resource... contexts) throws RDFParseException {
try {
graphManager.setDefaultMimetype(dataFormat.getDefaultMIMEType());
if (dataFormat.equals(RDFFormat.NQUADS) || dataFormat.equals(RDFFormat.TRIG)) {
graphManager.mergeGraphs(new FileHandle(file),tx);
} else {
if (notNull(contexts) && contexts.length>0) {
for (int i = 0; i < contexts.length; i++) {
if(notNull(contexts[i])){
graphManager.mergeAs(contexts[i].toString(), new FileHandle(file), getGraphPerms(),tx);
}else{
graphManager.mergeAs(DEFAULT_GRAPH_URI, new FileHandle(file),getGraphPerms(), tx);
}
}
} else {
graphManager.mergeAs(DEFAULT_GRAPH_URI, new FileHandle(file), getGraphPerms(),tx);
}
}
} catch (FailedRequestException e) {
logger.error(e.getLocalizedMessage());
throw new RDFParseException("Request to MarkLogic server failed, check file and format.");
}
} | java | public void performAdd(File file, String baseURI, RDFFormat dataFormat, Transaction tx, Resource... contexts) throws RDFParseException {
try {
graphManager.setDefaultMimetype(dataFormat.getDefaultMIMEType());
if (dataFormat.equals(RDFFormat.NQUADS) || dataFormat.equals(RDFFormat.TRIG)) {
graphManager.mergeGraphs(new FileHandle(file),tx);
} else {
if (notNull(contexts) && contexts.length>0) {
for (int i = 0; i < contexts.length; i++) {
if(notNull(contexts[i])){
graphManager.mergeAs(contexts[i].toString(), new FileHandle(file), getGraphPerms(),tx);
}else{
graphManager.mergeAs(DEFAULT_GRAPH_URI, new FileHandle(file),getGraphPerms(), tx);
}
}
} else {
graphManager.mergeAs(DEFAULT_GRAPH_URI, new FileHandle(file), getGraphPerms(),tx);
}
}
} catch (FailedRequestException e) {
logger.error(e.getLocalizedMessage());
throw new RDFParseException("Request to MarkLogic server failed, check file and format.");
}
} | [
"public",
"void",
"performAdd",
"(",
"File",
"file",
",",
"String",
"baseURI",
",",
"RDFFormat",
"dataFormat",
",",
"Transaction",
"tx",
",",
"Resource",
"...",
"contexts",
")",
"throws",
"RDFParseException",
"{",
"try",
"{",
"graphManager",
".",
"setDefaultMime... | as we use mergeGraphs, baseURI is always file.toURI | [
"as",
"we",
"use",
"mergeGraphs",
"baseURI",
"is",
"always",
"file",
".",
"toURI"
] | d5b668ed2b3d5e90c9f1d5096012813c272062a2 | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/MarkLogicClientImpl.java#L275-L297 |
37,068 | marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/MarkLogicClientImpl.java | MarkLogicClientImpl.performAdd | public void performAdd(InputStream in, String baseURI, RDFFormat dataFormat, Transaction tx, Resource... contexts) throws RDFParseException, MarkLogicSesameException {
try {
graphManager.setDefaultMimetype(dataFormat.getDefaultMIMEType());
if (dataFormat.equals(RDFFormat.NQUADS) || dataFormat.equals(RDFFormat.TRIG)) {
graphManager.mergeGraphs(new InputStreamHandle(in),tx);
} else {
if (notNull(contexts) && contexts.length > 0) {
for (int i = 0; i < contexts.length; i++) {
if (notNull(contexts[i])) {
graphManager.mergeAs(contexts[i].toString(), new InputStreamHandle(in), getGraphPerms(), tx);
} else {
graphManager.mergeAs(DEFAULT_GRAPH_URI, new InputStreamHandle(in),getGraphPerms(), tx);
}
}
} else {
graphManager.mergeAs(DEFAULT_GRAPH_URI, new InputStreamHandle(in),getGraphPerms(), tx);
}
}
in.close();
} catch (FailedRequestException e) {
logger.error(e.getLocalizedMessage());
throw new RDFParseException("Request to MarkLogic server failed, check input is valid.");
} catch (IOException e) {
logger.error(e.getLocalizedMessage());
throw new MarkLogicSesameException("IO error");
}
} | java | public void performAdd(InputStream in, String baseURI, RDFFormat dataFormat, Transaction tx, Resource... contexts) throws RDFParseException, MarkLogicSesameException {
try {
graphManager.setDefaultMimetype(dataFormat.getDefaultMIMEType());
if (dataFormat.equals(RDFFormat.NQUADS) || dataFormat.equals(RDFFormat.TRIG)) {
graphManager.mergeGraphs(new InputStreamHandle(in),tx);
} else {
if (notNull(contexts) && contexts.length > 0) {
for (int i = 0; i < contexts.length; i++) {
if (notNull(contexts[i])) {
graphManager.mergeAs(contexts[i].toString(), new InputStreamHandle(in), getGraphPerms(), tx);
} else {
graphManager.mergeAs(DEFAULT_GRAPH_URI, new InputStreamHandle(in),getGraphPerms(), tx);
}
}
} else {
graphManager.mergeAs(DEFAULT_GRAPH_URI, new InputStreamHandle(in),getGraphPerms(), tx);
}
}
in.close();
} catch (FailedRequestException e) {
logger.error(e.getLocalizedMessage());
throw new RDFParseException("Request to MarkLogic server failed, check input is valid.");
} catch (IOException e) {
logger.error(e.getLocalizedMessage());
throw new MarkLogicSesameException("IO error");
}
} | [
"public",
"void",
"performAdd",
"(",
"InputStream",
"in",
",",
"String",
"baseURI",
",",
"RDFFormat",
"dataFormat",
",",
"Transaction",
"tx",
",",
"Resource",
"...",
"contexts",
")",
"throws",
"RDFParseException",
",",
"MarkLogicSesameException",
"{",
"try",
"{",
... | executes merge of triples from InputStream
@param in
@param baseURI
@param dataFormat
@param tx
@param contexts
@throws RDFParseException | [
"executes",
"merge",
"of",
"triples",
"from",
"InputStream"
] | d5b668ed2b3d5e90c9f1d5096012813c272062a2 | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/MarkLogicClientImpl.java#L309-L335 |
37,069 | marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/MarkLogicClientImpl.java | MarkLogicClientImpl.performAdd | public void performAdd(String baseURI, Resource subject, URI predicate, Value object, Transaction tx, Resource... contexts) throws MarkLogicSesameException {
StringBuilder sb = new StringBuilder();
if(notNull(contexts) && contexts.length>0) {
if (notNull(baseURI)) sb.append("BASE <" + baseURI + ">\n");
sb.append("INSERT DATA { ");
for (int i = 0; i < contexts.length; i++) {
if (notNull(contexts[i])) {
sb.append("GRAPH <" + contexts[i].stringValue() + "> { ?s ?p ?o .} ");
} else {
sb.append("GRAPH <" + DEFAULT_GRAPH_URI + "> { ?s ?p ?o .} ");
}
}
sb.append("}");
} else {
sb.append("INSERT DATA { GRAPH <" + DEFAULT_GRAPH_URI + "> {?s ?p ?o .}}");
}
SPARQLQueryDefinition qdef = sparqlManager.newQueryDefinition(sb.toString());
if (notNull(ruleset) ) {qdef.setRulesets(ruleset);}
if(notNull(graphPerms)){ qdef.setUpdatePermissions(graphPerms);}
if(notNull(baseURI) && !baseURI.isEmpty()){ qdef.setBaseUri(baseURI);}
if(notNull(subject)) qdef.withBinding("s", subject.stringValue());
if(notNull(predicate)) qdef.withBinding("p", predicate.stringValue());
if(notNull(object)) bindObject(qdef, "o", object);
sparqlManager.executeUpdate(qdef, tx);
} | java | public void performAdd(String baseURI, Resource subject, URI predicate, Value object, Transaction tx, Resource... contexts) throws MarkLogicSesameException {
StringBuilder sb = new StringBuilder();
if(notNull(contexts) && contexts.length>0) {
if (notNull(baseURI)) sb.append("BASE <" + baseURI + ">\n");
sb.append("INSERT DATA { ");
for (int i = 0; i < contexts.length; i++) {
if (notNull(contexts[i])) {
sb.append("GRAPH <" + contexts[i].stringValue() + "> { ?s ?p ?o .} ");
} else {
sb.append("GRAPH <" + DEFAULT_GRAPH_URI + "> { ?s ?p ?o .} ");
}
}
sb.append("}");
} else {
sb.append("INSERT DATA { GRAPH <" + DEFAULT_GRAPH_URI + "> {?s ?p ?o .}}");
}
SPARQLQueryDefinition qdef = sparqlManager.newQueryDefinition(sb.toString());
if (notNull(ruleset) ) {qdef.setRulesets(ruleset);}
if(notNull(graphPerms)){ qdef.setUpdatePermissions(graphPerms);}
if(notNull(baseURI) && !baseURI.isEmpty()){ qdef.setBaseUri(baseURI);}
if(notNull(subject)) qdef.withBinding("s", subject.stringValue());
if(notNull(predicate)) qdef.withBinding("p", predicate.stringValue());
if(notNull(object)) bindObject(qdef, "o", object);
sparqlManager.executeUpdate(qdef, tx);
} | [
"public",
"void",
"performAdd",
"(",
"String",
"baseURI",
",",
"Resource",
"subject",
",",
"URI",
"predicate",
",",
"Value",
"object",
",",
"Transaction",
"tx",
",",
"Resource",
"...",
"contexts",
")",
"throws",
"MarkLogicSesameException",
"{",
"StringBuilder",
... | executes INSERT of single triple
@param baseURI
@param subject
@param predicate
@param object
@param tx
@param contexts
@throws MarkLogicSesameException | [
"executes",
"INSERT",
"of",
"single",
"triple"
] | d5b668ed2b3d5e90c9f1d5096012813c272062a2 | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/MarkLogicClientImpl.java#L348-L373 |
37,070 | marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/MarkLogicClientImpl.java | MarkLogicClientImpl.performClear | public void performClear(Transaction tx, Resource... contexts) {
if(notNull(contexts)) {
for (int i = 0; i < contexts.length; i++) {
if (notNull(contexts[i])) {
graphManager.delete(contexts[i].stringValue(), tx);
} else {
graphManager.delete(DEFAULT_GRAPH_URI, tx);
}
}
}else{
graphManager.delete(DEFAULT_GRAPH_URI, tx);
}
} | java | public void performClear(Transaction tx, Resource... contexts) {
if(notNull(contexts)) {
for (int i = 0; i < contexts.length; i++) {
if (notNull(contexts[i])) {
graphManager.delete(contexts[i].stringValue(), tx);
} else {
graphManager.delete(DEFAULT_GRAPH_URI, tx);
}
}
}else{
graphManager.delete(DEFAULT_GRAPH_URI, tx);
}
} | [
"public",
"void",
"performClear",
"(",
"Transaction",
"tx",
",",
"Resource",
"...",
"contexts",
")",
"{",
"if",
"(",
"notNull",
"(",
"contexts",
")",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"contexts",
".",
"length",
";",
"i",
"+... | clears triples from named graph
@param tx
@param contexts | [
"clears",
"triples",
"from",
"named",
"graph"
] | d5b668ed2b3d5e90c9f1d5096012813c272062a2 | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/MarkLogicClientImpl.java#L417-L429 |
37,071 | marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/MarkLogicClientImpl.java | MarkLogicClientImpl.setRulesets | public void setRulesets(SPARQLRuleset ... rulesets) {
if(notNull(rulesets)) {
List<SPARQLRuleset> list = new ArrayList<>();
for(Object r : rulesets) {
if(r != null && rulesets.length > 0) {
list.add((SPARQLRuleset)r);
}
}
this.ruleset = list.toArray(new SPARQLRuleset[list.size()]);
}else{
this.ruleset = null;
}
} | java | public void setRulesets(SPARQLRuleset ... rulesets) {
if(notNull(rulesets)) {
List<SPARQLRuleset> list = new ArrayList<>();
for(Object r : rulesets) {
if(r != null && rulesets.length > 0) {
list.add((SPARQLRuleset)r);
}
}
this.ruleset = list.toArray(new SPARQLRuleset[list.size()]);
}else{
this.ruleset = null;
}
} | [
"public",
"void",
"setRulesets",
"(",
"SPARQLRuleset",
"...",
"rulesets",
")",
"{",
"if",
"(",
"notNull",
"(",
"rulesets",
")",
")",
"{",
"List",
"<",
"SPARQLRuleset",
">",
"list",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"Object",
"r"... | setter for rulesets, filters out nulls
@param rulesets | [
"setter",
"for",
"rulesets",
"filters",
"out",
"nulls"
] | d5b668ed2b3d5e90c9f1d5096012813c272062a2 | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/MarkLogicClientImpl.java#L454-L466 |
37,072 | marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/MarkLogicClientImpl.java | MarkLogicClientImpl.getSPARQLBindings | protected SPARQLBindings getSPARQLBindings(SPARQLQueryBindingSet bindings) {
SPARQLBindings sps = new SPARQLBindingsImpl();
for (Binding binding : bindings) {
sps.bind(binding.getName(), binding.getValue().stringValue());
}
return sps;
} | java | protected SPARQLBindings getSPARQLBindings(SPARQLQueryBindingSet bindings) {
SPARQLBindings sps = new SPARQLBindingsImpl();
for (Binding binding : bindings) {
sps.bind(binding.getName(), binding.getValue().stringValue());
}
return sps;
} | [
"protected",
"SPARQLBindings",
"getSPARQLBindings",
"(",
"SPARQLQueryBindingSet",
"bindings",
")",
"{",
"SPARQLBindings",
"sps",
"=",
"new",
"SPARQLBindingsImpl",
"(",
")",
";",
"for",
"(",
"Binding",
"binding",
":",
"bindings",
")",
"{",
"sps",
".",
"bind",
"("... | converts Sesame BindingSet to java api client SPARQLBindings
@param bindings
@return | [
"converts",
"Sesame",
"BindingSet",
"to",
"java",
"api",
"client",
"SPARQLBindings"
] | d5b668ed2b3d5e90c9f1d5096012813c272062a2 | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/MarkLogicClientImpl.java#L530-L536 |
37,073 | marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/TripleCache.java | TripleCache.run | @Override
public synchronized void run(){
Date now = new Date();
if ( !cache.isEmpty() &&
((cache.size() > cacheSize - 1) || (now.getTime() - lastCacheAccess.getTime() > cacheMillis))) {
try {
flush();
} catch (RepositoryException e) {
log.error(e.getLocalizedMessage());
throw new RuntimeException(e);
} catch (MalformedQueryException e) {
log.error(e.getLocalizedMessage());
throw new RuntimeException(e);
} catch (UpdateExecutionException e) {
log.error(e.getLocalizedMessage());
throw new RuntimeException(e);
} catch (IOException e) {
log.error(e.getLocalizedMessage());
throw new RuntimeException(e);
}
}
} | java | @Override
public synchronized void run(){
Date now = new Date();
if ( !cache.isEmpty() &&
((cache.size() > cacheSize - 1) || (now.getTime() - lastCacheAccess.getTime() > cacheMillis))) {
try {
flush();
} catch (RepositoryException e) {
log.error(e.getLocalizedMessage());
throw new RuntimeException(e);
} catch (MalformedQueryException e) {
log.error(e.getLocalizedMessage());
throw new RuntimeException(e);
} catch (UpdateExecutionException e) {
log.error(e.getLocalizedMessage());
throw new RuntimeException(e);
} catch (IOException e) {
log.error(e.getLocalizedMessage());
throw new RuntimeException(e);
}
}
} | [
"@",
"Override",
"public",
"synchronized",
"void",
"run",
"(",
")",
"{",
"Date",
"now",
"=",
"new",
"Date",
"(",
")",
";",
"if",
"(",
"!",
"cache",
".",
"isEmpty",
"(",
")",
"&&",
"(",
"(",
"cache",
".",
"size",
"(",
")",
">",
"cacheSize",
"-",
... | tests to see if we should flush cache | [
"tests",
"to",
"see",
"if",
"we",
"should",
"flush",
"cache"
] | d5b668ed2b3d5e90c9f1d5096012813c272062a2 | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/TripleCache.java#L130-L151 |
37,074 | marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/TripleCache.java | TripleCache.forceRun | public synchronized void forceRun() throws MarkLogicSesameException {
log.debug(String.valueOf(cache.size()));
if( !cache.isEmpty()) {
try {
flush();
} catch (RepositoryException e) {
throw new MarkLogicSesameException("Could not flush write cache, encountered repository issue.",e);
} catch (MalformedQueryException e) {
throw new MarkLogicSesameException("Could not flush write cache, query was malformed.",e);
} catch (UpdateExecutionException e) {
throw new MarkLogicSesameException("Could not flush write cache, query update failed.",e);
} catch (IOException e) {
throw new MarkLogicSesameException("Could not flush write cache, encountered IO issue.",e);
}
}
} | java | public synchronized void forceRun() throws MarkLogicSesameException {
log.debug(String.valueOf(cache.size()));
if( !cache.isEmpty()) {
try {
flush();
} catch (RepositoryException e) {
throw new MarkLogicSesameException("Could not flush write cache, encountered repository issue.",e);
} catch (MalformedQueryException e) {
throw new MarkLogicSesameException("Could not flush write cache, query was malformed.",e);
} catch (UpdateExecutionException e) {
throw new MarkLogicSesameException("Could not flush write cache, query update failed.",e);
} catch (IOException e) {
throw new MarkLogicSesameException("Could not flush write cache, encountered IO issue.",e);
}
}
} | [
"public",
"synchronized",
"void",
"forceRun",
"(",
")",
"throws",
"MarkLogicSesameException",
"{",
"log",
".",
"debug",
"(",
"String",
".",
"valueOf",
"(",
"cache",
".",
"size",
"(",
")",
")",
")",
";",
"if",
"(",
"!",
"cache",
".",
"isEmpty",
"(",
")"... | min
forces the cache to flush if there is anything in it
@throws MarkLogicSesameException | [
"min",
"forces",
"the",
"cache",
"to",
"flush",
"if",
"there",
"is",
"anything",
"in",
"it"
] | d5b668ed2b3d5e90c9f1d5096012813c272062a2 | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/TripleCache.java#L160-L175 |
37,075 | marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/TripleCache.java | TripleCache.add | public synchronized void add(Resource subject, URI predicate, Value object, Resource... contexts) throws MarkLogicSesameException {
cache.add(subject,predicate,object,contexts);
if( cache.size() > cacheSize - 1){
forceRun();
}
} | java | public synchronized void add(Resource subject, URI predicate, Value object, Resource... contexts) throws MarkLogicSesameException {
cache.add(subject,predicate,object,contexts);
if( cache.size() > cacheSize - 1){
forceRun();
}
} | [
"public",
"synchronized",
"void",
"add",
"(",
"Resource",
"subject",
",",
"URI",
"predicate",
",",
"Value",
"object",
",",
"Resource",
"...",
"contexts",
")",
"throws",
"MarkLogicSesameException",
"{",
"cache",
".",
"add",
"(",
"subject",
",",
"predicate",
","... | add triple to cache Model
@param subject
@param predicate
@param object
@param contexts | [
"add",
"triple",
"to",
"cache",
"Model"
] | d5b668ed2b3d5e90c9f1d5096012813c272062a2 | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/TripleCache.java#L185-L190 |
37,076 | marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java | MarkLogicRepositoryConnection.prepareQuery | @Override
public Query prepareQuery(String queryString, String baseURI) throws RepositoryException, MalformedQueryException {
return prepareQuery(QueryLanguage.SPARQL, queryString, baseURI);
} | java | @Override
public Query prepareQuery(String queryString, String baseURI) throws RepositoryException, MalformedQueryException {
return prepareQuery(QueryLanguage.SPARQL, queryString, baseURI);
} | [
"@",
"Override",
"public",
"Query",
"prepareQuery",
"(",
"String",
"queryString",
",",
"String",
"baseURI",
")",
"throws",
"RepositoryException",
",",
"MalformedQueryException",
"{",
"return",
"prepareQuery",
"(",
"QueryLanguage",
".",
"SPARQL",
",",
"queryString",
... | overload for prepareQuery
@param queryString
@param baseURI
@return MarkLogicQuery
@throws RepositoryException
@throws MalformedQueryException | [
"overload",
"for",
"prepareQuery"
] | d5b668ed2b3d5e90c9f1d5096012813c272062a2 | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java#L164-L167 |
37,077 | marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java | MarkLogicRepositoryConnection.prepareQuery | @Override
public MarkLogicQuery prepareQuery(QueryLanguage queryLanguage, String queryString, String baseURI)
throws RepositoryException, MalformedQueryException
{
// function routing based on query form
if (SPARQL.equals(queryLanguage)) {
String queryStringWithoutProlog = QueryParserUtil.removeSPARQLQueryProlog(queryString).toUpperCase();
if (queryStringWithoutProlog.startsWith("SELECT")) {
return prepareTupleQuery(queryLanguage, queryString, baseURI); //must be a TupleQuery
}
else if (queryStringWithoutProlog.startsWith("ASK")) {
return prepareBooleanQuery(queryLanguage, queryString, baseURI); //must be a BooleanQuery
}
else {
return prepareGraphQuery(queryLanguage, queryString, baseURI); //all the rest use GraphQuery
}
}
throw new UnsupportedQueryLanguageException("Unsupported query language " + queryLanguage.getName());
} | java | @Override
public MarkLogicQuery prepareQuery(QueryLanguage queryLanguage, String queryString, String baseURI)
throws RepositoryException, MalformedQueryException
{
// function routing based on query form
if (SPARQL.equals(queryLanguage)) {
String queryStringWithoutProlog = QueryParserUtil.removeSPARQLQueryProlog(queryString).toUpperCase();
if (queryStringWithoutProlog.startsWith("SELECT")) {
return prepareTupleQuery(queryLanguage, queryString, baseURI); //must be a TupleQuery
}
else if (queryStringWithoutProlog.startsWith("ASK")) {
return prepareBooleanQuery(queryLanguage, queryString, baseURI); //must be a BooleanQuery
}
else {
return prepareGraphQuery(queryLanguage, queryString, baseURI); //all the rest use GraphQuery
}
}
throw new UnsupportedQueryLanguageException("Unsupported query language " + queryLanguage.getName());
} | [
"@",
"Override",
"public",
"MarkLogicQuery",
"prepareQuery",
"(",
"QueryLanguage",
"queryLanguage",
",",
"String",
"queryString",
",",
"String",
"baseURI",
")",
"throws",
"RepositoryException",
",",
"MalformedQueryException",
"{",
"// function routing based on query form",
... | base method for prepareQuery
routes to all other query forms (prepareTupleQuery,prepareBooleanQuery,prepareGraphQuery)
@param queryLanguage
@param queryString
@param baseURI
@return MarkLogicQuery
@throws RepositoryException
@throws MalformedQueryException | [
"base",
"method",
"for",
"prepareQuery"
] | d5b668ed2b3d5e90c9f1d5096012813c272062a2 | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java#L195-L213 |
37,078 | marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java | MarkLogicRepositoryConnection.prepareGraphQuery | @Override
public MarkLogicGraphQuery prepareGraphQuery(String queryString,String baseURI) throws RepositoryException, MalformedQueryException {
return prepareGraphQuery(QueryLanguage.SPARQL, queryString, baseURI);
} | java | @Override
public MarkLogicGraphQuery prepareGraphQuery(String queryString,String baseURI) throws RepositoryException, MalformedQueryException {
return prepareGraphQuery(QueryLanguage.SPARQL, queryString, baseURI);
} | [
"@",
"Override",
"public",
"MarkLogicGraphQuery",
"prepareGraphQuery",
"(",
"String",
"queryString",
",",
"String",
"baseURI",
")",
"throws",
"RepositoryException",
",",
"MalformedQueryException",
"{",
"return",
"prepareGraphQuery",
"(",
"QueryLanguage",
".",
"SPARQL",
... | overload for prepareGraphQuery
@param queryString
@param baseURI
@return MarkLogicGraphQuery
@throws RepositoryException
@throws MalformedQueryException | [
"overload",
"for",
"prepareGraphQuery"
] | d5b668ed2b3d5e90c9f1d5096012813c272062a2 | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java#L296-L299 |
37,079 | marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java | MarkLogicRepositoryConnection.prepareBooleanQuery | @Override
public MarkLogicBooleanQuery prepareBooleanQuery(String queryString) throws RepositoryException, MalformedQueryException {
return prepareBooleanQuery(QueryLanguage.SPARQL, queryString, null);
} | java | @Override
public MarkLogicBooleanQuery prepareBooleanQuery(String queryString) throws RepositoryException, MalformedQueryException {
return prepareBooleanQuery(QueryLanguage.SPARQL, queryString, null);
} | [
"@",
"Override",
"public",
"MarkLogicBooleanQuery",
"prepareBooleanQuery",
"(",
"String",
"queryString",
")",
"throws",
"RepositoryException",
",",
"MalformedQueryException",
"{",
"return",
"prepareBooleanQuery",
"(",
"QueryLanguage",
".",
"SPARQL",
",",
"queryString",
",... | overload for prepareBooleanQuery
@param queryString
@return MarkLogicBooleanQuery
@throws RepositoryException
@throws MalformedQueryException | [
"overload",
"for",
"prepareBooleanQuery"
] | d5b668ed2b3d5e90c9f1d5096012813c272062a2 | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java#L343-L346 |
37,080 | marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java | MarkLogicRepositoryConnection.prepareUpdate | @Override
public MarkLogicUpdateQuery prepareUpdate(String queryString,String baseURI) throws RepositoryException, MalformedQueryException {
return prepareUpdate(QueryLanguage.SPARQL, queryString, baseURI);
} | java | @Override
public MarkLogicUpdateQuery prepareUpdate(String queryString,String baseURI) throws RepositoryException, MalformedQueryException {
return prepareUpdate(QueryLanguage.SPARQL, queryString, baseURI);
} | [
"@",
"Override",
"public",
"MarkLogicUpdateQuery",
"prepareUpdate",
"(",
"String",
"queryString",
",",
"String",
"baseURI",
")",
"throws",
"RepositoryException",
",",
"MalformedQueryException",
"{",
"return",
"prepareUpdate",
"(",
"QueryLanguage",
".",
"SPARQL",
",",
... | overload for prepareUpdate
@param queryString
@param baseURI
@return MarkLogicUpdateQuery
@throws RepositoryException
@throws MalformedQueryException | [
"overload",
"for",
"prepareUpdate"
] | d5b668ed2b3d5e90c9f1d5096012813c272062a2 | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java#L416-L419 |
37,081 | marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java | MarkLogicRepositoryConnection.prepareUpdate | @Override
public MarkLogicUpdateQuery prepareUpdate(QueryLanguage queryLanguage, String queryString, String baseURI) throws RepositoryException, MalformedQueryException {
if (QueryLanguage.SPARQL.equals(queryLanguage)) {
return new MarkLogicUpdateQuery(this.client, new SPARQLQueryBindingSet(), baseURI, queryString, defaultGraphPerms, defaultQueryDef, defaultRulesets);
}
throw new UnsupportedQueryLanguageException("Unsupported query language " + queryLanguage.getName());
} | java | @Override
public MarkLogicUpdateQuery prepareUpdate(QueryLanguage queryLanguage, String queryString, String baseURI) throws RepositoryException, MalformedQueryException {
if (QueryLanguage.SPARQL.equals(queryLanguage)) {
return new MarkLogicUpdateQuery(this.client, new SPARQLQueryBindingSet(), baseURI, queryString, defaultGraphPerms, defaultQueryDef, defaultRulesets);
}
throw new UnsupportedQueryLanguageException("Unsupported query language " + queryLanguage.getName());
} | [
"@",
"Override",
"public",
"MarkLogicUpdateQuery",
"prepareUpdate",
"(",
"QueryLanguage",
"queryLanguage",
",",
"String",
"queryString",
",",
"String",
"baseURI",
")",
"throws",
"RepositoryException",
",",
"MalformedQueryException",
"{",
"if",
"(",
"QueryLanguage",
".",... | base method for prepareUpdate
@param queryLanguage
@param queryString
@param baseURI
@return MarkLogicUpdateQuery
@throws RepositoryException
@throws MalformedQueryException | [
"base",
"method",
"for",
"prepareUpdate"
] | d5b668ed2b3d5e90c9f1d5096012813c272062a2 | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java#L445-L451 |
37,082 | marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java | MarkLogicRepositoryConnection.getContextIDs | @Override
public RepositoryResult<Resource> getContextIDs() throws RepositoryException {
try{
TupleQuery tupleQuery = prepareTupleQuery(QueryLanguage.SPARQL, ALL_GRAPH_URIS);
TupleQueryResult result = tupleQuery.evaluate();
return
new RepositoryResult<Resource>(
new ExceptionConvertingIteration<Resource, RepositoryException>(
new ConvertingIteration<BindingSet, Resource, QueryEvaluationException>(result) {
@Override
protected Resource convert(BindingSet bindings)
throws QueryEvaluationException {
return (Resource) bindings.getValue("g");
}
}) {
@Override
protected RepositoryException convert(Exception e) {
return new RepositoryException(e);
}
});
} catch (MalformedQueryException e) {
throw new RepositoryException(e);
} catch (QueryEvaluationException e) {
throw new RepositoryException(e);
}
} | java | @Override
public RepositoryResult<Resource> getContextIDs() throws RepositoryException {
try{
TupleQuery tupleQuery = prepareTupleQuery(QueryLanguage.SPARQL, ALL_GRAPH_URIS);
TupleQueryResult result = tupleQuery.evaluate();
return
new RepositoryResult<Resource>(
new ExceptionConvertingIteration<Resource, RepositoryException>(
new ConvertingIteration<BindingSet, Resource, QueryEvaluationException>(result) {
@Override
protected Resource convert(BindingSet bindings)
throws QueryEvaluationException {
return (Resource) bindings.getValue("g");
}
}) {
@Override
protected RepositoryException convert(Exception e) {
return new RepositoryException(e);
}
});
} catch (MalformedQueryException e) {
throw new RepositoryException(e);
} catch (QueryEvaluationException e) {
throw new RepositoryException(e);
}
} | [
"@",
"Override",
"public",
"RepositoryResult",
"<",
"Resource",
">",
"getContextIDs",
"(",
")",
"throws",
"RepositoryException",
"{",
"try",
"{",
"TupleQuery",
"tupleQuery",
"=",
"prepareTupleQuery",
"(",
"QueryLanguage",
".",
"SPARQL",
",",
"ALL_GRAPH_URIS",
")",
... | returns list of graph names as Resource
@throws RepositoryException | [
"returns",
"list",
"of",
"graph",
"names",
"as",
"Resource"
] | d5b668ed2b3d5e90c9f1d5096012813c272062a2 | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java#L458-L486 |
37,083 | marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java | MarkLogicRepositoryConnection.getStatements | public RepositoryResult<Statement> getStatements(Resource subj, URI pred, Value obj, boolean includeInferred) throws RepositoryException {
try {
if (isQuadMode()) {
TupleQuery tupleQuery = prepareTupleQuery(GET_STATEMENTS);
setBindings(tupleQuery, subj, pred, obj);
tupleQuery.setIncludeInferred(includeInferred);
TupleQueryResult qRes = tupleQuery.evaluate();
return new RepositoryResult<Statement>(
new ExceptionConvertingIteration<Statement, RepositoryException>(
toStatementIteration(qRes, subj, pred, obj)) {
@Override
protected RepositoryException convert(Exception e) {
return new RepositoryException(e);
}
});
} else if (subj != null && pred != null && obj != null) {
if (hasStatement(subj, pred, obj, includeInferred)) {
Statement st = new StatementImpl(subj, pred, obj);
CloseableIteration<Statement, RepositoryException> cursor;
cursor = new SingletonIteration<Statement, RepositoryException>(st);
return new RepositoryResult<Statement>(cursor);
} else {
return new RepositoryResult<Statement>(new EmptyIteration<Statement, RepositoryException>());
}
}
GraphQuery query = prepareGraphQuery(EVERYTHING);
setBindings(query, subj, pred, obj);
GraphQueryResult result = query.evaluate();
return new RepositoryResult<Statement>(
new ExceptionConvertingIteration<Statement, RepositoryException>(result) {
@Override
protected RepositoryException convert(Exception e) {
return new RepositoryException(e);
}
});
} catch (MalformedQueryException e) {
throw new RepositoryException(e);
} catch (QueryEvaluationException e) {
throw new RepositoryException(e);
}
} | java | public RepositoryResult<Statement> getStatements(Resource subj, URI pred, Value obj, boolean includeInferred) throws RepositoryException {
try {
if (isQuadMode()) {
TupleQuery tupleQuery = prepareTupleQuery(GET_STATEMENTS);
setBindings(tupleQuery, subj, pred, obj);
tupleQuery.setIncludeInferred(includeInferred);
TupleQueryResult qRes = tupleQuery.evaluate();
return new RepositoryResult<Statement>(
new ExceptionConvertingIteration<Statement, RepositoryException>(
toStatementIteration(qRes, subj, pred, obj)) {
@Override
protected RepositoryException convert(Exception e) {
return new RepositoryException(e);
}
});
} else if (subj != null && pred != null && obj != null) {
if (hasStatement(subj, pred, obj, includeInferred)) {
Statement st = new StatementImpl(subj, pred, obj);
CloseableIteration<Statement, RepositoryException> cursor;
cursor = new SingletonIteration<Statement, RepositoryException>(st);
return new RepositoryResult<Statement>(cursor);
} else {
return new RepositoryResult<Statement>(new EmptyIteration<Statement, RepositoryException>());
}
}
GraphQuery query = prepareGraphQuery(EVERYTHING);
setBindings(query, subj, pred, obj);
GraphQueryResult result = query.evaluate();
return new RepositoryResult<Statement>(
new ExceptionConvertingIteration<Statement, RepositoryException>(result) {
@Override
protected RepositoryException convert(Exception e) {
return new RepositoryException(e);
}
});
} catch (MalformedQueryException e) {
throw new RepositoryException(e);
} catch (QueryEvaluationException e) {
throw new RepositoryException(e);
}
} | [
"public",
"RepositoryResult",
"<",
"Statement",
">",
"getStatements",
"(",
"Resource",
"subj",
",",
"URI",
"pred",
",",
"Value",
"obj",
",",
"boolean",
"includeInferred",
")",
"throws",
"RepositoryException",
"{",
"try",
"{",
"if",
"(",
"isQuadMode",
"(",
")",... | returns all statements
@param subj
@param pred
@param obj
@param includeInferred
@throws RepositoryException | [
"returns",
"all",
"statements"
] | d5b668ed2b3d5e90c9f1d5096012813c272062a2 | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java#L497-L537 |
37,084 | marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java | MarkLogicRepositoryConnection.getStatements | @Override
public RepositoryResult<Statement> getStatements(Resource subj, URI pred, Value obj, boolean includeInferred, Resource... contexts) throws RepositoryException {
if (contexts == null) {
contexts = new Resource[] { null };
}
try {
if (isQuadMode()) {
StringBuilder sb = new StringBuilder();
sb.append("SELECT * WHERE { GRAPH ?ctx { ?s ?p ?o } filter (?ctx = (");
boolean first = true;
for (Resource context : contexts) {
if (first) {
first = !first;
}
else {
sb.append(",");
}
if (notNull(context)) {
sb.append("IRI(\"" + context.toString() + "\")");
} else {
sb.append("IRI(\""+DEFAULT_GRAPH_URI+"\")");
}
}
sb.append(") ) }");
TupleQuery tupleQuery = prepareTupleQuery(sb.toString());
tupleQuery.setIncludeInferred(includeInferred);
setBindings(tupleQuery, subj, pred, obj, (Resource) null);
TupleQueryResult qRes = tupleQuery.evaluate();
return new RepositoryResult<Statement>(
new ExceptionConvertingIteration<Statement, RepositoryException>(
toStatementIteration(qRes, subj, pred, obj)) {
@Override
protected RepositoryException convert(Exception e) {
return new RepositoryException(e);
}
});
} else if (subj != null && pred != null && obj != null) {
if (hasStatement(subj, pred, obj, includeInferred, contexts)) {
Statement st = new StatementImpl(subj, pred, obj);
CloseableIteration<Statement, RepositoryException> cursor;
cursor = new SingletonIteration<Statement, RepositoryException>(st);
return new RepositoryResult<Statement>(cursor);
} else {
return new RepositoryResult<Statement>(new EmptyIteration<Statement, RepositoryException>());
}
}
else {
MarkLogicGraphQuery query = prepareGraphQuery(EVERYTHING);
setBindings(query, subj, pred, obj, contexts);
GraphQueryResult result = query.evaluate();
return new RepositoryResult<Statement>(
new ExceptionConvertingIteration<Statement, RepositoryException>(result) {
@Override
protected RepositoryException convert(Exception e) {
return new RepositoryException(e);
}
});
}
} catch (MalformedQueryException e) {
throw new RepositoryException(e);
} catch (QueryEvaluationException e) {
throw new RepositoryException(e);
}
} | java | @Override
public RepositoryResult<Statement> getStatements(Resource subj, URI pred, Value obj, boolean includeInferred, Resource... contexts) throws RepositoryException {
if (contexts == null) {
contexts = new Resource[] { null };
}
try {
if (isQuadMode()) {
StringBuilder sb = new StringBuilder();
sb.append("SELECT * WHERE { GRAPH ?ctx { ?s ?p ?o } filter (?ctx = (");
boolean first = true;
for (Resource context : contexts) {
if (first) {
first = !first;
}
else {
sb.append(",");
}
if (notNull(context)) {
sb.append("IRI(\"" + context.toString() + "\")");
} else {
sb.append("IRI(\""+DEFAULT_GRAPH_URI+"\")");
}
}
sb.append(") ) }");
TupleQuery tupleQuery = prepareTupleQuery(sb.toString());
tupleQuery.setIncludeInferred(includeInferred);
setBindings(tupleQuery, subj, pred, obj, (Resource) null);
TupleQueryResult qRes = tupleQuery.evaluate();
return new RepositoryResult<Statement>(
new ExceptionConvertingIteration<Statement, RepositoryException>(
toStatementIteration(qRes, subj, pred, obj)) {
@Override
protected RepositoryException convert(Exception e) {
return new RepositoryException(e);
}
});
} else if (subj != null && pred != null && obj != null) {
if (hasStatement(subj, pred, obj, includeInferred, contexts)) {
Statement st = new StatementImpl(subj, pred, obj);
CloseableIteration<Statement, RepositoryException> cursor;
cursor = new SingletonIteration<Statement, RepositoryException>(st);
return new RepositoryResult<Statement>(cursor);
} else {
return new RepositoryResult<Statement>(new EmptyIteration<Statement, RepositoryException>());
}
}
else {
MarkLogicGraphQuery query = prepareGraphQuery(EVERYTHING);
setBindings(query, subj, pred, obj, contexts);
GraphQueryResult result = query.evaluate();
return new RepositoryResult<Statement>(
new ExceptionConvertingIteration<Statement, RepositoryException>(result) {
@Override
protected RepositoryException convert(Exception e) {
return new RepositoryException(e);
}
});
}
} catch (MalformedQueryException e) {
throw new RepositoryException(e);
} catch (QueryEvaluationException e) {
throw new RepositoryException(e);
}
} | [
"@",
"Override",
"public",
"RepositoryResult",
"<",
"Statement",
">",
"getStatements",
"(",
"Resource",
"subj",
",",
"URI",
"pred",
",",
"Value",
"obj",
",",
"boolean",
"includeInferred",
",",
"Resource",
"...",
"contexts",
")",
"throws",
"RepositoryException",
... | returns statements from supplied context
TBD - should share code path with above getStatements
@param subj
@param pred
@param obj
@param includeInferred
@param contexts
@throws RepositoryException | [
"returns",
"statements",
"from",
"supplied",
"context"
] | d5b668ed2b3d5e90c9f1d5096012813c272062a2 | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java#L551-L614 |
37,085 | marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java | MarkLogicRepositoryConnection.size | @Override
public long size() throws RepositoryException{
try {
MarkLogicTupleQuery tupleQuery = prepareTupleQuery(COUNT_EVERYTHING);
tupleQuery.setIncludeInferred(false);
tupleQuery.setRulesets((SPARQLRuleset)null);
tupleQuery.setConstrainingQueryDefinition((QueryDefinition)null);
TupleQueryResult qRes = tupleQuery.evaluate();
// just one answer
BindingSet result = qRes.next();
qRes.close();
return ((Literal) result.getBinding("ct").getValue()).longValue();
} catch (QueryEvaluationException | MalformedQueryException e) {
throw new RepositoryException(e);
}
} | java | @Override
public long size() throws RepositoryException{
try {
MarkLogicTupleQuery tupleQuery = prepareTupleQuery(COUNT_EVERYTHING);
tupleQuery.setIncludeInferred(false);
tupleQuery.setRulesets((SPARQLRuleset)null);
tupleQuery.setConstrainingQueryDefinition((QueryDefinition)null);
TupleQueryResult qRes = tupleQuery.evaluate();
// just one answer
BindingSet result = qRes.next();
qRes.close();
return ((Literal) result.getBinding("ct").getValue()).longValue();
} catch (QueryEvaluationException | MalformedQueryException e) {
throw new RepositoryException(e);
}
} | [
"@",
"Override",
"public",
"long",
"size",
"(",
")",
"throws",
"RepositoryException",
"{",
"try",
"{",
"MarkLogicTupleQuery",
"tupleQuery",
"=",
"prepareTupleQuery",
"(",
"COUNT_EVERYTHING",
")",
";",
"tupleQuery",
".",
"setIncludeInferred",
"(",
"false",
")",
";"... | returns number of triples in the entire triple store
@return long
@throws RepositoryException | [
"returns",
"number",
"of",
"triples",
"in",
"the",
"entire",
"triple",
"store"
] | d5b668ed2b3d5e90c9f1d5096012813c272062a2 | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java#L781-L796 |
37,086 | marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java | MarkLogicRepositoryConnection.size | @Override
public long size(Resource... contexts) throws RepositoryException {
if (contexts == null) {
contexts = new Resource[] { null };
}
try {
StringBuilder sb = new StringBuilder();
sb.append("SELECT (count(?s) as ?ct) where { GRAPH ?g { ?s ?p ?o }");
boolean first = true;
// with no args, measure the whole triple store.
if (contexts != null && contexts.length > 0) {
sb.append("filter (?g = (");
for (Resource context : contexts) {
if (first) {
first = !first;
}
else {
sb.append(",");
}
if (context == null) {
sb.append("IRI(\""+DEFAULT_GRAPH_URI+"\")");
} else {
sb.append("IRI(\"" + context.toString() + "\")");
}
}
sb.append(") )");
}else{
sb.append("filter (?g = (IRI(\""+DEFAULT_GRAPH_URI+"\")))");
}
sb.append("}");
logger.debug(sb.toString());
MarkLogicTupleQuery tupleQuery = prepareTupleQuery(sb.toString());
tupleQuery.setIncludeInferred(false);
tupleQuery.setRulesets((SPARQLRuleset) null);
tupleQuery.setConstrainingQueryDefinition((QueryDefinition)null);
TupleQueryResult qRes = tupleQuery.evaluate();
// just one answer
BindingSet result = qRes.next();
qRes.close();
// if 'null' was one or more of the arguments, then totalSize will be non-zero.
return ((Literal) result.getBinding("ct").getValue()).longValue();
} catch (QueryEvaluationException | MalformedQueryException e) {
throw new RepositoryException(e);
}
} | java | @Override
public long size(Resource... contexts) throws RepositoryException {
if (contexts == null) {
contexts = new Resource[] { null };
}
try {
StringBuilder sb = new StringBuilder();
sb.append("SELECT (count(?s) as ?ct) where { GRAPH ?g { ?s ?p ?o }");
boolean first = true;
// with no args, measure the whole triple store.
if (contexts != null && contexts.length > 0) {
sb.append("filter (?g = (");
for (Resource context : contexts) {
if (first) {
first = !first;
}
else {
sb.append(",");
}
if (context == null) {
sb.append("IRI(\""+DEFAULT_GRAPH_URI+"\")");
} else {
sb.append("IRI(\"" + context.toString() + "\")");
}
}
sb.append(") )");
}else{
sb.append("filter (?g = (IRI(\""+DEFAULT_GRAPH_URI+"\")))");
}
sb.append("}");
logger.debug(sb.toString());
MarkLogicTupleQuery tupleQuery = prepareTupleQuery(sb.toString());
tupleQuery.setIncludeInferred(false);
tupleQuery.setRulesets((SPARQLRuleset) null);
tupleQuery.setConstrainingQueryDefinition((QueryDefinition)null);
TupleQueryResult qRes = tupleQuery.evaluate();
// just one answer
BindingSet result = qRes.next();
qRes.close();
// if 'null' was one or more of the arguments, then totalSize will be non-zero.
return ((Literal) result.getBinding("ct").getValue()).longValue();
} catch (QueryEvaluationException | MalformedQueryException e) {
throw new RepositoryException(e);
}
} | [
"@",
"Override",
"public",
"long",
"size",
"(",
"Resource",
"...",
"contexts",
")",
"throws",
"RepositoryException",
"{",
"if",
"(",
"contexts",
"==",
"null",
")",
"{",
"contexts",
"=",
"new",
"Resource",
"[",
"]",
"{",
"null",
"}",
";",
"}",
"try",
"{... | returns number of triples in supplied context
@param contexts
@return long
@throws RepositoryException | [
"returns",
"number",
"of",
"triples",
"in",
"supplied",
"context"
] | d5b668ed2b3d5e90c9f1d5096012813c272062a2 | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java#L805-L849 |
37,087 | marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java | MarkLogicRepositoryConnection.add | @Override
public void add(InputStream in, String baseURI, RDFFormat dataFormat, Resource... contexts) throws IOException, RDFParseException, RepositoryException {
getClient().sendAdd(in, baseURI, dataFormat, contexts);
} | java | @Override
public void add(InputStream in, String baseURI, RDFFormat dataFormat, Resource... contexts) throws IOException, RDFParseException, RepositoryException {
getClient().sendAdd(in, baseURI, dataFormat, contexts);
} | [
"@",
"Override",
"public",
"void",
"add",
"(",
"InputStream",
"in",
",",
"String",
"baseURI",
",",
"RDFFormat",
"dataFormat",
",",
"Resource",
"...",
"contexts",
")",
"throws",
"IOException",
",",
"RDFParseException",
",",
"RepositoryException",
"{",
"getClient",
... | add triples via inputstream
@param in
@param baseURI
@param dataFormat
@param contexts
@throws IOException
@throws RDFParseException
@throws RepositoryException | [
"add",
"triples",
"via",
"inputstream"
] | d5b668ed2b3d5e90c9f1d5096012813c272062a2 | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java#L978-L981 |
37,088 | marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java | MarkLogicRepositoryConnection.add | @Override
public void add(File file, String baseURI, RDFFormat dataFormat, Resource... contexts) throws IOException, RDFParseException, RepositoryException {
if(notNull(baseURI)) {
getClient().sendAdd(file, baseURI, dataFormat, contexts);
}else{
getClient().sendAdd(file, file.toURI().toString(), dataFormat, contexts);
}
} | java | @Override
public void add(File file, String baseURI, RDFFormat dataFormat, Resource... contexts) throws IOException, RDFParseException, RepositoryException {
if(notNull(baseURI)) {
getClient().sendAdd(file, baseURI, dataFormat, contexts);
}else{
getClient().sendAdd(file, file.toURI().toString(), dataFormat, contexts);
}
} | [
"@",
"Override",
"public",
"void",
"add",
"(",
"File",
"file",
",",
"String",
"baseURI",
",",
"RDFFormat",
"dataFormat",
",",
"Resource",
"...",
"contexts",
")",
"throws",
"IOException",
",",
"RDFParseException",
",",
"RepositoryException",
"{",
"if",
"(",
"no... | add triples via File
will use file uri as base URI if none supplied
@param file
@param baseURI
@param dataFormat
@param contexts
@throws IOException
@throws RDFParseException
@throws RepositoryException | [
"add",
"triples",
"via",
"File"
] | d5b668ed2b3d5e90c9f1d5096012813c272062a2 | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java#L996-L1003 |
37,089 | marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java | MarkLogicRepositoryConnection.add | @Override
public void add(Reader reader, String baseURI, RDFFormat dataFormat, Resource... contexts) throws IOException, RDFParseException, RepositoryException {
getClient().sendAdd(reader, baseURI, dataFormat, contexts);
} | java | @Override
public void add(Reader reader, String baseURI, RDFFormat dataFormat, Resource... contexts) throws IOException, RDFParseException, RepositoryException {
getClient().sendAdd(reader, baseURI, dataFormat, contexts);
} | [
"@",
"Override",
"public",
"void",
"add",
"(",
"Reader",
"reader",
",",
"String",
"baseURI",
",",
"RDFFormat",
"dataFormat",
",",
"Resource",
"...",
"contexts",
")",
"throws",
"IOException",
",",
"RDFParseException",
",",
"RepositoryException",
"{",
"getClient",
... | add triples via Reader
@param reader
@param baseURI
@param dataFormat
@param contexts
@throws IOException
@throws RDFParseException
@throws RepositoryException | [
"add",
"triples",
"via",
"Reader"
] | d5b668ed2b3d5e90c9f1d5096012813c272062a2 | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java#L1016-L1019 |
37,090 | marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java | MarkLogicRepositoryConnection.add | @Override
public void add(URL url, String baseURI, RDFFormat dataFormat, Resource... contexts) throws IOException, RDFParseException, RepositoryException {
if(notNull(baseURI)) {
getClient().sendAdd(new URL(url.toString()).openStream(), baseURI, dataFormat, contexts);
}else{
getClient().sendAdd(new URL(url.toString()).openStream(), url.toString(), dataFormat, contexts);
}
} | java | @Override
public void add(URL url, String baseURI, RDFFormat dataFormat, Resource... contexts) throws IOException, RDFParseException, RepositoryException {
if(notNull(baseURI)) {
getClient().sendAdd(new URL(url.toString()).openStream(), baseURI, dataFormat, contexts);
}else{
getClient().sendAdd(new URL(url.toString()).openStream(), url.toString(), dataFormat, contexts);
}
} | [
"@",
"Override",
"public",
"void",
"add",
"(",
"URL",
"url",
",",
"String",
"baseURI",
",",
"RDFFormat",
"dataFormat",
",",
"Resource",
"...",
"contexts",
")",
"throws",
"IOException",
",",
"RDFParseException",
",",
"RepositoryException",
"{",
"if",
"(",
"notN... | add triples via URL
sets base URI to url if none is supplied
@param url
@param baseURI
@param dataFormat
@param contexts
@throws IOException
@throws RDFParseException
@throws RepositoryException | [
"add",
"triples",
"via",
"URL"
] | d5b668ed2b3d5e90c9f1d5096012813c272062a2 | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java#L1034-L1041 |
37,091 | marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java | MarkLogicRepositoryConnection.addWithoutCommit | @Override
protected void addWithoutCommit(Resource subject, URI predicate, Value object, Resource... contexts) throws RepositoryException {
add(subject, predicate, object, contexts);
} | java | @Override
protected void addWithoutCommit(Resource subject, URI predicate, Value object, Resource... contexts) throws RepositoryException {
add(subject, predicate, object, contexts);
} | [
"@",
"Override",
"protected",
"void",
"addWithoutCommit",
"(",
"Resource",
"subject",
",",
"URI",
"predicate",
",",
"Value",
"object",
",",
"Resource",
"...",
"contexts",
")",
"throws",
"RepositoryException",
"{",
"add",
"(",
"subject",
",",
"predicate",
",",
... | add without commit
note- supplied to honor interface
@param subject
@param predicate
@param object
@param contexts
@throws RepositoryException | [
"add",
"without",
"commit"
] | d5b668ed2b3d5e90c9f1d5096012813c272062a2 | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java#L1204-L1207 |
37,092 | marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java | MarkLogicRepositoryConnection.removeWithoutCommit | @Override
protected void removeWithoutCommit(Resource subject, URI predicate, Value object, Resource... contexts) throws RepositoryException {
remove(subject, predicate, object, contexts);
} | java | @Override
protected void removeWithoutCommit(Resource subject, URI predicate, Value object, Resource... contexts) throws RepositoryException {
remove(subject, predicate, object, contexts);
} | [
"@",
"Override",
"protected",
"void",
"removeWithoutCommit",
"(",
"Resource",
"subject",
",",
"URI",
"predicate",
",",
"Value",
"object",
",",
"Resource",
"...",
"contexts",
")",
"throws",
"RepositoryException",
"{",
"remove",
"(",
"subject",
",",
"predicate",
"... | remove without commit
supplied to honor interface
@param subject
@param predicate
@param object
@param contexts
@throws RepositoryException | [
"remove",
"without",
"commit"
] | d5b668ed2b3d5e90c9f1d5096012813c272062a2 | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java#L1220-L1223 |
37,093 | marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java | MarkLogicRepositoryConnection.setDefaultGraphPerms | @Override
public void setDefaultGraphPerms(GraphPermissions graphPerms) {
if(notNull(graphPerms)) {
this.defaultGraphPerms = graphPerms;
}else{
this.defaultGraphPerms = client.emptyGraphPerms();
}
} | java | @Override
public void setDefaultGraphPerms(GraphPermissions graphPerms) {
if(notNull(graphPerms)) {
this.defaultGraphPerms = graphPerms;
}else{
this.defaultGraphPerms = client.emptyGraphPerms();
}
} | [
"@",
"Override",
"public",
"void",
"setDefaultGraphPerms",
"(",
"GraphPermissions",
"graphPerms",
")",
"{",
"if",
"(",
"notNull",
"(",
"graphPerms",
")",
")",
"{",
"this",
".",
"defaultGraphPerms",
"=",
"graphPerms",
";",
"}",
"else",
"{",
"this",
".",
"defa... | sets default graph permissions to be used by all queries
@param graphPerms | [
"sets",
"default",
"graph",
"permissions",
"to",
"be",
"used",
"by",
"all",
"queries"
] | d5b668ed2b3d5e90c9f1d5096012813c272062a2 | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java#L1294-L1301 |
37,094 | marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java | MarkLogicRepositoryConnection.configureWriteCache | @Override
public void configureWriteCache(long initDelay, long delayCache, long cacheSize){
client.initTimer(initDelay, delayCache,cacheSize);
} | java | @Override
public void configureWriteCache(long initDelay, long delayCache, long cacheSize){
client.initTimer(initDelay, delayCache,cacheSize);
} | [
"@",
"Override",
"public",
"void",
"configureWriteCache",
"(",
"long",
"initDelay",
",",
"long",
"delayCache",
",",
"long",
"cacheSize",
")",
"{",
"client",
".",
"initTimer",
"(",
"initDelay",
",",
"delayCache",
",",
"cacheSize",
")",
";",
"}"
] | customise write cache interval and cache size.
@param initDelay - initial interval before write cache is checked
@param delayCache - interval (ms) to check write cache
@param cacheSize - size (# triples) of write cache | [
"customise",
"write",
"cache",
"interval",
"and",
"cache",
"size",
"."
] | d5b668ed2b3d5e90c9f1d5096012813c272062a2 | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java#L1374-L1377 |
37,095 | marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java | MarkLogicRepositoryConnection.mergeResource | private static Resource[] mergeResource(Resource o, Resource... arr) {
if(o != null) {
Resource[] newArray = new Resource[arr.length + 1];
newArray[0] = o;
System.arraycopy(arr, 0, newArray, 1, arr.length);
return newArray;
}else{
return arr;
}
} | java | private static Resource[] mergeResource(Resource o, Resource... arr) {
if(o != null) {
Resource[] newArray = new Resource[arr.length + 1];
newArray[0] = o;
System.arraycopy(arr, 0, newArray, 1, arr.length);
return newArray;
}else{
return arr;
}
} | [
"private",
"static",
"Resource",
"[",
"]",
"mergeResource",
"(",
"Resource",
"o",
",",
"Resource",
"...",
"arr",
")",
"{",
"if",
"(",
"o",
"!=",
"null",
")",
"{",
"Resource",
"[",
"]",
"newArray",
"=",
"new",
"Resource",
"[",
"arr",
".",
"length",
"+... | private utility for merging Resource varargs
@param o
@param arr
@return | [
"private",
"utility",
"for",
"merging",
"Resource",
"varargs"
] | d5b668ed2b3d5e90c9f1d5096012813c272062a2 | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java#L1450-L1460 |
37,096 | marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/TripleDeleteCache.java | TripleDeleteCache.flush | protected synchronized void flush() throws RepositoryException, MalformedQueryException, UpdateExecutionException, IOException {
if (cache.isEmpty()) { return; }
StringBuffer entireQuery = new StringBuffer();
SPARQLQueryBindingSet bindingSet = new SPARQLQueryBindingSet();
for (Namespace ns :cache.getNamespaces()){
entireQuery.append("PREFIX "+ns.getPrefix()+": <"+ns.getName()+">. ");
}
entireQuery.append("DELETE DATA { ");
Set<Resource> distinctCtx = new HashSet<Resource>();
for (Resource context :cache.contexts()) {
distinctCtx.add(context);
}
for (Resource ctx : distinctCtx) {
if (ctx != null) {
entireQuery.append(" GRAPH <" + ctx + "> { ");
}
for (Statement stmt : cache.filter(null, null, null, ctx)) {
entireQuery.append("<" + stmt.getSubject().stringValue() + "> ");
entireQuery.append("<" + stmt.getPredicate().stringValue() + "> ");
Value object=stmt.getObject();
if (object instanceof Literal) {
Literal lit = (Literal) object;
entireQuery.append("\"");
entireQuery.append(SPARQLUtil.encodeString(lit.getLabel()));
entireQuery.append("\"");
if(null == lit.getLanguage()) {
entireQuery.append("^^<" + lit.getDatatype().stringValue() + ">");
}else{
entireQuery.append("@" + lit.getLanguage().toString());
}
} else {
entireQuery.append("<" + object.stringValue() + "> ");
}
entireQuery.append(".");
}
if (ctx != null) {
entireQuery.append(" }");
}
}
entireQuery.append("} ");
log.info(entireQuery.toString());
client.sendUpdateQuery(entireQuery.toString(),bindingSet,false,null);
lastCacheAccess = new Date();
//log.info("success writing cache: {}",String.valueOf(cache.size()));
cache.clear();
} | java | protected synchronized void flush() throws RepositoryException, MalformedQueryException, UpdateExecutionException, IOException {
if (cache.isEmpty()) { return; }
StringBuffer entireQuery = new StringBuffer();
SPARQLQueryBindingSet bindingSet = new SPARQLQueryBindingSet();
for (Namespace ns :cache.getNamespaces()){
entireQuery.append("PREFIX "+ns.getPrefix()+": <"+ns.getName()+">. ");
}
entireQuery.append("DELETE DATA { ");
Set<Resource> distinctCtx = new HashSet<Resource>();
for (Resource context :cache.contexts()) {
distinctCtx.add(context);
}
for (Resource ctx : distinctCtx) {
if (ctx != null) {
entireQuery.append(" GRAPH <" + ctx + "> { ");
}
for (Statement stmt : cache.filter(null, null, null, ctx)) {
entireQuery.append("<" + stmt.getSubject().stringValue() + "> ");
entireQuery.append("<" + stmt.getPredicate().stringValue() + "> ");
Value object=stmt.getObject();
if (object instanceof Literal) {
Literal lit = (Literal) object;
entireQuery.append("\"");
entireQuery.append(SPARQLUtil.encodeString(lit.getLabel()));
entireQuery.append("\"");
if(null == lit.getLanguage()) {
entireQuery.append("^^<" + lit.getDatatype().stringValue() + ">");
}else{
entireQuery.append("@" + lit.getLanguage().toString());
}
} else {
entireQuery.append("<" + object.stringValue() + "> ");
}
entireQuery.append(".");
}
if (ctx != null) {
entireQuery.append(" }");
}
}
entireQuery.append("} ");
log.info(entireQuery.toString());
client.sendUpdateQuery(entireQuery.toString(),bindingSet,false,null);
lastCacheAccess = new Date();
//log.info("success writing cache: {}",String.valueOf(cache.size()));
cache.clear();
} | [
"protected",
"synchronized",
"void",
"flush",
"(",
")",
"throws",
"RepositoryException",
",",
"MalformedQueryException",
",",
"UpdateExecutionException",
",",
"IOException",
"{",
"if",
"(",
"cache",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
";",
"}",
"String... | flushes the cache, writing triples as graph
@throws MarkLogicSesameException | [
"flushes",
"the",
"cache",
"writing",
"triples",
"as",
"graph"
] | d5b668ed2b3d5e90c9f1d5096012813c272062a2 | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/TripleDeleteCache.java#L54-L104 |
37,097 | marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/query/MarkLogicBooleanQuery.java | MarkLogicBooleanQuery.evaluate | @Override
public boolean evaluate() throws QueryEvaluationException {
try {
sync();
return getMarkLogicClient().sendBooleanQuery(getQueryString(), getBindings(), getIncludeInferred(),getBaseURI());
}catch (RepositoryException e) {
throw new QueryEvaluationException(e.getMessage(), e);
}catch (MalformedQueryException e) {
throw new QueryEvaluationException(e.getMessage(), e);
}catch (IOException e) {
throw new QueryEvaluationException(e.getMessage(), e);
}catch(FailedRequestException e){
throw new QueryEvaluationException(e.getMessage(), e);
}
} | java | @Override
public boolean evaluate() throws QueryEvaluationException {
try {
sync();
return getMarkLogicClient().sendBooleanQuery(getQueryString(), getBindings(), getIncludeInferred(),getBaseURI());
}catch (RepositoryException e) {
throw new QueryEvaluationException(e.getMessage(), e);
}catch (MalformedQueryException e) {
throw new QueryEvaluationException(e.getMessage(), e);
}catch (IOException e) {
throw new QueryEvaluationException(e.getMessage(), e);
}catch(FailedRequestException e){
throw new QueryEvaluationException(e.getMessage(), e);
}
} | [
"@",
"Override",
"public",
"boolean",
"evaluate",
"(",
")",
"throws",
"QueryEvaluationException",
"{",
"try",
"{",
"sync",
"(",
")",
";",
"return",
"getMarkLogicClient",
"(",
")",
".",
"sendBooleanQuery",
"(",
"getQueryString",
"(",
")",
",",
"getBindings",
"(... | evaluate boolean query
@return boolean
@throws QueryEvaluationException | [
"evaluate",
"boolean",
"query"
] | d5b668ed2b3d5e90c9f1d5096012813c272062a2 | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/query/MarkLogicBooleanQuery.java#L65-L79 |
37,098 | marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/MarkLogicBackgroundGraphResult.java | MarkLogicBackgroundGraphResult.handleClose | @Override
protected void handleClose() throws QueryEvaluationException {
try {
super.handleClose();
}catch(Exception e){
logger.error("MarkLogicBackgroundGraphResult handleClose() stream closed exception",e);
throw new QueryEvaluationException(e);
}
} | java | @Override
protected void handleClose() throws QueryEvaluationException {
try {
super.handleClose();
}catch(Exception e){
logger.error("MarkLogicBackgroundGraphResult handleClose() stream closed exception",e);
throw new QueryEvaluationException(e);
}
} | [
"@",
"Override",
"protected",
"void",
"handleClose",
"(",
")",
"throws",
"QueryEvaluationException",
"{",
"try",
"{",
"super",
".",
"handleClose",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"logger",
".",
"error",
"(",
"\"MarkLogicBackgrou... | wrap exception, debug log | [
"wrap",
"exception",
"debug",
"log"
] | d5b668ed2b3d5e90c9f1d5096012813c272062a2 | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/MarkLogicBackgroundGraphResult.java#L86-L94 |
37,099 | marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/query/MarkLogicGraphQuery.java | MarkLogicGraphQuery.evaluate | @Override
public GraphQueryResult evaluate()
throws QueryEvaluationException {
try {
sync();
return getMarkLogicClient().sendGraphQuery(getQueryString(),getBindings(),getIncludeInferred(),getBaseURI());
} catch (IOException e) {
throw new QueryEvaluationException(e);
} catch (MarkLogicSesameException e) {
throw new QueryEvaluationException(e);
}
} | java | @Override
public GraphQueryResult evaluate()
throws QueryEvaluationException {
try {
sync();
return getMarkLogicClient().sendGraphQuery(getQueryString(),getBindings(),getIncludeInferred(),getBaseURI());
} catch (IOException e) {
throw new QueryEvaluationException(e);
} catch (MarkLogicSesameException e) {
throw new QueryEvaluationException(e);
}
} | [
"@",
"Override",
"public",
"GraphQueryResult",
"evaluate",
"(",
")",
"throws",
"QueryEvaluationException",
"{",
"try",
"{",
"sync",
"(",
")",
";",
"return",
"getMarkLogicClient",
"(",
")",
".",
"sendGraphQuery",
"(",
"getQueryString",
"(",
")",
",",
"getBindings... | evaluate graph query
@return GraphQueryResult
@throws QueryEvaluationException | [
"evaluate",
"graph",
"query"
] | d5b668ed2b3d5e90c9f1d5096012813c272062a2 | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/query/MarkLogicGraphQuery.java#L66-L77 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.