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,100 | marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/query/MarkLogicQuery.java | MarkLogicQuery.setBinding | public void setBinding(String name, String stringValue) {
bindingSet.addBinding(name, ValueFactoryImpl.getInstance().createURI(stringValue));
} | java | public void setBinding(String name, String stringValue) {
bindingSet.addBinding(name, ValueFactoryImpl.getInstance().createURI(stringValue));
} | [
"public",
"void",
"setBinding",
"(",
"String",
"name",
",",
"String",
"stringValue",
")",
"{",
"bindingSet",
".",
"addBinding",
"(",
"name",
",",
"ValueFactoryImpl",
".",
"getInstance",
"(",
")",
".",
"createURI",
"(",
"stringValue",
")",
")",
";",
"}"
] | set individual binding
@param name
@param stringValue | [
"set",
"individual",
"binding"
] | d5b668ed2b3d5e90c9f1d5096012813c272062a2 | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/query/MarkLogicQuery.java#L140-L142 |
37,101 | marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/query/MarkLogicQuery.java | MarkLogicQuery.setBinding | @Override
public void setBinding(String name, Value value) {
bindingSet.addBinding(name, value);
} | java | @Override
public void setBinding(String name, Value value) {
bindingSet.addBinding(name, value);
} | [
"@",
"Override",
"public",
"void",
"setBinding",
"(",
"String",
"name",
",",
"Value",
"value",
")",
"{",
"bindingSet",
".",
"addBinding",
"(",
"name",
",",
"value",
")",
";",
"}"
] | set individual binding and value
@param name
@param value | [
"set",
"individual",
"binding",
"and",
"value"
] | d5b668ed2b3d5e90c9f1d5096012813c272062a2 | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/query/MarkLogicQuery.java#L149-L152 |
37,102 | marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/query/MarkLogicTupleQuery.java | MarkLogicTupleQuery.evaluate | public TupleQueryResult evaluate(long start, long pageLength)
throws QueryEvaluationException {
try {
sync();
return getMarkLogicClient().sendTupleQuery(getQueryString(), getBindings(), start, pageLength, getIncludeInferred(), getBaseURI());
}catch (RepositoryException e) {
throw new QueryEvaluationException(e.getMessage(), e);
}catch (MalformedQueryException e) {
throw new QueryEvaluationException(e.getMessage(), e);
}catch(FailedRequestException e){
throw new QueryEvaluationException(e.getMessage(), e);
}
} | java | public TupleQueryResult evaluate(long start, long pageLength)
throws QueryEvaluationException {
try {
sync();
return getMarkLogicClient().sendTupleQuery(getQueryString(), getBindings(), start, pageLength, getIncludeInferred(), getBaseURI());
}catch (RepositoryException e) {
throw new QueryEvaluationException(e.getMessage(), e);
}catch (MalformedQueryException e) {
throw new QueryEvaluationException(e.getMessage(), e);
}catch(FailedRequestException e){
throw new QueryEvaluationException(e.getMessage(), e);
}
} | [
"public",
"TupleQueryResult",
"evaluate",
"(",
"long",
"start",
",",
"long",
"pageLength",
")",
"throws",
"QueryEvaluationException",
"{",
"try",
"{",
"sync",
"(",
")",
";",
"return",
"getMarkLogicClient",
"(",
")",
".",
"sendTupleQuery",
"(",
"getQueryString",
... | evaluate tuple query with pagination
@param start
@param pageLength
@return TupleQueryResult
@throws QueryEvaluationException | [
"evaluate",
"tuple",
"query",
"with",
"pagination"
] | d5b668ed2b3d5e90c9f1d5096012813c272062a2 | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/query/MarkLogicTupleQuery.java#L79-L91 |
37,103 | marklogic/marklogic-sesame | marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/query/MarkLogicUpdateQuery.java | MarkLogicUpdateQuery.execute | @Override
public void execute() throws UpdateExecutionException {
try {
sync();
getMarkLogicClient().sendUpdateQuery(getQueryString(), getBindings(), getIncludeInferred(), getBaseURI());
}catch(ForbiddenUserException | FailedRequestException e){
throw new UpdateExecutionException(e);
} catch (RepositoryException e) {
throw new UpdateExecutionException(e);
} catch (MalformedQueryException e) {
throw new UpdateExecutionException(e);
} catch (IOException e) {
throw new UpdateExecutionException(e);
}
} | java | @Override
public void execute() throws UpdateExecutionException {
try {
sync();
getMarkLogicClient().sendUpdateQuery(getQueryString(), getBindings(), getIncludeInferred(), getBaseURI());
}catch(ForbiddenUserException | FailedRequestException e){
throw new UpdateExecutionException(e);
} catch (RepositoryException e) {
throw new UpdateExecutionException(e);
} catch (MalformedQueryException e) {
throw new UpdateExecutionException(e);
} catch (IOException e) {
throw new UpdateExecutionException(e);
}
} | [
"@",
"Override",
"public",
"void",
"execute",
"(",
")",
"throws",
"UpdateExecutionException",
"{",
"try",
"{",
"sync",
"(",
")",
";",
"getMarkLogicClient",
"(",
")",
".",
"sendUpdateQuery",
"(",
"getQueryString",
"(",
")",
",",
"getBindings",
"(",
")",
",",
... | execute update query
@throws UpdateExecutionException | [
"execute",
"update",
"query"
] | d5b668ed2b3d5e90c9f1d5096012813c272062a2 | https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/query/MarkLogicUpdateQuery.java#L65-L79 |
37,104 | jponge/lzma-java | src/main/java/lzma/sdk/lz/InWindow.java | InWindow.getMatchLen | public int getMatchLen(int index, int distance, int limit)
{
if (_streamEndWasReached)
{
if ((_pos + index) + limit > _streamPos)
{
limit = _streamPos - (_pos + index);
}
}
distance++;
// Byte *pby = _buffer + (size_t)_pos + index;
int pby = _bufferOffset + _pos + index;
int i;
for (i = 0; i < limit && _bufferBase[pby + i] == _bufferBase[pby + i - distance]; i++)
{
}
return i;
} | java | public int getMatchLen(int index, int distance, int limit)
{
if (_streamEndWasReached)
{
if ((_pos + index) + limit > _streamPos)
{
limit = _streamPos - (_pos + index);
}
}
distance++;
// Byte *pby = _buffer + (size_t)_pos + index;
int pby = _bufferOffset + _pos + index;
int i;
for (i = 0; i < limit && _bufferBase[pby + i] == _bufferBase[pby + i - distance]; i++)
{
}
return i;
} | [
"public",
"int",
"getMatchLen",
"(",
"int",
"index",
",",
"int",
"distance",
",",
"int",
"limit",
")",
"{",
"if",
"(",
"_streamEndWasReached",
")",
"{",
"if",
"(",
"(",
"_pos",
"+",
"index",
")",
"+",
"limit",
">",
"_streamPos",
")",
"{",
"limit",
"=... | index + limit have not to exceed _keepSizeAfter; | [
"index",
"+",
"limit",
"have",
"not",
"to",
"exceed",
"_keepSizeAfter",
";"
] | 763aeed49d92ca607c5c1e09fce7af611d59f2aa | https://github.com/jponge/lzma-java/blob/763aeed49d92ca607c5c1e09fce7af611d59f2aa/src/main/java/lzma/sdk/lz/InWindow.java#L159-L177 |
37,105 | zalando-stups/spring-boot-etcd | zalando-boot-etcd/src/main/java/org/zalando/boot/etcd/EtcdClient.java | EtcdClient.get | public EtcdResponse get(String key) throws EtcdException {
UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(KEYSPACE);
builder.pathSegment(key);
return execute(builder, HttpMethod.GET, null, EtcdResponse.class);
} | java | public EtcdResponse get(String key) throws EtcdException {
UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(KEYSPACE);
builder.pathSegment(key);
return execute(builder, HttpMethod.GET, null, EtcdResponse.class);
} | [
"public",
"EtcdResponse",
"get",
"(",
"String",
"key",
")",
"throws",
"EtcdException",
"{",
"UriComponentsBuilder",
"builder",
"=",
"UriComponentsBuilder",
".",
"fromUriString",
"(",
"KEYSPACE",
")",
";",
"builder",
".",
"pathSegment",
"(",
"key",
")",
";",
"ret... | Returns the node with the given key from etcd.
@param key
the node's key
@return the response from etcd with the node
@throws EtcdException
in case etcd returned an error | [
"Returns",
"the",
"node",
"with",
"the",
"given",
"key",
"from",
"etcd",
"."
] | 6b4f48663d424777326c38b1e7da75c8b68a3841 | https://github.com/zalando-stups/spring-boot-etcd/blob/6b4f48663d424777326c38b1e7da75c8b68a3841/zalando-boot-etcd/src/main/java/org/zalando/boot/etcd/EtcdClient.java#L211-L216 |
37,106 | zalando-stups/spring-boot-etcd | zalando-boot-etcd/src/main/java/org/zalando/boot/etcd/EtcdClient.java | EtcdClient.put | public EtcdResponse put(final String key, final String value) throws EtcdException {
UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(KEYSPACE);
builder.pathSegment(key);
MultiValueMap<String, String> payload = new LinkedMultiValueMap<>(1);
payload.set("value", value);
return execute(builder, HttpMethod.PUT, payload, EtcdResponse.class);
} | java | public EtcdResponse put(final String key, final String value) throws EtcdException {
UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(KEYSPACE);
builder.pathSegment(key);
MultiValueMap<String, String> payload = new LinkedMultiValueMap<>(1);
payload.set("value", value);
return execute(builder, HttpMethod.PUT, payload, EtcdResponse.class);
} | [
"public",
"EtcdResponse",
"put",
"(",
"final",
"String",
"key",
",",
"final",
"String",
"value",
")",
"throws",
"EtcdException",
"{",
"UriComponentsBuilder",
"builder",
"=",
"UriComponentsBuilder",
".",
"fromUriString",
"(",
"KEYSPACE",
")",
";",
"builder",
".",
... | Sets the value of the node with the given key in etcd. Any previously
existing key-value pair is returned as prevNode in the etcd response.
@param key
the node's key
@param value
the node's value
@return the response from etcd with the node
@throws EtcdException
in case etcd returned an error | [
"Sets",
"the",
"value",
"of",
"the",
"node",
"with",
"the",
"given",
"key",
"in",
"etcd",
".",
"Any",
"previously",
"existing",
"key",
"-",
"value",
"pair",
"is",
"returned",
"as",
"prevNode",
"in",
"the",
"etcd",
"response",
"."
] | 6b4f48663d424777326c38b1e7da75c8b68a3841 | https://github.com/zalando-stups/spring-boot-etcd/blob/6b4f48663d424777326c38b1e7da75c8b68a3841/zalando-boot-etcd/src/main/java/org/zalando/boot/etcd/EtcdClient.java#L250-L258 |
37,107 | zalando-stups/spring-boot-etcd | zalando-boot-etcd/src/main/java/org/zalando/boot/etcd/EtcdClient.java | EtcdClient.delete | public EtcdResponse delete(final String key) throws EtcdException {
UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(KEYSPACE);
builder.pathSegment(key);
return execute(builder, HttpMethod.DELETE, null, EtcdResponse.class);
} | java | public EtcdResponse delete(final String key) throws EtcdException {
UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(KEYSPACE);
builder.pathSegment(key);
return execute(builder, HttpMethod.DELETE, null, EtcdResponse.class);
} | [
"public",
"EtcdResponse",
"delete",
"(",
"final",
"String",
"key",
")",
"throws",
"EtcdException",
"{",
"UriComponentsBuilder",
"builder",
"=",
"UriComponentsBuilder",
".",
"fromUriString",
"(",
"KEYSPACE",
")",
";",
"builder",
".",
"pathSegment",
"(",
"key",
")",... | Deletes the node with the given key from etcd.
@param key
the node's key
@return the response from etcd with the node
@throws EtcdException
in case etcd returned an error | [
"Deletes",
"the",
"node",
"with",
"the",
"given",
"key",
"from",
"etcd",
"."
] | 6b4f48663d424777326c38b1e7da75c8b68a3841 | https://github.com/zalando-stups/spring-boot-etcd/blob/6b4f48663d424777326c38b1e7da75c8b68a3841/zalando-boot-etcd/src/main/java/org/zalando/boot/etcd/EtcdClient.java#L294-L299 |
37,108 | zalando-stups/spring-boot-etcd | zalando-boot-etcd/src/main/java/org/zalando/boot/etcd/EtcdClient.java | EtcdClient.listMembers | public EtcdMemberResponse listMembers() throws EtcdException {
UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(MEMBERSPACE);
return execute(builder, HttpMethod.GET, null, EtcdMemberResponse.class);
} | java | public EtcdMemberResponse listMembers() throws EtcdException {
UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(MEMBERSPACE);
return execute(builder, HttpMethod.GET, null, EtcdMemberResponse.class);
} | [
"public",
"EtcdMemberResponse",
"listMembers",
"(",
")",
"throws",
"EtcdException",
"{",
"UriComponentsBuilder",
"builder",
"=",
"UriComponentsBuilder",
".",
"fromUriString",
"(",
"MEMBERSPACE",
")",
";",
"return",
"execute",
"(",
"builder",
",",
"HttpMethod",
".",
... | Returns a representation of all members in the etcd cluster.
@return the members
@throws EtcdException
in case etcd returned an error | [
"Returns",
"a",
"representation",
"of",
"all",
"members",
"in",
"the",
"etcd",
"cluster",
"."
] | 6b4f48663d424777326c38b1e7da75c8b68a3841 | https://github.com/zalando-stups/spring-boot-etcd/blob/6b4f48663d424777326c38b1e7da75c8b68a3841/zalando-boot-etcd/src/main/java/org/zalando/boot/etcd/EtcdClient.java#L581-L584 |
37,109 | zalando-stups/spring-boot-etcd | zalando-boot-etcd/src/main/java/org/zalando/boot/etcd/EtcdClient.java | EtcdClient.updateMembers | private void updateMembers() {
try {
List<String> locations = new ArrayList<String>();
EtcdMemberResponse response = listMembers();
EtcdMember[] members = response.getMembers();
for (EtcdMember member : members) {
String[] clientUrls = member.getClientURLs();
if (clientUrls != null) {
for (String clientUrl : clientUrls) {
try {
String version = template.getForObject(clientUrl + "/version", String.class);
if (version == null) {
locations.add(clientUrl);
}
} catch (RestClientException e) {
log.debug("ignoring URI " + clientUrl + " because of error.", e);
}
}
}
}
if (!locations.isEmpty()) {
this.locations = locations.toArray(new String[locations.size()]);
} else {
log.debug("not updating locations because no location is found");
}
} catch (EtcdException e) {
log.error("Could not update etcd cluster member.", e);
}
} | java | private void updateMembers() {
try {
List<String> locations = new ArrayList<String>();
EtcdMemberResponse response = listMembers();
EtcdMember[] members = response.getMembers();
for (EtcdMember member : members) {
String[] clientUrls = member.getClientURLs();
if (clientUrls != null) {
for (String clientUrl : clientUrls) {
try {
String version = template.getForObject(clientUrl + "/version", String.class);
if (version == null) {
locations.add(clientUrl);
}
} catch (RestClientException e) {
log.debug("ignoring URI " + clientUrl + " because of error.", e);
}
}
}
}
if (!locations.isEmpty()) {
this.locations = locations.toArray(new String[locations.size()]);
} else {
log.debug("not updating locations because no location is found");
}
} catch (EtcdException e) {
log.error("Could not update etcd cluster member.", e);
}
} | [
"private",
"void",
"updateMembers",
"(",
")",
"{",
"try",
"{",
"List",
"<",
"String",
">",
"locations",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"EtcdMemberResponse",
"response",
"=",
"listMembers",
"(",
")",
";",
"EtcdMember",
"[",
"]... | Updates the locations of the etcd cluster members. | [
"Updates",
"the",
"locations",
"of",
"the",
"etcd",
"cluster",
"members",
"."
] | 6b4f48663d424777326c38b1e7da75c8b68a3841 | https://github.com/zalando-stups/spring-boot-etcd/blob/6b4f48663d424777326c38b1e7da75c8b68a3841/zalando-boot-etcd/src/main/java/org/zalando/boot/etcd/EtcdClient.java#L627-L658 |
37,110 | zalando-stups/spring-boot-etcd | zalando-boot-etcd/src/main/java/org/zalando/boot/etcd/EtcdClient.java | EtcdClient.execute | private <T> T execute(UriComponentsBuilder uriTemplate, HttpMethod method,
MultiValueMap<String, String> requestData, Class<T> responseType) throws EtcdException {
long startTimeMillis = System.currentTimeMillis();
int retry = -1;
ResourceAccessException lastException = null;
do {
lastException = null;
URI uri = uriTemplate.buildAndExpand(locations[locationIndex]).toUri();
RequestEntity<MultiValueMap<String, String>> requestEntity = new RequestEntity<>(requestData, null, method,
uri);
try {
ResponseEntity<T> responseEntity = template.exchange(requestEntity, responseType);
return responseEntity.getBody();
} catch (HttpStatusCodeException e) {
EtcdError error = null;
try {
error = responseConverter.getObjectMapper().readValue(e.getResponseBodyAsByteArray(),
EtcdError.class);
} catch (IOException ex) {
error = null;
}
throw new EtcdException(error, "Failed to execute " + requestEntity + ".", e);
} catch (ResourceAccessException e) {
log.debug("Failed to execute " + requestEntity + ", retrying if possible.", e);
if (locationIndex == locations.length - 1) {
locationIndex = 0;
} else {
locationIndex++;
}
lastException = e;
}
} while (retry <= retryCount && System.currentTimeMillis() - startTimeMillis < retryDuration);
if (lastException != null) {
throw lastException;
} else {
return null;
}
} | java | private <T> T execute(UriComponentsBuilder uriTemplate, HttpMethod method,
MultiValueMap<String, String> requestData, Class<T> responseType) throws EtcdException {
long startTimeMillis = System.currentTimeMillis();
int retry = -1;
ResourceAccessException lastException = null;
do {
lastException = null;
URI uri = uriTemplate.buildAndExpand(locations[locationIndex]).toUri();
RequestEntity<MultiValueMap<String, String>> requestEntity = new RequestEntity<>(requestData, null, method,
uri);
try {
ResponseEntity<T> responseEntity = template.exchange(requestEntity, responseType);
return responseEntity.getBody();
} catch (HttpStatusCodeException e) {
EtcdError error = null;
try {
error = responseConverter.getObjectMapper().readValue(e.getResponseBodyAsByteArray(),
EtcdError.class);
} catch (IOException ex) {
error = null;
}
throw new EtcdException(error, "Failed to execute " + requestEntity + ".", e);
} catch (ResourceAccessException e) {
log.debug("Failed to execute " + requestEntity + ", retrying if possible.", e);
if (locationIndex == locations.length - 1) {
locationIndex = 0;
} else {
locationIndex++;
}
lastException = e;
}
} while (retry <= retryCount && System.currentTimeMillis() - startTimeMillis < retryDuration);
if (lastException != null) {
throw lastException;
} else {
return null;
}
} | [
"private",
"<",
"T",
">",
"T",
"execute",
"(",
"UriComponentsBuilder",
"uriTemplate",
",",
"HttpMethod",
"method",
",",
"MultiValueMap",
"<",
"String",
",",
"String",
">",
"requestData",
",",
"Class",
"<",
"T",
">",
"responseType",
")",
"throws",
"EtcdExceptio... | Executes the given method on the given location using the given request
data.
@param uri
the location
@param method
the HTTP method
@param requestData
the request data
@return the etcd response
@throws EtcdException
in case etcd returned an error | [
"Executes",
"the",
"given",
"method",
"on",
"the",
"given",
"location",
"using",
"the",
"given",
"request",
"data",
"."
] | 6b4f48663d424777326c38b1e7da75c8b68a3841 | https://github.com/zalando-stups/spring-boot-etcd/blob/6b4f48663d424777326c38b1e7da75c8b68a3841/zalando-boot-etcd/src/main/java/org/zalando/boot/etcd/EtcdClient.java#L674-L717 |
37,111 | metamx/java-util | src/main/java/com/metamx/common/collect/MoreIterators.java | MoreIterators.before | public static <X> Iterator<X> before(final Iterator<X> iterator, final Runnable f)
{
return new Iterator<X>()
{
private final Runnable fOnlyOnce = new RunOnlyOnce(f);
@Override
public boolean hasNext()
{
fOnlyOnce.run();
return iterator.hasNext();
}
@Override
public X next()
{
fOnlyOnce.run();
return iterator.next();
}
@Override
public void remove()
{
fOnlyOnce.run();
iterator.remove();
}
};
} | java | public static <X> Iterator<X> before(final Iterator<X> iterator, final Runnable f)
{
return new Iterator<X>()
{
private final Runnable fOnlyOnce = new RunOnlyOnce(f);
@Override
public boolean hasNext()
{
fOnlyOnce.run();
return iterator.hasNext();
}
@Override
public X next()
{
fOnlyOnce.run();
return iterator.next();
}
@Override
public void remove()
{
fOnlyOnce.run();
iterator.remove();
}
};
} | [
"public",
"static",
"<",
"X",
">",
"Iterator",
"<",
"X",
">",
"before",
"(",
"final",
"Iterator",
"<",
"X",
">",
"iterator",
",",
"final",
"Runnable",
"f",
")",
"{",
"return",
"new",
"Iterator",
"<",
"X",
">",
"(",
")",
"{",
"private",
"final",
"Ru... | Run f immediately before the first element of iterator is generated.
Exceptions raised by f will prevent the requested behavior on the
underlying iterator, and can be handled by the caller. | [
"Run",
"f",
"immediately",
"before",
"the",
"first",
"element",
"of",
"iterator",
"is",
"generated",
".",
"Exceptions",
"raised",
"by",
"f",
"will",
"prevent",
"the",
"requested",
"behavior",
"on",
"the",
"underlying",
"iterator",
"and",
"can",
"be",
"handled"... | 9d204043da1136e94fb2e2d63e3543a29bf54b4d | https://github.com/metamx/java-util/blob/9d204043da1136e94fb2e2d63e3543a29bf54b4d/src/main/java/com/metamx/common/collect/MoreIterators.java#L34-L61 |
37,112 | metamx/java-util | src/main/java/com/metamx/common/collect/MoreIterators.java | MoreIterators.after | public static <X> Iterator<X> after(final Iterator<X> iterator, final Runnable f)
{
return new Iterator<X>()
{
private final Runnable fOnlyOnce = new RunOnlyOnce(f);
@Override
public boolean hasNext()
{
final boolean hasNext = iterator.hasNext();
if (!hasNext) {
fOnlyOnce.run();
}
return hasNext;
}
@Override
public X next()
{
try {
return iterator.next();
}
catch (NoSuchElementException e) {
fOnlyOnce.run(); // (f exceptions are prohibited because they destroy e here)
throw e;
}
}
@Override
public void remove()
{
iterator.remove();
}
};
} | java | public static <X> Iterator<X> after(final Iterator<X> iterator, final Runnable f)
{
return new Iterator<X>()
{
private final Runnable fOnlyOnce = new RunOnlyOnce(f);
@Override
public boolean hasNext()
{
final boolean hasNext = iterator.hasNext();
if (!hasNext) {
fOnlyOnce.run();
}
return hasNext;
}
@Override
public X next()
{
try {
return iterator.next();
}
catch (NoSuchElementException e) {
fOnlyOnce.run(); // (f exceptions are prohibited because they destroy e here)
throw e;
}
}
@Override
public void remove()
{
iterator.remove();
}
};
} | [
"public",
"static",
"<",
"X",
">",
"Iterator",
"<",
"X",
">",
"after",
"(",
"final",
"Iterator",
"<",
"X",
">",
"iterator",
",",
"final",
"Runnable",
"f",
")",
"{",
"return",
"new",
"Iterator",
"<",
"X",
">",
"(",
")",
"{",
"private",
"final",
"Run... | Run f immediately after the last element of iterator is generated.
Exceptions must not be raised by f. | [
"Run",
"f",
"immediately",
"after",
"the",
"last",
"element",
"of",
"iterator",
"is",
"generated",
".",
"Exceptions",
"must",
"not",
"be",
"raised",
"by",
"f",
"."
] | 9d204043da1136e94fb2e2d63e3543a29bf54b4d | https://github.com/metamx/java-util/blob/9d204043da1136e94fb2e2d63e3543a29bf54b4d/src/main/java/com/metamx/common/collect/MoreIterators.java#L67-L101 |
37,113 | metamx/java-util | src/main/java/com/metamx/common/collect/Utils.java | Utils.zipMap | public static <K, V> Map<K, V> zipMap(Iterable<K> keys, Iterable<V> values) {
Map<K, V> retVal = new LinkedHashMap<>();
Iterator<K> keysIter = keys.iterator();
Iterator<V> valsIter = values.iterator();
while (keysIter.hasNext()) {
final K key = keysIter.next();
Preconditions.checkArgument(valsIter.hasNext(),
"number of values[%s] less than number of keys, broke on key[%s]",
retVal.size(), key);
retVal.put(key, valsIter.next());
}
Preconditions.checkArgument(!valsIter.hasNext(),
"number of values[%s] exceeds number of keys[%s]",
retVal.size() + Iterators.size(valsIter), retVal.size());
return retVal;
} | java | public static <K, V> Map<K, V> zipMap(Iterable<K> keys, Iterable<V> values) {
Map<K, V> retVal = new LinkedHashMap<>();
Iterator<K> keysIter = keys.iterator();
Iterator<V> valsIter = values.iterator();
while (keysIter.hasNext()) {
final K key = keysIter.next();
Preconditions.checkArgument(valsIter.hasNext(),
"number of values[%s] less than number of keys, broke on key[%s]",
retVal.size(), key);
retVal.put(key, valsIter.next());
}
Preconditions.checkArgument(!valsIter.hasNext(),
"number of values[%s] exceeds number of keys[%s]",
retVal.size() + Iterators.size(valsIter), retVal.size());
return retVal;
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"Map",
"<",
"K",
",",
"V",
">",
"zipMap",
"(",
"Iterable",
"<",
"K",
">",
"keys",
",",
"Iterable",
"<",
"V",
">",
"values",
")",
"{",
"Map",
"<",
"K",
",",
"V",
">",
"retVal",
"=",
"new",
"LinkedHa... | Create a Map from iterables of keys and values. Will throw an exception if there are more keys than values,
or more values than keys. | [
"Create",
"a",
"Map",
"from",
"iterables",
"of",
"keys",
"and",
"values",
".",
"Will",
"throw",
"an",
"exception",
"if",
"there",
"are",
"more",
"keys",
"than",
"values",
"or",
"more",
"values",
"than",
"keys",
"."
] | 9d204043da1136e94fb2e2d63e3543a29bf54b4d | https://github.com/metamx/java-util/blob/9d204043da1136e94fb2e2d63e3543a29bf54b4d/src/main/java/com/metamx/common/collect/Utils.java#L53-L74 |
37,114 | metamx/java-util | src/main/java/com/metamx/common/collect/Utils.java | Utils.zipMapPartial | public static <K, V> Map<K, V> zipMapPartial(Iterable<K> keys, Iterable<V> values)
{
Map<K, V> retVal = new LinkedHashMap<>();
Iterator<K> keysIter = keys.iterator();
Iterator<V> valsIter = values.iterator();
while (keysIter.hasNext()) {
final K key = keysIter.next();
if(valsIter.hasNext()) retVal.put(key, valsIter.next());
else break;
}
return retVal;
} | java | public static <K, V> Map<K, V> zipMapPartial(Iterable<K> keys, Iterable<V> values)
{
Map<K, V> retVal = new LinkedHashMap<>();
Iterator<K> keysIter = keys.iterator();
Iterator<V> valsIter = values.iterator();
while (keysIter.hasNext()) {
final K key = keysIter.next();
if(valsIter.hasNext()) retVal.put(key, valsIter.next());
else break;
}
return retVal;
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"Map",
"<",
"K",
",",
"V",
">",
"zipMapPartial",
"(",
"Iterable",
"<",
"K",
">",
"keys",
",",
"Iterable",
"<",
"V",
">",
"values",
")",
"{",
"Map",
"<",
"K",
",",
"V",
">",
"retVal",
"=",
"new",
"L... | Create a Map from iterables of keys and values. If there are more keys than values, or more values than keys,
the excess will be omitted. | [
"Create",
"a",
"Map",
"from",
"iterables",
"of",
"keys",
"and",
"values",
".",
"If",
"there",
"are",
"more",
"keys",
"than",
"values",
"or",
"more",
"values",
"than",
"keys",
"the",
"excess",
"will",
"be",
"omitted",
"."
] | 9d204043da1136e94fb2e2d63e3543a29bf54b4d | https://github.com/metamx/java-util/blob/9d204043da1136e94fb2e2d63e3543a29bf54b4d/src/main/java/com/metamx/common/collect/Utils.java#L78-L93 |
37,115 | metamx/java-util | src/main/java/com/metamx/common/StreamUtils.java | StreamUtils.copyToFileAndClose | public static long copyToFileAndClose(InputStream is, File file, long timeout) throws IOException, TimeoutException
{
file.getParentFile().mkdirs();
try (OutputStream os = new BufferedOutputStream(new FileOutputStream(file))) {
final long retval = copyWithTimeout(is, os, timeout);
// Workarround for http://hg.openjdk.java.net/jdk8/jdk8/jdk/rev/759aa847dcaf
os.flush();
return retval;
}
finally {
is.close();
}
} | java | public static long copyToFileAndClose(InputStream is, File file, long timeout) throws IOException, TimeoutException
{
file.getParentFile().mkdirs();
try (OutputStream os = new BufferedOutputStream(new FileOutputStream(file))) {
final long retval = copyWithTimeout(is, os, timeout);
// Workarround for http://hg.openjdk.java.net/jdk8/jdk8/jdk/rev/759aa847dcaf
os.flush();
return retval;
}
finally {
is.close();
}
} | [
"public",
"static",
"long",
"copyToFileAndClose",
"(",
"InputStream",
"is",
",",
"File",
"file",
",",
"long",
"timeout",
")",
"throws",
"IOException",
",",
"TimeoutException",
"{",
"file",
".",
"getParentFile",
"(",
")",
".",
"mkdirs",
"(",
")",
";",
"try",
... | Copy bytes from `is` to `file` but timeout if the copy takes too long. The timeout is best effort and not
guaranteed. Specifically, `is.read` will not be interrupted.
@param is The `InputStream` to copy bytes from. It is closed regardless of copy results.
@param file The `File` to copy bytes to
@param timeout The timeout (in ms) of the copy.
@return The size of bytes written to `file`
@throws IOException
@throws TimeoutException If `timeout` is exceeded | [
"Copy",
"bytes",
"from",
"is",
"to",
"file",
"but",
"timeout",
"if",
"the",
"copy",
"takes",
"too",
"long",
".",
"The",
"timeout",
"is",
"best",
"effort",
"and",
"not",
"guaranteed",
".",
"Specifically",
"is",
".",
"read",
"will",
"not",
"be",
"interrupt... | 9d204043da1136e94fb2e2d63e3543a29bf54b4d | https://github.com/metamx/java-util/blob/9d204043da1136e94fb2e2d63e3543a29bf54b4d/src/main/java/com/metamx/common/StreamUtils.java#L81-L93 |
37,116 | metamx/java-util | src/main/java/com/metamx/common/StreamUtils.java | StreamUtils.copyWithTimeout | public static long copyWithTimeout(InputStream is, OutputStream os, long timeout) throws IOException, TimeoutException
{
byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
int n;
long startTime = System.currentTimeMillis();
long size = 0;
while (-1 != (n = is.read(buffer))) {
if (System.currentTimeMillis() - startTime > timeout) {
throw new TimeoutException(String.format("Copy time has exceeded %,d millis", timeout));
}
os.write(buffer, 0, n);
size += n;
}
return size;
} | java | public static long copyWithTimeout(InputStream is, OutputStream os, long timeout) throws IOException, TimeoutException
{
byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
int n;
long startTime = System.currentTimeMillis();
long size = 0;
while (-1 != (n = is.read(buffer))) {
if (System.currentTimeMillis() - startTime > timeout) {
throw new TimeoutException(String.format("Copy time has exceeded %,d millis", timeout));
}
os.write(buffer, 0, n);
size += n;
}
return size;
} | [
"public",
"static",
"long",
"copyWithTimeout",
"(",
"InputStream",
"is",
",",
"OutputStream",
"os",
",",
"long",
"timeout",
")",
"throws",
"IOException",
",",
"TimeoutException",
"{",
"byte",
"[",
"]",
"buffer",
"=",
"new",
"byte",
"[",
"DEFAULT_BUFFER_SIZE",
... | Copy from the input stream to the output stream and tries to exit if the copy exceeds the timeout. The timeout
is best effort. Specifically, `is.read` will not be interrupted.
@param is The input stream to read bytes from.
@param os The output stream to write bytes to.
@param timeout The timeout (in ms) for the copy operation
@return The total size of bytes written to `os`
@throws IOException
@throws TimeoutException If `tiemout` is exceeded | [
"Copy",
"from",
"the",
"input",
"stream",
"to",
"the",
"output",
"stream",
"and",
"tries",
"to",
"exit",
"if",
"the",
"copy",
"exceeds",
"the",
"timeout",
".",
"The",
"timeout",
"is",
"best",
"effort",
".",
"Specifically",
"is",
".",
"read",
"will",
"not... | 9d204043da1136e94fb2e2d63e3543a29bf54b4d | https://github.com/metamx/java-util/blob/9d204043da1136e94fb2e2d63e3543a29bf54b4d/src/main/java/com/metamx/common/StreamUtils.java#L132-L146 |
37,117 | metamx/java-util | src/main/java/com/metamx/common/CompressionUtils.java | CompressionUtils.unzip | public static FileUtils.FileCopyResult unzip(final File pulledFile, final File outDir) throws IOException
{
if (!(outDir.exists() && outDir.isDirectory())) {
throw new ISE("outDir[%s] must exist and be a directory", outDir);
}
log.info("Unzipping file[%s] to [%s]", pulledFile, outDir);
final FileUtils.FileCopyResult result = new FileUtils.FileCopyResult();
try (final ZipFile zipFile = new ZipFile(pulledFile)) {
final Enumeration<? extends ZipEntry> enumeration = zipFile.entries();
while (enumeration.hasMoreElements()) {
final ZipEntry entry = enumeration.nextElement();
result.addFiles(
FileUtils.retryCopy(
new ByteSource()
{
@Override
public InputStream openStream() throws IOException
{
return new BufferedInputStream(zipFile.getInputStream(entry));
}
},
new File(outDir, entry.getName()),
FileUtils.IS_EXCEPTION,
DEFAULT_RETRY_COUNT
).getFiles()
);
}
}
return result;
} | java | public static FileUtils.FileCopyResult unzip(final File pulledFile, final File outDir) throws IOException
{
if (!(outDir.exists() && outDir.isDirectory())) {
throw new ISE("outDir[%s] must exist and be a directory", outDir);
}
log.info("Unzipping file[%s] to [%s]", pulledFile, outDir);
final FileUtils.FileCopyResult result = new FileUtils.FileCopyResult();
try (final ZipFile zipFile = new ZipFile(pulledFile)) {
final Enumeration<? extends ZipEntry> enumeration = zipFile.entries();
while (enumeration.hasMoreElements()) {
final ZipEntry entry = enumeration.nextElement();
result.addFiles(
FileUtils.retryCopy(
new ByteSource()
{
@Override
public InputStream openStream() throws IOException
{
return new BufferedInputStream(zipFile.getInputStream(entry));
}
},
new File(outDir, entry.getName()),
FileUtils.IS_EXCEPTION,
DEFAULT_RETRY_COUNT
).getFiles()
);
}
}
return result;
} | [
"public",
"static",
"FileUtils",
".",
"FileCopyResult",
"unzip",
"(",
"final",
"File",
"pulledFile",
",",
"final",
"File",
"outDir",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"(",
"outDir",
".",
"exists",
"(",
")",
"&&",
"outDir",
".",
"isDirector... | Unzip the pulled file to an output directory. This is only expected to work on zips with lone files, and is not intended for zips with directory structures.
@param pulledFile The file to unzip
@param outDir The directory to store the contents of the file.
@return a FileCopyResult of the files which were written to disk
@throws IOException | [
"Unzip",
"the",
"pulled",
"file",
"to",
"an",
"output",
"directory",
".",
"This",
"is",
"only",
"expected",
"to",
"work",
"on",
"zips",
"with",
"lone",
"files",
"and",
"is",
"not",
"intended",
"for",
"zips",
"with",
"directory",
"structures",
"."
] | 9d204043da1136e94fb2e2d63e3543a29bf54b4d | https://github.com/metamx/java-util/blob/9d204043da1136e94fb2e2d63e3543a29bf54b4d/src/main/java/com/metamx/common/CompressionUtils.java#L198-L227 |
37,118 | metamx/java-util | src/main/java/com/metamx/common/concurrent/ScheduledExecutors.java | ScheduledExecutors.scheduleWithFixedDelay | public static void scheduleWithFixedDelay(ScheduledExecutorService exec, Duration delay, Runnable runnable)
{
scheduleWithFixedDelay(exec, delay, delay, runnable);
} | java | public static void scheduleWithFixedDelay(ScheduledExecutorService exec, Duration delay, Runnable runnable)
{
scheduleWithFixedDelay(exec, delay, delay, runnable);
} | [
"public",
"static",
"void",
"scheduleWithFixedDelay",
"(",
"ScheduledExecutorService",
"exec",
",",
"Duration",
"delay",
",",
"Runnable",
"runnable",
")",
"{",
"scheduleWithFixedDelay",
"(",
"exec",
",",
"delay",
",",
"delay",
",",
"runnable",
")",
";",
"}"
] | Run runnable repeatedly with the given delay between calls. Exceptions are
caught and logged as errors. | [
"Run",
"runnable",
"repeatedly",
"with",
"the",
"given",
"delay",
"between",
"calls",
".",
"Exceptions",
"are",
"caught",
"and",
"logged",
"as",
"errors",
"."
] | 9d204043da1136e94fb2e2d63e3543a29bf54b4d | https://github.com/metamx/java-util/blob/9d204043da1136e94fb2e2d63e3543a29bf54b4d/src/main/java/com/metamx/common/concurrent/ScheduledExecutors.java#L37-L40 |
37,119 | metamx/java-util | src/main/java/com/metamx/common/concurrent/ScheduledExecutors.java | ScheduledExecutors.scheduleWithFixedDelay | public static void scheduleWithFixedDelay(
final ScheduledExecutorService exec,
final Duration initialDelay,
final Duration delay,
final Callable<Signal> callable
)
{
log.debug("Scheduling repeatedly: %s with delay %s", callable, delay);
exec.schedule(
new Runnable()
{
@Override
public void run()
{
try {
log.debug("Running %s (delay %s)", callable, delay);
if (callable.call() == Signal.REPEAT) {
log.debug("Rescheduling %s (delay %s)", callable, delay);
exec.schedule(this, delay.getMillis(), TimeUnit.MILLISECONDS);
} else {
log.debug("Stopped rescheduling %s (delay %s)", callable, delay);
}
}
catch (Throwable e) {
log.error(e, "Uncaught exception.");
}
}
},
initialDelay.getMillis(),
TimeUnit.MILLISECONDS
);
} | java | public static void scheduleWithFixedDelay(
final ScheduledExecutorService exec,
final Duration initialDelay,
final Duration delay,
final Callable<Signal> callable
)
{
log.debug("Scheduling repeatedly: %s with delay %s", callable, delay);
exec.schedule(
new Runnable()
{
@Override
public void run()
{
try {
log.debug("Running %s (delay %s)", callable, delay);
if (callable.call() == Signal.REPEAT) {
log.debug("Rescheduling %s (delay %s)", callable, delay);
exec.schedule(this, delay.getMillis(), TimeUnit.MILLISECONDS);
} else {
log.debug("Stopped rescheduling %s (delay %s)", callable, delay);
}
}
catch (Throwable e) {
log.error(e, "Uncaught exception.");
}
}
},
initialDelay.getMillis(),
TimeUnit.MILLISECONDS
);
} | [
"public",
"static",
"void",
"scheduleWithFixedDelay",
"(",
"final",
"ScheduledExecutorService",
"exec",
",",
"final",
"Duration",
"initialDelay",
",",
"final",
"Duration",
"delay",
",",
"final",
"Callable",
"<",
"Signal",
">",
"callable",
")",
"{",
"log",
".",
"... | Run callable repeatedly with the given delay between calls, until it
returns Signal.STOP. Exceptions are caught and logged as errors. | [
"Run",
"callable",
"repeatedly",
"with",
"the",
"given",
"delay",
"between",
"calls",
"until",
"it",
"returns",
"Signal",
".",
"STOP",
".",
"Exceptions",
"are",
"caught",
"and",
"logged",
"as",
"errors",
"."
] | 9d204043da1136e94fb2e2d63e3543a29bf54b4d | https://github.com/metamx/java-util/blob/9d204043da1136e94fb2e2d63e3543a29bf54b4d/src/main/java/com/metamx/common/concurrent/ScheduledExecutors.java#L83-L114 |
37,120 | metamx/java-util | src/main/java/com/metamx/common/concurrent/ScheduledExecutors.java | ScheduledExecutors.scheduleAtFixedRate | public static void scheduleAtFixedRate(ScheduledExecutorService exec, Duration rate, Runnable runnable)
{
scheduleAtFixedRate(exec, rate, rate, runnable);
} | java | public static void scheduleAtFixedRate(ScheduledExecutorService exec, Duration rate, Runnable runnable)
{
scheduleAtFixedRate(exec, rate, rate, runnable);
} | [
"public",
"static",
"void",
"scheduleAtFixedRate",
"(",
"ScheduledExecutorService",
"exec",
",",
"Duration",
"rate",
",",
"Runnable",
"runnable",
")",
"{",
"scheduleAtFixedRate",
"(",
"exec",
",",
"rate",
",",
"rate",
",",
"runnable",
")",
";",
"}"
] | Run runnable once every period. Exceptions are caught and logged as errors. | [
"Run",
"runnable",
"once",
"every",
"period",
".",
"Exceptions",
"are",
"caught",
"and",
"logged",
"as",
"errors",
"."
] | 9d204043da1136e94fb2e2d63e3543a29bf54b4d | https://github.com/metamx/java-util/blob/9d204043da1136e94fb2e2d63e3543a29bf54b4d/src/main/java/com/metamx/common/concurrent/ScheduledExecutors.java#L119-L122 |
37,121 | m-szalik/javamail | javamail-file-transport/src/main/java/org/jsoftware/javamail/AbstractTransport.java | AbstractTransport.validateAndPrepare | void validateAndPrepare(Message message, Address[] addresses) throws MessagingException {
if (message.getFrom() == null || message.getFrom().length == 0) {
fail(message, addresses, "No or empty FROM address set!");
}
if (addresses.length == 0) {
fail(message, addresses, "No RECIPIENTS set!");
}
Address[] messageAddresses = message.getAllRecipients();
if (messageAddresses == null) {
for(Address address : addresses) {
message.addRecipient(Message.RecipientType.TO, address);
}
} else {
out:
for(Address address : addresses) {
for(Address a : messageAddresses) {
if (a == null) {
continue;
}
if (a.equals(address)) {
continue out;
}
}
message.addRecipient(Message.RecipientType.TO, address);
}
}
} | java | void validateAndPrepare(Message message, Address[] addresses) throws MessagingException {
if (message.getFrom() == null || message.getFrom().length == 0) {
fail(message, addresses, "No or empty FROM address set!");
}
if (addresses.length == 0) {
fail(message, addresses, "No RECIPIENTS set!");
}
Address[] messageAddresses = message.getAllRecipients();
if (messageAddresses == null) {
for(Address address : addresses) {
message.addRecipient(Message.RecipientType.TO, address);
}
} else {
out:
for(Address address : addresses) {
for(Address a : messageAddresses) {
if (a == null) {
continue;
}
if (a.equals(address)) {
continue out;
}
}
message.addRecipient(Message.RecipientType.TO, address);
}
}
} | [
"void",
"validateAndPrepare",
"(",
"Message",
"message",
",",
"Address",
"[",
"]",
"addresses",
")",
"throws",
"MessagingException",
"{",
"if",
"(",
"message",
".",
"getFrom",
"(",
")",
"==",
"null",
"||",
"message",
".",
"getFrom",
"(",
")",
".",
"length"... | Validate FROM and RECIPIENTS
@param message message to validate
@param addresses addresses to be added into message if not duplicated
@throws MessagingException | [
"Validate",
"FROM",
"and",
"RECIPIENTS"
] | 4ab516d7c89687008b42af9defa8fdaa71a01aa7 | https://github.com/m-szalik/javamail/blob/4ab516d7c89687008b42af9defa8fdaa71a01aa7/javamail-file-transport/src/main/java/org/jsoftware/javamail/AbstractTransport.java#L59-L85 |
37,122 | m-szalik/javamail | javamail-file-transport/src/main/java/org/jsoftware/javamail/AbstractTransport.java | AbstractTransport.extractTextParts | static Map<String,Collection<String>> extractTextParts(Multipart multiPart) throws MessagingException, IOException {
HashMap<String,Collection<String>> bodies = new HashMap<>();
for(int i = 0; i < multiPart.getCount(); i++) {
checkPartForTextType(bodies, multiPart.getBodyPart(i));
}
return bodies;
} | java | static Map<String,Collection<String>> extractTextParts(Multipart multiPart) throws MessagingException, IOException {
HashMap<String,Collection<String>> bodies = new HashMap<>();
for(int i = 0; i < multiPart.getCount(); i++) {
checkPartForTextType(bodies, multiPart.getBodyPart(i));
}
return bodies;
} | [
"static",
"Map",
"<",
"String",
",",
"Collection",
"<",
"String",
">",
">",
"extractTextParts",
"(",
"Multipart",
"multiPart",
")",
"throws",
"MessagingException",
",",
"IOException",
"{",
"HashMap",
"<",
"String",
",",
"Collection",
"<",
"String",
">",
">",
... | Extract parts from Multi-part message.
@param multiPart multi-part to visit
@return map of part contentType -> part content
@throws MessagingException
@throws IOException | [
"Extract",
"parts",
"from",
"Multi",
"-",
"part",
"message",
"."
] | 4ab516d7c89687008b42af9defa8fdaa71a01aa7 | https://github.com/m-szalik/javamail/blob/4ab516d7c89687008b42af9defa8fdaa71a01aa7/javamail-file-transport/src/main/java/org/jsoftware/javamail/AbstractTransport.java#L94-L100 |
37,123 | m-szalik/javamail | javamail-file-transport/src/main/java/org/jsoftware/javamail/AbstractTransport.java | AbstractTransport.checkPartForTextType | private static void checkPartForTextType(HashMap<String, Collection<String>> bodies, Part part) throws IOException, MessagingException {
Object content = part.getContent();
if (content instanceof CharSequence) {
String ct = part.getContentType();
Collection<String> value = bodies.get(ct);
if (value != null) {
value.add(content.toString());
} else {
value = new LinkedList<>();
value.add(content.toString());
bodies.put(ct, value);
}
} else if (content instanceof Multipart) {
Multipart mp = (Multipart) content;
for(int i = 0; i < mp.getCount(); i++) {
checkPartForTextType(bodies, mp.getBodyPart(i));
}
}
} | java | private static void checkPartForTextType(HashMap<String, Collection<String>> bodies, Part part) throws IOException, MessagingException {
Object content = part.getContent();
if (content instanceof CharSequence) {
String ct = part.getContentType();
Collection<String> value = bodies.get(ct);
if (value != null) {
value.add(content.toString());
} else {
value = new LinkedList<>();
value.add(content.toString());
bodies.put(ct, value);
}
} else if (content instanceof Multipart) {
Multipart mp = (Multipart) content;
for(int i = 0; i < mp.getCount(); i++) {
checkPartForTextType(bodies, mp.getBodyPart(i));
}
}
} | [
"private",
"static",
"void",
"checkPartForTextType",
"(",
"HashMap",
"<",
"String",
",",
"Collection",
"<",
"String",
">",
">",
"bodies",
",",
"Part",
"part",
")",
"throws",
"IOException",
",",
"MessagingException",
"{",
"Object",
"content",
"=",
"part",
".",
... | Recursive find body parts and save them to HashMap | [
"Recursive",
"find",
"body",
"parts",
"and",
"save",
"them",
"to",
"HashMap"
] | 4ab516d7c89687008b42af9defa8fdaa71a01aa7 | https://github.com/m-szalik/javamail/blob/4ab516d7c89687008b42af9defa8fdaa71a01aa7/javamail-file-transport/src/main/java/org/jsoftware/javamail/AbstractTransport.java#L106-L124 |
37,124 | drapostolos/rdp4j | src/main/java/com/github/drapostolos/rdp4j/DirectoryPollerBuilder.java | DirectoryPollerBuilder.setPollingInterval | public DirectoryPollerBuilder setPollingInterval(long interval, TimeUnit timeUnit) {
if (interval < 0) {
throw new IllegalArgumentException("Argument 'interval' is negative: " + interval);
}
pollingIntervalInMillis = timeUnit.toMillis(interval);
return this;
} | java | public DirectoryPollerBuilder setPollingInterval(long interval, TimeUnit timeUnit) {
if (interval < 0) {
throw new IllegalArgumentException("Argument 'interval' is negative: " + interval);
}
pollingIntervalInMillis = timeUnit.toMillis(interval);
return this;
} | [
"public",
"DirectoryPollerBuilder",
"setPollingInterval",
"(",
"long",
"interval",
",",
"TimeUnit",
"timeUnit",
")",
"{",
"if",
"(",
"interval",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Argument 'interval' is negative: \"",
"+",
"interva... | Set the interval between each poll cycle. Optional parameter.
Default value is 1000 milliseconds.
@param interval - the interval between two poll-cycles.
@param timeUnit - the unit of the interval. Example: TimeUnit.MINUTES
@return {@link DirectoryPollerBuilder}
@throws IllegalArgumentException if <code>interval</code> is negative. | [
"Set",
"the",
"interval",
"between",
"each",
"poll",
"cycle",
".",
"Optional",
"parameter",
".",
"Default",
"value",
"is",
"1000",
"milliseconds",
"."
] | ec1db2444d245b7ccd6607182bb56a027fa66d6b | https://github.com/drapostolos/rdp4j/blob/ec1db2444d245b7ccd6607182bb56a027fa66d6b/src/main/java/com/github/drapostolos/rdp4j/DirectoryPollerBuilder.java#L95-L101 |
37,125 | lucmoreau/ProvToolbox | prov-sql/src/main/java/org/openprovenance/prov/sql/ActedOnBehalfOf.java | ActedOnBehalfOf.getDelegate | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "DELEGATE")
public org.openprovenance.prov.model.QualifiedName getDelegate() {
return delegate;
} | java | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "DELEGATE")
public org.openprovenance.prov.model.QualifiedName getDelegate() {
return delegate;
} | [
"@",
"ManyToOne",
"(",
"targetEntity",
"=",
"org",
".",
"openprovenance",
".",
"prov",
".",
"sql",
".",
"QualifiedName",
".",
"class",
",",
"cascade",
"=",
"{",
"CascadeType",
".",
"ALL",
"}",
")",
"@",
"JoinColumn",
"(",
"name",
"=",
"\"DELEGATE\"",
")"... | Gets the value of the delegate property.
@return
possible object is
{@link org.openprovenance.prov.sql.IDRef } | [
"Gets",
"the",
"value",
"of",
"the",
"delegate",
"property",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-sql/src/main/java/org/openprovenance/prov/sql/ActedOnBehalfOf.java#L107-L113 |
37,126 | lucmoreau/ProvToolbox | prov-sql/src/main/java/org/openprovenance/prov/sql/ActedOnBehalfOf.java | ActedOnBehalfOf.getResponsible | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "RESPONSIBLE")
public org.openprovenance.prov.model.QualifiedName getResponsible() {
return responsible;
} | java | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "RESPONSIBLE")
public org.openprovenance.prov.model.QualifiedName getResponsible() {
return responsible;
} | [
"@",
"ManyToOne",
"(",
"targetEntity",
"=",
"org",
".",
"openprovenance",
".",
"prov",
".",
"sql",
".",
"QualifiedName",
".",
"class",
",",
"cascade",
"=",
"{",
"CascadeType",
".",
"ALL",
"}",
")",
"@",
"JoinColumn",
"(",
"name",
"=",
"\"RESPONSIBLE\"",
... | Gets the value of the responsible property.
@return
possible object is
{@link org.openprovenance.prov.sql.IDRef } | [
"Gets",
"the",
"value",
"of",
"the",
"responsible",
"property",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-sql/src/main/java/org/openprovenance/prov/sql/ActedOnBehalfOf.java#L135-L141 |
37,127 | lucmoreau/ProvToolbox | prov-sql/src/main/java/org/openprovenance/prov/sql/ActedOnBehalfOf.java | ActedOnBehalfOf.getActivity | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "ACTIVITY")
public org.openprovenance.prov.model.QualifiedName getActivity() {
return activity;
} | java | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "ACTIVITY")
public org.openprovenance.prov.model.QualifiedName getActivity() {
return activity;
} | [
"@",
"ManyToOne",
"(",
"targetEntity",
"=",
"org",
".",
"openprovenance",
".",
"prov",
".",
"sql",
".",
"QualifiedName",
".",
"class",
",",
"cascade",
"=",
"{",
"CascadeType",
".",
"ALL",
"}",
")",
"@",
"JoinColumn",
"(",
"name",
"=",
"\"ACTIVITY\"",
")"... | Gets the value of the activity property.
@return
possible object is
{@link org.openprovenance.prov.sql.IDRef } | [
"Gets",
"the",
"value",
"of",
"the",
"activity",
"property",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-sql/src/main/java/org/openprovenance/prov/sql/ActedOnBehalfOf.java#L163-L169 |
37,128 | lucmoreau/ProvToolbox | prov-sql/src/main/java/org/openprovenance/prov/sql/WasAttributedTo.java | WasAttributedTo.getAgent | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "AGENT")
public org.openprovenance.prov.model.QualifiedName getAgent() {
return agent;
} | java | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "AGENT")
public org.openprovenance.prov.model.QualifiedName getAgent() {
return agent;
} | [
"@",
"ManyToOne",
"(",
"targetEntity",
"=",
"org",
".",
"openprovenance",
".",
"prov",
".",
"sql",
".",
"QualifiedName",
".",
"class",
",",
"cascade",
"=",
"{",
"CascadeType",
".",
"ALL",
"}",
")",
"@",
"JoinColumn",
"(",
"name",
"=",
"\"AGENT\"",
")",
... | Gets the value of the agent property.
@return
possible object is
{@link org.openprovenance.prov.sql.IDRef } | [
"Gets",
"the",
"value",
"of",
"the",
"agent",
"property",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-sql/src/main/java/org/openprovenance/prov/sql/WasAttributedTo.java#L131-L137 |
37,129 | lucmoreau/ProvToolbox | prov-sql/src/main/java/org/openprovenance/prov/sql/MentionOf.java | MentionOf.getSpecificEntity | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "SPECIFICENTITY_MENTIONOF_PK")
public org.openprovenance.prov.model.QualifiedName getSpecificEntity() {
return specificEntity;
} | java | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "SPECIFICENTITY_MENTIONOF_PK")
public org.openprovenance.prov.model.QualifiedName getSpecificEntity() {
return specificEntity;
} | [
"@",
"ManyToOne",
"(",
"targetEntity",
"=",
"org",
".",
"openprovenance",
".",
"prov",
".",
"sql",
".",
"QualifiedName",
".",
"class",
",",
"cascade",
"=",
"{",
"CascadeType",
".",
"ALL",
"}",
")",
"@",
"JoinColumn",
"(",
"name",
"=",
"\"SPECIFICENTITY_MEN... | Gets the value of the specificEntity property.
@return
possible object is
{@link org.openprovenance.prov.sql.IDRef } | [
"Gets",
"the",
"value",
"of",
"the",
"specificEntity",
"property",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-sql/src/main/java/org/openprovenance/prov/sql/MentionOf.java#L74-L80 |
37,130 | lucmoreau/ProvToolbox | prov-sql/src/main/java/org/openprovenance/prov/sql/MentionOf.java | MentionOf.getGeneralEntity | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "GENERALENTITY_MENTIONOF_PK")
public org.openprovenance.prov.model.QualifiedName getGeneralEntity() {
return generalEntity;
} | java | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "GENERALENTITY_MENTIONOF_PK")
public org.openprovenance.prov.model.QualifiedName getGeneralEntity() {
return generalEntity;
} | [
"@",
"ManyToOne",
"(",
"targetEntity",
"=",
"org",
".",
"openprovenance",
".",
"prov",
".",
"sql",
".",
"QualifiedName",
".",
"class",
",",
"cascade",
"=",
"{",
"CascadeType",
".",
"ALL",
"}",
")",
"@",
"JoinColumn",
"(",
"name",
"=",
"\"GENERALENTITY_MENT... | Gets the value of the generalEntity property.
@return
possible object is
{@link org.openprovenance.prov.sql.IDRef } | [
"Gets",
"the",
"value",
"of",
"the",
"generalEntity",
"property",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-sql/src/main/java/org/openprovenance/prov/sql/MentionOf.java#L102-L108 |
37,131 | lucmoreau/ProvToolbox | prov-sql/src/main/java/org/openprovenance/prov/sql/MentionOf.java | MentionOf.getBundle | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "BUNDLE")
public org.openprovenance.prov.model.QualifiedName getBundle() {
return bundle;
} | java | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "BUNDLE")
public org.openprovenance.prov.model.QualifiedName getBundle() {
return bundle;
} | [
"@",
"ManyToOne",
"(",
"targetEntity",
"=",
"org",
".",
"openprovenance",
".",
"prov",
".",
"sql",
".",
"QualifiedName",
".",
"class",
",",
"cascade",
"=",
"{",
"CascadeType",
".",
"ALL",
"}",
")",
"@",
"JoinColumn",
"(",
"name",
"=",
"\"BUNDLE\"",
")",
... | Gets the value of the bundle property.
@return
possible object is
{@link org.openprovenance.prov.sql.IDRef } | [
"Gets",
"the",
"value",
"of",
"the",
"bundle",
"property",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-sql/src/main/java/org/openprovenance/prov/sql/MentionOf.java#L130-L136 |
37,132 | lucmoreau/ProvToolbox | prov-interop/src/main/java/org/openprovenance/prov/interop/InteropFramework.java | InteropFramework.buildAcceptHeader | public String buildAcceptHeader() {
StringBuffer mimetypes = new StringBuffer();
Enumeration<ProvFormat> e = mimeTypeMap.keys();
String sep = "";
while (e.hasMoreElements()) {
ProvFormat f = e.nextElement();
if (isInputFormat(f)) {
// careful - cant use .hasMoreElements as we are filtering
mimetypes.append(sep);
sep = ",";
mimetypes.append(mimeTypeMap.get(f));
}
}
mimetypes.append(sep);
mimetypes.append("*/*;q=0.1"); // be liberal
return mimetypes.toString();
} | java | public String buildAcceptHeader() {
StringBuffer mimetypes = new StringBuffer();
Enumeration<ProvFormat> e = mimeTypeMap.keys();
String sep = "";
while (e.hasMoreElements()) {
ProvFormat f = e.nextElement();
if (isInputFormat(f)) {
// careful - cant use .hasMoreElements as we are filtering
mimetypes.append(sep);
sep = ",";
mimetypes.append(mimeTypeMap.get(f));
}
}
mimetypes.append(sep);
mimetypes.append("*/*;q=0.1"); // be liberal
return mimetypes.toString();
} | [
"public",
"String",
"buildAcceptHeader",
"(",
")",
"{",
"StringBuffer",
"mimetypes",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"Enumeration",
"<",
"ProvFormat",
">",
"e",
"=",
"mimeTypeMap",
".",
"keys",
"(",
")",
";",
"String",
"sep",
"=",
"\"\"",
";",
... | Create a list of mime types supported by ProvToolbox in view of constructing an Accept Header.
@return a string representing the mime types. | [
"Create",
"a",
"list",
"of",
"mime",
"types",
"supported",
"by",
"ProvToolbox",
"in",
"view",
"of",
"constructing",
"an",
"Accept",
"Header",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-interop/src/main/java/org/openprovenance/prov/interop/InteropFramework.java#L175-L192 |
37,133 | lucmoreau/ProvToolbox | prov-interop/src/main/java/org/openprovenance/prov/interop/InteropFramework.java | InteropFramework.connectWithRedirect | public URLConnection connectWithRedirect(URL theURL) throws IOException {
URLConnection conn = null;
String accept_header = buildAcceptHeader();
int redirect_count = 0;
boolean done = false;
while (!done) {
if (theURL.getProtocol().equals("file")) {
return null;
}
Boolean isHttp = (theURL.getProtocol().equals("http") || theURL
.getProtocol().equals("https"));
logger.debug("Requesting: " + theURL.toString());
conn = theURL.openConnection();
if (isHttp) {
logger.debug("Accept: " + accept_header);
conn.setRequestProperty("Accept", accept_header);
}
conn.setConnectTimeout(60000);
conn.setReadTimeout(60000);
conn.connect();
done = true; // by default quit after one request
if (isHttp) {
logger.debug("Response: " + conn.getHeaderField(0));
int rc = ((HttpURLConnection) conn).getResponseCode();
if ((rc == HttpURLConnection.HTTP_MOVED_PERM)
|| (rc == HttpURLConnection.HTTP_MOVED_TEMP)
|| (rc == HttpURLConnection.HTTP_SEE_OTHER)
|| (rc == 307)) {
if (redirect_count > 10) {
return null; // Error: too many redirects
}
redirect_count++;
String loc = conn.getHeaderField("Location");
if (loc != null) {
theURL = new URL(loc);
done = false;
} else {
return null; // Bad redirect
}
} else if ((rc < 200) || (rc >= 300)) {
return null; // Unsuccessful
}
}
}
return conn;
} | java | public URLConnection connectWithRedirect(URL theURL) throws IOException {
URLConnection conn = null;
String accept_header = buildAcceptHeader();
int redirect_count = 0;
boolean done = false;
while (!done) {
if (theURL.getProtocol().equals("file")) {
return null;
}
Boolean isHttp = (theURL.getProtocol().equals("http") || theURL
.getProtocol().equals("https"));
logger.debug("Requesting: " + theURL.toString());
conn = theURL.openConnection();
if (isHttp) {
logger.debug("Accept: " + accept_header);
conn.setRequestProperty("Accept", accept_header);
}
conn.setConnectTimeout(60000);
conn.setReadTimeout(60000);
conn.connect();
done = true; // by default quit after one request
if (isHttp) {
logger.debug("Response: " + conn.getHeaderField(0));
int rc = ((HttpURLConnection) conn).getResponseCode();
if ((rc == HttpURLConnection.HTTP_MOVED_PERM)
|| (rc == HttpURLConnection.HTTP_MOVED_TEMP)
|| (rc == HttpURLConnection.HTTP_SEE_OTHER)
|| (rc == 307)) {
if (redirect_count > 10) {
return null; // Error: too many redirects
}
redirect_count++;
String loc = conn.getHeaderField("Location");
if (loc != null) {
theURL = new URL(loc);
done = false;
} else {
return null; // Bad redirect
}
} else if ((rc < 200) || (rc >= 300)) {
return null; // Unsuccessful
}
}
}
return conn;
} | [
"public",
"URLConnection",
"connectWithRedirect",
"(",
"URL",
"theURL",
")",
"throws",
"IOException",
"{",
"URLConnection",
"conn",
"=",
"null",
";",
"String",
"accept_header",
"=",
"buildAcceptHeader",
"(",
")",
";",
"int",
"redirect_count",
"=",
"0",
";",
"boo... | A method to connect to a URL and follow redirects if any.
@param theURL a URL to connect to
@return a {@link URLConnection}
@throws IOException if connection cannot be opened and no response is received. | [
"A",
"method",
"to",
"connect",
"to",
"a",
"URL",
"and",
"follow",
"redirects",
"if",
"any",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-interop/src/main/java/org/openprovenance/prov/interop/InteropFramework.java#L200-L255 |
37,134 | lucmoreau/ProvToolbox | prov-interop/src/main/java/org/openprovenance/prov/interop/InteropFramework.java | InteropFramework.convertExtensionToMediaType | public String convertExtensionToMediaType(String extension) {
ProvFormat format = extensionRevMap.get(extension);
if (format == null)
return null;
return mimeTypeMap.get(format);
} | java | public String convertExtensionToMediaType(String extension) {
ProvFormat format = extensionRevMap.get(extension);
if (format == null)
return null;
return mimeTypeMap.get(format);
} | [
"public",
"String",
"convertExtensionToMediaType",
"(",
"String",
"extension",
")",
"{",
"ProvFormat",
"format",
"=",
"extensionRevMap",
".",
"get",
"(",
"extension",
")",
";",
"if",
"(",
"format",
"==",
"null",
")",
"return",
"null",
";",
"return",
"mimeTypeM... | Maps an file extension to a Media type
@param extension the extension of a file containing a serialization of PROV
@return a String for the Internet Media type corresponding to a file with this extension | [
"Maps",
"an",
"file",
"extension",
"to",
"a",
"Media",
"type"
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-interop/src/main/java/org/openprovenance/prov/interop/InteropFramework.java#L264-L269 |
37,135 | lucmoreau/ProvToolbox | prov-interop/src/main/java/org/openprovenance/prov/interop/InteropFramework.java | InteropFramework.getExtension | public String getExtension(ProvFormat format) {
String extension = UNKNOWN;
if (format != null) {
extension = extensionMap.get(format);
}
return extension;
} | java | public String getExtension(ProvFormat format) {
String extension = UNKNOWN;
if (format != null) {
extension = extensionMap.get(format);
}
return extension;
} | [
"public",
"String",
"getExtension",
"(",
"ProvFormat",
"format",
")",
"{",
"String",
"extension",
"=",
"UNKNOWN",
";",
"if",
"(",
"format",
"!=",
"null",
")",
"{",
"extension",
"=",
"extensionMap",
".",
"get",
"(",
"format",
")",
";",
"}",
"return",
"ext... | Returns an extension for a given type of serialization of PROV
@param format {@link ProvFormat} for which file extension is sought
@return a String for the extension of a file containing such a serialization | [
"Returns",
"an",
"extension",
"for",
"a",
"given",
"type",
"of",
"serialization",
"of",
"PROV"
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-interop/src/main/java/org/openprovenance/prov/interop/InteropFramework.java#L275-L281 |
37,136 | lucmoreau/ProvToolbox | prov-interop/src/main/java/org/openprovenance/prov/interop/InteropFramework.java | InteropFramework.getOption | String getOption(String[] options, int index) {
if ((options != null) && (options.length > index)) {
return options[index];
}
return null;
} | java | String getOption(String[] options, int index) {
if ((options != null) && (options.length > index)) {
return options[index];
}
return null;
} | [
"String",
"getOption",
"(",
"String",
"[",
"]",
"options",
",",
"int",
"index",
")",
"{",
"if",
"(",
"(",
"options",
"!=",
"null",
")",
"&&",
"(",
"options",
".",
"length",
">",
"index",
")",
")",
"{",
"return",
"options",
"[",
"index",
"]",
";",
... | Returns an option at given index in an array of options, or null
@param options an array of Strings
@param index position of the option that is sought
@return the option or null | [
"Returns",
"an",
"option",
"at",
"given",
"index",
"in",
"an",
"array",
"of",
"options",
"or",
"null"
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-interop/src/main/java/org/openprovenance/prov/interop/InteropFramework.java#L289-L294 |
37,137 | lucmoreau/ProvToolbox | prov-interop/src/main/java/org/openprovenance/prov/interop/InteropFramework.java | InteropFramework.getVariants | public List<Variant> getVariants() {
List<Variant> vs = new ArrayList<Variant>();
for (Map.Entry<String, ProvFormat> entry : mimeTypeRevMap.entrySet()) {
if (isOutputFormat(entry.getValue())) {
String[] parts = entry.getKey().split("/");
MediaType m = new MediaType(parts[0], parts[1]);
vs.add(new Variant(m, (java.util.Locale) null, (String) null));
}
}
return vs;
} | java | public List<Variant> getVariants() {
List<Variant> vs = new ArrayList<Variant>();
for (Map.Entry<String, ProvFormat> entry : mimeTypeRevMap.entrySet()) {
if (isOutputFormat(entry.getValue())) {
String[] parts = entry.getKey().split("/");
MediaType m = new MediaType(parts[0], parts[1]);
vs.add(new Variant(m, (java.util.Locale) null, (String) null));
}
}
return vs;
} | [
"public",
"List",
"<",
"Variant",
">",
"getVariants",
"(",
")",
"{",
"List",
"<",
"Variant",
">",
"vs",
"=",
"new",
"ArrayList",
"<",
"Variant",
">",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"ProvFormat",
">",
"entry",
":... | Support for content negotiation, jax-rs style. Create a list of media
type supported by the framework.
@see <a href="http://docs.oracle.com/javaee/6/tutorial/doc/gkqbq.html">Content Negotiation</a> | [
"Support",
"for",
"content",
"negotiation",
"jax",
"-",
"rs",
"style",
".",
"Create",
"a",
"list",
"of",
"media",
"type",
"supported",
"by",
"the",
"framework",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-interop/src/main/java/org/openprovenance/prov/interop/InteropFramework.java#L329-L339 |
37,138 | lucmoreau/ProvToolbox | prov-interop/src/main/java/org/openprovenance/prov/interop/InteropFramework.java | InteropFramework.isInputFormat | public Boolean isInputFormat(ProvFormat format) {
ProvFormatType t = provTypeMap.get(format);
return (t.equals(ProvFormatType.INPUT) ||
t.equals(ProvFormatType.INPUTOUTPUT));
} | java | public Boolean isInputFormat(ProvFormat format) {
ProvFormatType t = provTypeMap.get(format);
return (t.equals(ProvFormatType.INPUT) ||
t.equals(ProvFormatType.INPUTOUTPUT));
} | [
"public",
"Boolean",
"isInputFormat",
"(",
"ProvFormat",
"format",
")",
"{",
"ProvFormatType",
"t",
"=",
"provTypeMap",
".",
"get",
"(",
"format",
")",
";",
"return",
"(",
"t",
".",
"equals",
"(",
"ProvFormatType",
".",
"INPUT",
")",
"||",
"t",
".",
"equ... | Determines whether this format received as argument is an input format.
@param format a {@link ProvFormat}
@return true if format is an input format | [
"Determines",
"whether",
"this",
"format",
"received",
"as",
"argument",
"is",
"an",
"input",
"format",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-interop/src/main/java/org/openprovenance/prov/interop/InteropFramework.java#L450-L454 |
37,139 | lucmoreau/ProvToolbox | prov-interop/src/main/java/org/openprovenance/prov/interop/InteropFramework.java | InteropFramework.isOutputFormat | public Boolean isOutputFormat(ProvFormat format) {
ProvFormatType t = provTypeMap.get(format);
return (t.equals(ProvFormatType.OUTPUT) ||
t.equals(ProvFormatType.INPUTOUTPUT));
} | java | public Boolean isOutputFormat(ProvFormat format) {
ProvFormatType t = provTypeMap.get(format);
return (t.equals(ProvFormatType.OUTPUT) ||
t.equals(ProvFormatType.INPUTOUTPUT));
} | [
"public",
"Boolean",
"isOutputFormat",
"(",
"ProvFormat",
"format",
")",
"{",
"ProvFormatType",
"t",
"=",
"provTypeMap",
".",
"get",
"(",
"format",
")",
";",
"return",
"(",
"t",
".",
"equals",
"(",
"ProvFormatType",
".",
"OUTPUT",
")",
"||",
"t",
".",
"e... | Determines whether this format received as argument is an output format.
@param format a {@link ProvFormat}
@return true if format is an output format | [
"Determines",
"whether",
"this",
"format",
"received",
"as",
"argument",
"is",
"an",
"output",
"format",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-interop/src/main/java/org/openprovenance/prov/interop/InteropFramework.java#L462-L466 |
37,140 | lucmoreau/ProvToolbox | prov-interop/src/main/java/org/openprovenance/prov/interop/InteropFramework.java | InteropFramework.loadProvUnknownGraph | public Object loadProvUnknownGraph(String filename) {
try {
Utility u = new Utility();
CommonTree tree = u.convertASNToTree(filename);
Object o = u.convertTreeToJavaBean(tree, pFactory);
if (o != null) {
return o;
}
} catch (RecognitionException t1) {
// OK, we failed, let's try next format.
} catch (IOException e) {
// OK, we failed, let's try next format.
}
try {
File in = new File(filename);
ProvDeserialiser deserial = ProvDeserialiser
.getThreadProvDeserialiser();
Document c = deserial.deserialiseDocument(in);
if (c != null) {
return c;
}
} catch (JAXBException t2) {
// OK, we failed, let's try next format.
}
try {
Document o = new org.openprovenance.prov.json.Converter(pFactory)
.readDocument(filename);
if (o != null) {
return o;
}
} catch (IOException e) {
// OK, we failed, let's try next format.
}
try {
org.openprovenance.prov.rdf.Utility rdfU = new org.openprovenance.prov.rdf.Utility(
pFactory, onto);
Document doc = rdfU.parseRDF(filename);
if (doc != null) {
return doc;
}
} catch (RDFParseException e) {
} catch (RDFHandlerException e) {
} catch (IOException e) {
} catch (JAXBException e) {
}
System.out.println("Unparseable format " + filename);
throw new UnsupportedOperationException();
} | java | public Object loadProvUnknownGraph(String filename) {
try {
Utility u = new Utility();
CommonTree tree = u.convertASNToTree(filename);
Object o = u.convertTreeToJavaBean(tree, pFactory);
if (o != null) {
return o;
}
} catch (RecognitionException t1) {
// OK, we failed, let's try next format.
} catch (IOException e) {
// OK, we failed, let's try next format.
}
try {
File in = new File(filename);
ProvDeserialiser deserial = ProvDeserialiser
.getThreadProvDeserialiser();
Document c = deserial.deserialiseDocument(in);
if (c != null) {
return c;
}
} catch (JAXBException t2) {
// OK, we failed, let's try next format.
}
try {
Document o = new org.openprovenance.prov.json.Converter(pFactory)
.readDocument(filename);
if (o != null) {
return o;
}
} catch (IOException e) {
// OK, we failed, let's try next format.
}
try {
org.openprovenance.prov.rdf.Utility rdfU = new org.openprovenance.prov.rdf.Utility(
pFactory, onto);
Document doc = rdfU.parseRDF(filename);
if (doc != null) {
return doc;
}
} catch (RDFParseException e) {
} catch (RDFHandlerException e) {
} catch (IOException e) {
} catch (JAXBException e) {
}
System.out.println("Unparseable format " + filename);
throw new UnsupportedOperationException();
} | [
"public",
"Object",
"loadProvUnknownGraph",
"(",
"String",
"filename",
")",
"{",
"try",
"{",
"Utility",
"u",
"=",
"new",
"Utility",
"(",
")",
";",
"CommonTree",
"tree",
"=",
"u",
".",
"convertASNToTree",
"(",
"filename",
")",
";",
"Object",
"o",
"=",
"u"... | Experimental code, trying to load a document without knowing its serialization format.
First parser that succeeds returns a results. Not a robust method!
@param filename a file to load the provenance document from
@return a document | [
"Experimental",
"code",
"trying",
"to",
"load",
"a",
"document",
"without",
"knowing",
"its",
"serialization",
"format",
".",
"First",
"parser",
"that",
"succeeds",
"returns",
"a",
"results",
".",
"Not",
"a",
"robust",
"method!"
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-interop/src/main/java/org/openprovenance/prov/interop/InteropFramework.java#L474-L525 |
37,141 | lucmoreau/ProvToolbox | prov-interop/src/main/java/org/openprovenance/prov/interop/InteropFramework.java | InteropFramework.readDocument | public Document readDocument(String url) {
try {
URL theURL = new URL(url);
URLConnection conn = connectWithRedirect(theURL);
if (conn == null)
return null;
ProvFormat format = null;
String content_type = conn.getContentType();
logger.debug("Content-type: " + content_type);
if (content_type != null) {
// Need to trim optional parameters
// Content-Type: text/plain; charset=UTF-8
int end = content_type.indexOf(";");
if (end < 0) {
end = content_type.length();
}
String actual_content_type = content_type.substring(0, end)
.trim();
logger.debug("Found Content-type: " + actual_content_type);
// TODO: might be worth skipping if text/plain as that seems
// to be the
// default returned by unconfigured web servers
format = mimeTypeRevMap.get(actual_content_type);
}
logger.debug("Format after Content-type: " + format);
if (format == null) {
format = getTypeForFile(theURL.toString());
}
logger.debug("Format after extension: " + format);
InputStream content_stream = conn.getInputStream();
return readDocument(content_stream, format,url);
} catch (IOException e) {
throw new InteropException(e);
}
} | java | public Document readDocument(String url) {
try {
URL theURL = new URL(url);
URLConnection conn = connectWithRedirect(theURL);
if (conn == null)
return null;
ProvFormat format = null;
String content_type = conn.getContentType();
logger.debug("Content-type: " + content_type);
if (content_type != null) {
// Need to trim optional parameters
// Content-Type: text/plain; charset=UTF-8
int end = content_type.indexOf(";");
if (end < 0) {
end = content_type.length();
}
String actual_content_type = content_type.substring(0, end)
.trim();
logger.debug("Found Content-type: " + actual_content_type);
// TODO: might be worth skipping if text/plain as that seems
// to be the
// default returned by unconfigured web servers
format = mimeTypeRevMap.get(actual_content_type);
}
logger.debug("Format after Content-type: " + format);
if (format == null) {
format = getTypeForFile(theURL.toString());
}
logger.debug("Format after extension: " + format);
InputStream content_stream = conn.getInputStream();
return readDocument(content_stream, format,url);
} catch (IOException e) {
throw new InteropException(e);
}
} | [
"public",
"Document",
"readDocument",
"(",
"String",
"url",
")",
"{",
"try",
"{",
"URL",
"theURL",
"=",
"new",
"URL",
"(",
"url",
")",
";",
"URLConnection",
"conn",
"=",
"connectWithRedirect",
"(",
"theURL",
")",
";",
"if",
"(",
"conn",
"==",
"null",
"... | Reads a document from a URL. Uses the Content-type header field to determine the
mime-type of the resource, and therefore the parser to read the document.
@param url a URL
@return a Document | [
"Reads",
"a",
"document",
"from",
"a",
"URL",
".",
"Uses",
"the",
"Content",
"-",
"type",
"header",
"field",
"to",
"determine",
"the",
"mime",
"-",
"type",
"of",
"the",
"resource",
"and",
"therefore",
"the",
"parser",
"to",
"read",
"the",
"document",
"."... | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-interop/src/main/java/org/openprovenance/prov/interop/InteropFramework.java#L638-L677 |
37,142 | lucmoreau/ProvToolbox | prov-interop/src/main/java/org/openprovenance/prov/interop/InteropFramework.java | InteropFramework.readDocumentFromFile | public Document readDocumentFromFile(String filename) {
ProvFormat format = getTypeForFile(filename);
if (format == null) {
throw new InteropException("Unknown output file format: "
+ filename);
}
return readDocumentFromFile(filename, format);
} | java | public Document readDocumentFromFile(String filename) {
ProvFormat format = getTypeForFile(filename);
if (format == null) {
throw new InteropException("Unknown output file format: "
+ filename);
}
return readDocumentFromFile(filename, format);
} | [
"public",
"Document",
"readDocumentFromFile",
"(",
"String",
"filename",
")",
"{",
"ProvFormat",
"format",
"=",
"getTypeForFile",
"(",
"filename",
")",
";",
"if",
"(",
"format",
"==",
"null",
")",
"{",
"throw",
"new",
"InteropException",
"(",
"\"Unknown output f... | Reads a document from a file, using the file extension to decide which parser to read the file with.
@param filename the file to read a document from
@return a Document | [
"Reads",
"a",
"document",
"from",
"a",
"file",
"using",
"the",
"file",
"extension",
"to",
"decide",
"which",
"parser",
"to",
"read",
"the",
"file",
"with",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-interop/src/main/java/org/openprovenance/prov/interop/InteropFramework.java#L685-L693 |
37,143 | lucmoreau/ProvToolbox | prov-interop/src/main/java/org/openprovenance/prov/interop/InteropFramework.java | InteropFramework.readDocumentFromFile | public Document readDocumentFromFile(String filename, ProvFormat format) {
try {
switch (format) {
case DOT:
case JPEG:
case PNG:
case SVG:
throw new UnsupportedOperationException(); // we don't load PROV
// from these
// formats
case JSON: {
return new org.openprovenance.prov.json.Converter(pFactory)
.readDocument(filename);
}
case PROVN: {
Utility u = new Utility();
CommonTree tree = u.convertASNToTree(filename);
Object o = u.convertTreeToJavaBean(tree, pFactory);
Document doc = (Document) o;
// Namespace ns=Namespace.gatherNamespaces(doc);
// doc.setNamespace(ns);
return doc;
}
case RDFXML:
case TRIG:
case TURTLE: {
org.openprovenance.prov.rdf.Utility rdfU = new org.openprovenance.prov.rdf.Utility(
pFactory, onto);
Document doc = rdfU.parseRDF(filename);
return doc;
}
case XML: {
File in = new File(filename);
ProvDeserialiser deserial = ProvDeserialiser
.getThreadProvDeserialiser();
Document doc = deserial.deserialiseDocument(in);
return doc;
}
default: {
System.out.println("Unknown format " + filename);
throw new UnsupportedOperationException();
}
}
} catch (IOException e) {
throw new InteropException(e);
} catch (RDFParseException e) {
throw new InteropException(e);
} catch (RDFHandlerException e) {
throw new InteropException(e);
} catch (JAXBException e) {
throw new InteropException(e);
} catch (RecognitionException e) {
throw new InteropException(e);
}
} | java | public Document readDocumentFromFile(String filename, ProvFormat format) {
try {
switch (format) {
case DOT:
case JPEG:
case PNG:
case SVG:
throw new UnsupportedOperationException(); // we don't load PROV
// from these
// formats
case JSON: {
return new org.openprovenance.prov.json.Converter(pFactory)
.readDocument(filename);
}
case PROVN: {
Utility u = new Utility();
CommonTree tree = u.convertASNToTree(filename);
Object o = u.convertTreeToJavaBean(tree, pFactory);
Document doc = (Document) o;
// Namespace ns=Namespace.gatherNamespaces(doc);
// doc.setNamespace(ns);
return doc;
}
case RDFXML:
case TRIG:
case TURTLE: {
org.openprovenance.prov.rdf.Utility rdfU = new org.openprovenance.prov.rdf.Utility(
pFactory, onto);
Document doc = rdfU.parseRDF(filename);
return doc;
}
case XML: {
File in = new File(filename);
ProvDeserialiser deserial = ProvDeserialiser
.getThreadProvDeserialiser();
Document doc = deserial.deserialiseDocument(in);
return doc;
}
default: {
System.out.println("Unknown format " + filename);
throw new UnsupportedOperationException();
}
}
} catch (IOException e) {
throw new InteropException(e);
} catch (RDFParseException e) {
throw new InteropException(e);
} catch (RDFHandlerException e) {
throw new InteropException(e);
} catch (JAXBException e) {
throw new InteropException(e);
} catch (RecognitionException e) {
throw new InteropException(e);
}
} | [
"public",
"Document",
"readDocumentFromFile",
"(",
"String",
"filename",
",",
"ProvFormat",
"format",
")",
"{",
"try",
"{",
"switch",
"(",
"format",
")",
"{",
"case",
"DOT",
":",
"case",
"JPEG",
":",
"case",
"PNG",
":",
"case",
"SVG",
":",
"throw",
"new"... | Reads a document from a file, using the format to decide which parser to read the file with.
@param filename the file to read a document from
@param format the format of the file
@return a Document | [
"Reads",
"a",
"document",
"from",
"a",
"file",
"using",
"the",
"format",
"to",
"decide",
"which",
"parser",
"to",
"read",
"the",
"file",
"with",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-interop/src/main/java/org/openprovenance/prov/interop/InteropFramework.java#L701-L758 |
37,144 | lucmoreau/ProvToolbox | prov-sql/src/main/java/org/openprovenance/prov/sql/DerivedByInsertionFrom.java | DerivedByInsertionFrom.getOther | public List<org.openprovenance.prov.model.Other> getOther() {
if (other == null) {
other = new ArrayList<org.openprovenance.prov.model.Other>();
}
return this.other;
} | java | public List<org.openprovenance.prov.model.Other> getOther() {
if (other == null) {
other = new ArrayList<org.openprovenance.prov.model.Other>();
}
return this.other;
} | [
"public",
"List",
"<",
"org",
".",
"openprovenance",
".",
"prov",
".",
"model",
".",
"Other",
">",
"getOther",
"(",
")",
"{",
"if",
"(",
"other",
"==",
"null",
")",
"{",
"other",
"=",
"new",
"ArrayList",
"<",
"org",
".",
"openprovenance",
".",
"prov"... | Gets the value of the other 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 others property.
<p>
For example, to add a new item, do as follows:
<pre>
getOthers().add(newItem);
</pre>
<p>
Objects of the following type(s) are allowed in the list
{@link Other } | [
"Gets",
"the",
"value",
"of",
"the",
"other",
"property",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-sql/src/main/java/org/openprovenance/prov/sql/DerivedByInsertionFrom.java#L270-L275 |
37,145 | lucmoreau/ProvToolbox | prov-sql/src/main/java/org/openprovenance/prov/sql/DictionaryMembership.java | DictionaryMembership.getDictionary | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "DICTIONARY__DICTIONARYMEMBER_0")
public org.openprovenance.prov.model.QualifiedName getDictionary() {
return dictionary;
} | java | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "DICTIONARY__DICTIONARYMEMBER_0")
public org.openprovenance.prov.model.QualifiedName getDictionary() {
return dictionary;
} | [
"@",
"ManyToOne",
"(",
"targetEntity",
"=",
"org",
".",
"openprovenance",
".",
"prov",
".",
"sql",
".",
"QualifiedName",
".",
"class",
",",
"cascade",
"=",
"{",
"CascadeType",
".",
"ALL",
"}",
")",
"@",
"JoinColumn",
"(",
"name",
"=",
"\"DICTIONARY__DICTIO... | Gets the value of the dictionary property.
@return
possible object is
{@link org.openprovenance.prov.sql.IDRef } | [
"Gets",
"the",
"value",
"of",
"the",
"dictionary",
"property",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-sql/src/main/java/org/openprovenance/prov/sql/DictionaryMembership.java#L72-L78 |
37,146 | lucmoreau/ProvToolbox | prov-sql/src/main/java/org/openprovenance/prov/sql/DictionaryMembership.java | DictionaryMembership.getKeyEntityPair | @Transient
public List<org.openprovenance.prov.model.Entry> getKeyEntityPair() {
if (keyEntityPair == null) {
keyEntityPair = new ArrayList<org.openprovenance.prov.model.Entry>();
}
return this.keyEntityPair;
} | java | @Transient
public List<org.openprovenance.prov.model.Entry> getKeyEntityPair() {
if (keyEntityPair == null) {
keyEntityPair = new ArrayList<org.openprovenance.prov.model.Entry>();
}
return this.keyEntityPair;
} | [
"@",
"Transient",
"public",
"List",
"<",
"org",
".",
"openprovenance",
".",
"prov",
".",
"model",
".",
"Entry",
">",
"getKeyEntityPair",
"(",
")",
"{",
"if",
"(",
"keyEntityPair",
"==",
"null",
")",
"{",
"keyEntityPair",
"=",
"new",
"ArrayList",
"<",
"or... | Gets the value of the keyEntityPair 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 keyEntityPair property.
<p>
For example, to add a new item, do as follows:
<pre>
getKeyEntityPair().add(newItem);
</pre>
<p>
Objects of the following type(s) are allowed in the list
{@link org.openprovenance.prov.sql.Entry } | [
"Gets",
"the",
"value",
"of",
"the",
"keyEntityPair",
"property",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-sql/src/main/java/org/openprovenance/prov/sql/DictionaryMembership.java#L114-L120 |
37,147 | lucmoreau/ProvToolbox | prov-rdf/src/main/java/org/openprovenance/prov/rdf/collector/RdfCollector.java | RdfCollector.valueToKey | protected Key valueToKey(Value value) {
if (value instanceof Resource) {
return pFactory.newKey(convertResourceToQualifiedName((Resource) value),
name.PROV_QUALIFIED_NAME);
} else if (value instanceof Literal) {
Literal lit=(Literal) value;
QualifiedName type;
QualifiedName xsdtype;
if (lit.getDatatype()!=null) {
xsdtype= convertURIToQualifiedName(lit.getDatatype());
} else {
xsdtype=name.PROV_LANG_STRING;
}
Object o=decodeLiteral(lit);
if (o instanceof QualifiedName) {
return pFactory.newKey(o, name.PROV_QUALIFIED_NAME);
}
// Was old code, relying on converter
//return pFactory.newKey(o, this.valueConverter.getXsdType(o));
return pFactory.newKey(o, xsdtype);
} else if (value instanceof URI) {
URI uri = (URI) (value);
return pFactory.newKey(uri.toString(), name.PROV_QUALIFIED_NAME);
} else if (value instanceof BNode) {
return pFactory.newKey(bnodeToQualifiedName((BNode)value),
name.PROV_QUALIFIED_NAME);
} else {
return null;
}
} | java | protected Key valueToKey(Value value) {
if (value instanceof Resource) {
return pFactory.newKey(convertResourceToQualifiedName((Resource) value),
name.PROV_QUALIFIED_NAME);
} else if (value instanceof Literal) {
Literal lit=(Literal) value;
QualifiedName type;
QualifiedName xsdtype;
if (lit.getDatatype()!=null) {
xsdtype= convertURIToQualifiedName(lit.getDatatype());
} else {
xsdtype=name.PROV_LANG_STRING;
}
Object o=decodeLiteral(lit);
if (o instanceof QualifiedName) {
return pFactory.newKey(o, name.PROV_QUALIFIED_NAME);
}
// Was old code, relying on converter
//return pFactory.newKey(o, this.valueConverter.getXsdType(o));
return pFactory.newKey(o, xsdtype);
} else if (value instanceof URI) {
URI uri = (URI) (value);
return pFactory.newKey(uri.toString(), name.PROV_QUALIFIED_NAME);
} else if (value instanceof BNode) {
return pFactory.newKey(bnodeToQualifiedName((BNode)value),
name.PROV_QUALIFIED_NAME);
} else {
return null;
}
} | [
"protected",
"Key",
"valueToKey",
"(",
"Value",
"value",
")",
"{",
"if",
"(",
"value",
"instanceof",
"Resource",
")",
"{",
"return",
"pFactory",
".",
"newKey",
"(",
"convertResourceToQualifiedName",
"(",
"(",
"Resource",
")",
"value",
")",
",",
"name",
".",
... | code replicated from valueToObject | [
"code",
"replicated",
"from",
"valueToObject"
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-rdf/src/main/java/org/openprovenance/prov/rdf/collector/RdfCollector.java#L281-L312 |
37,148 | lucmoreau/ProvToolbox | prov-sql/src/main/java/org/openprovenance/prov/sql/HadMember.java | HadMember.getCollection | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "COLLECTION")
public org.openprovenance.prov.model.QualifiedName getCollection() {
return collection;
} | java | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "COLLECTION")
public org.openprovenance.prov.model.QualifiedName getCollection() {
return collection;
} | [
"@",
"ManyToOne",
"(",
"targetEntity",
"=",
"org",
".",
"openprovenance",
".",
"prov",
".",
"sql",
".",
"QualifiedName",
".",
"class",
",",
"cascade",
"=",
"{",
"CascadeType",
".",
"ALL",
"}",
")",
"@",
"JoinColumn",
"(",
"name",
"=",
"\"COLLECTION\"",
"... | Gets the value of the collection property.
@return
possible object is
{@link org.openprovenance.prov.sql.IDRef } | [
"Gets",
"the",
"value",
"of",
"the",
"collection",
"property",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-sql/src/main/java/org/openprovenance/prov/sql/HadMember.java#L73-L79 |
37,149 | lucmoreau/ProvToolbox | prov-sql/src/main/java/org/openprovenance/prov/sql/Bundle.java | Bundle.getStatement | @ManyToMany(targetEntity = AStatement.class, cascade = {
CascadeType.ALL
})
@JoinTable(name = "BUNDLE_STATEMENT_JOIN", joinColumns = {
@JoinColumn(name = "BUNDLE")
}, inverseJoinColumns = {
@JoinColumn(name = "STATEMENT")
})
public List<Statement> getStatement() {
if (statement == null) {
statement = new ArrayList<Statement>();
}
return this.statement;
} | java | @ManyToMany(targetEntity = AStatement.class, cascade = {
CascadeType.ALL
})
@JoinTable(name = "BUNDLE_STATEMENT_JOIN", joinColumns = {
@JoinColumn(name = "BUNDLE")
}, inverseJoinColumns = {
@JoinColumn(name = "STATEMENT")
})
public List<Statement> getStatement() {
if (statement == null) {
statement = new ArrayList<Statement>();
}
return this.statement;
} | [
"@",
"ManyToMany",
"(",
"targetEntity",
"=",
"AStatement",
".",
"class",
",",
"cascade",
"=",
"{",
"CascadeType",
".",
"ALL",
"}",
")",
"@",
"JoinTable",
"(",
"name",
"=",
"\"BUNDLE_STATEMENT_JOIN\"",
",",
"joinColumns",
"=",
"{",
"@",
"JoinColumn",
"(",
"... | Gets the value of the statement 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 statement property.
<p>
For example, to add a new item, do as follows:
<pre>
getStatement().add(newItem);
</pre>
<p>
Objects of the following type(s) are allowed in the list
{@link org.openprovenance.prov.sql.Entity }
{@link Activity }
{@link WasGeneratedBy }
{@link Used }
{@link WasInformedBy }
{@link WasStartedBy }
{@link WasEndedBy }
{@link WasInvalidatedBy }
{@link WasDerivedFrom }
{@link Agent }
{@link WasAttributedTo }
{@link WasAssociatedWith }
{@link ActedOnBehalfOf }
{@link WasInfluencedBy }
{@link SpecializationOf }
{@link AlternateOf }
{@link Collection }
{@link EmptyCollection }
{@link HadMember }
{@link MentionOf } | [
"Gets",
"the",
"value",
"of",
"the",
"statement",
"property",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-sql/src/main/java/org/openprovenance/prov/sql/Bundle.java#L132-L145 |
37,150 | lucmoreau/ProvToolbox | prov-sql/src/main/java/org/openprovenance/prov/sql/Document.java | Document.getStatementOrBundle | @ManyToMany(targetEntity = AStatement.class, cascade = {
CascadeType.ALL
})
@JoinTable(name = "DOCUMENT_STATEMENT_JOIN", joinColumns = {
@JoinColumn(name = "DOCUMENT")
}, inverseJoinColumns = {
@JoinColumn(name = "STATEMENT")
})
public List<StatementOrBundle> getStatementOrBundle() {
if (statementOrBundle == null) {
statementOrBundle = new ArrayList<StatementOrBundle>();
}
return this.statementOrBundle;
} | java | @ManyToMany(targetEntity = AStatement.class, cascade = {
CascadeType.ALL
})
@JoinTable(name = "DOCUMENT_STATEMENT_JOIN", joinColumns = {
@JoinColumn(name = "DOCUMENT")
}, inverseJoinColumns = {
@JoinColumn(name = "STATEMENT")
})
public List<StatementOrBundle> getStatementOrBundle() {
if (statementOrBundle == null) {
statementOrBundle = new ArrayList<StatementOrBundle>();
}
return this.statementOrBundle;
} | [
"@",
"ManyToMany",
"(",
"targetEntity",
"=",
"AStatement",
".",
"class",
",",
"cascade",
"=",
"{",
"CascadeType",
".",
"ALL",
"}",
")",
"@",
"JoinTable",
"(",
"name",
"=",
"\"DOCUMENT_STATEMENT_JOIN\"",
",",
"joinColumns",
"=",
"{",
"@",
"JoinColumn",
"(",
... | Gets the value of the statementOrBundle 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 statementOrBundle property.
<p>
For example, to add a new item, do as follows:
<pre>
getStatementOrBundle().add(newItem);
</pre>
<p>
Objects of the following type(s) are allowed in the list
{@link org.openprovenance.prov.sql.Entity }
{@link Activity }
{@link WasGeneratedBy }
{@link Used }
{@link WasInformedBy }
{@link WasStartedBy }
{@link WasEndedBy }
{@link WasInvalidatedBy }
{@link WasDerivedFrom }
{@link Agent }
{@link WasAttributedTo }
{@link WasAssociatedWith }
{@link ActedOnBehalfOf }
{@link WasInfluencedBy }
{@link SpecializationOf }
{@link AlternateOf }
{@link Collection }
{@link EmptyCollection }
{@link HadMember }
{@link MentionOf }
{@link Bundle } | [
"Gets",
"the",
"value",
"of",
"the",
"statementOrBundle",
"property",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-sql/src/main/java/org/openprovenance/prov/sql/Document.java#L141-L154 |
37,151 | lucmoreau/ProvToolbox | prov-sql/src/main/java/org/openprovenance/prov/sql/Document.java | Document.getPk | @Id
@Column(name = "PK")
@GeneratedValue(strategy = GenerationType.AUTO)
public Long getPk() {
return pk;
} | java | @Id
@Column(name = "PK")
@GeneratedValue(strategy = GenerationType.AUTO)
public Long getPk() {
return pk;
} | [
"@",
"Id",
"@",
"Column",
"(",
"name",
"=",
"\"PK\"",
")",
"@",
"GeneratedValue",
"(",
"strategy",
"=",
"GenerationType",
".",
"AUTO",
")",
"public",
"Long",
"getPk",
"(",
")",
"{",
"return",
"pk",
";",
"}"
] | Gets the value of the pk property.
@return
possible object is
{@link Long } | [
"Gets",
"the",
"value",
"of",
"the",
"pk",
"property",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-sql/src/main/java/org/openprovenance/prov/sql/Document.java#L172-L177 |
37,152 | lucmoreau/ProvToolbox | prov-model/src/main/java/org/openprovenance/prov/model/ProvFactory.java | ProvFactory.newAgent | public Agent newAgent(Agent a) {
Agent res = newAgent(a.getId());
res.getType().addAll(a.getType());
res.getLabel().addAll(a.getLabel());
return res;
} | java | public Agent newAgent(Agent a) {
Agent res = newAgent(a.getId());
res.getType().addAll(a.getType());
res.getLabel().addAll(a.getLabel());
return res;
} | [
"public",
"Agent",
"newAgent",
"(",
"Agent",
"a",
")",
"{",
"Agent",
"res",
"=",
"newAgent",
"(",
"a",
".",
"getId",
"(",
")",
")",
";",
"res",
".",
"getType",
"(",
")",
".",
"addAll",
"(",
"a",
".",
"getType",
"(",
")",
")",
";",
"res",
".",
... | Creates a copy of an agent. The copy is shallow in the sense that the new Agent shares the same attributes as the original Agent.
@param a an {@link Agent} to copy
@return a copy of the input {@link Agent} | [
"Creates",
"a",
"copy",
"of",
"an",
"agent",
".",
"The",
"copy",
"is",
"shallow",
"in",
"the",
"sense",
"that",
"the",
"new",
"Agent",
"shares",
"the",
"same",
"attributes",
"as",
"the",
"original",
"Agent",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-model/src/main/java/org/openprovenance/prov/model/ProvFactory.java#L422-L427 |
37,153 | lucmoreau/ProvToolbox | prov-model/src/main/java/org/openprovenance/prov/model/ProvFactory.java | ProvFactory.newEntity | public Entity newEntity(Entity e) {
Entity res = newEntity(e.getId());
res.getOther().addAll(e.getOther());
res.getType().addAll(e.getType());
res.getLabel().addAll(e.getLabel());
res.getLocation().addAll(e.getLocation());
return res;
} | java | public Entity newEntity(Entity e) {
Entity res = newEntity(e.getId());
res.getOther().addAll(e.getOther());
res.getType().addAll(e.getType());
res.getLabel().addAll(e.getLabel());
res.getLocation().addAll(e.getLocation());
return res;
} | [
"public",
"Entity",
"newEntity",
"(",
"Entity",
"e",
")",
"{",
"Entity",
"res",
"=",
"newEntity",
"(",
"e",
".",
"getId",
"(",
")",
")",
";",
"res",
".",
"getOther",
"(",
")",
".",
"addAll",
"(",
"e",
".",
"getOther",
"(",
")",
")",
";",
"res",
... | Creates a copy of an entity. The copy is shallow in the sense that the new Entity shares the same attributes as the original Entity.
@param e an {@link Entity} to copy
@return a copy of the input {@link Entity} | [
"Creates",
"a",
"copy",
"of",
"an",
"entity",
".",
"The",
"copy",
"is",
"shallow",
"in",
"the",
"sense",
"that",
"the",
"new",
"Entity",
"shares",
"the",
"same",
"attributes",
"as",
"the",
"original",
"Entity",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-model/src/main/java/org/openprovenance/prov/model/ProvFactory.java#L612-L619 |
37,154 | lucmoreau/ProvToolbox | prov-model/src/main/java/org/openprovenance/prov/model/ProvFactory.java | ProvFactory.newEntry | public Entry newEntry(Key key, QualifiedName entity) {
Entry res = of.createEntry();
res.setKey(key);
res.setEntity(entity);
return res;
} | java | public Entry newEntry(Key key, QualifiedName entity) {
Entry res = of.createEntry();
res.setKey(key);
res.setEntity(entity);
return res;
} | [
"public",
"Entry",
"newEntry",
"(",
"Key",
"key",
",",
"QualifiedName",
"entity",
")",
"{",
"Entry",
"res",
"=",
"of",
".",
"createEntry",
"(",
")",
";",
"res",
".",
"setKey",
"(",
"key",
")",
";",
"res",
".",
"setEntity",
"(",
"entity",
")",
";",
... | Factory method for Key-entity entries. Key-entity entries are used to identify the members of a dictionary.
@param key indexing the entity in the dictionary
@param entity a {@link QualifiedName} denoting an entity
@return an instance of {@link Entry} | [
"Factory",
"method",
"for",
"Key",
"-",
"entity",
"entries",
".",
"Key",
"-",
"entity",
"entries",
"are",
"used",
"to",
"identify",
"the",
"members",
"of",
"a",
"dictionary",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-model/src/main/java/org/openprovenance/prov/model/ProvFactory.java#L661-L666 |
37,155 | lucmoreau/ProvToolbox | prov-sql/src/main/java/org/openprovenance/prov/sql/Entry.java | Entry.setKey | public void setKey(org.openprovenance.prov.model.Key value) {
this.key = (org.openprovenance.prov.sql.Key)value;
} | java | public void setKey(org.openprovenance.prov.model.Key value) {
this.key = (org.openprovenance.prov.sql.Key)value;
} | [
"public",
"void",
"setKey",
"(",
"org",
".",
"openprovenance",
".",
"prov",
".",
"model",
".",
"Key",
"value",
")",
"{",
"this",
".",
"key",
"=",
"(",
"org",
".",
"openprovenance",
".",
"prov",
".",
"sql",
".",
"Key",
")",
"value",
";",
"}"
] | Sets the value of the key property.
@param value
allowed object is
{@link Object } | [
"Sets",
"the",
"value",
"of",
"the",
"key",
"property",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-sql/src/main/java/org/openprovenance/prov/sql/Entry.java#L77-L79 |
37,156 | lucmoreau/ProvToolbox | prov-sql/src/main/java/org/openprovenance/prov/sql/DerivedByRemovalFrom.java | DerivedByRemovalFrom.getKey | public List<org.openprovenance.prov.model.Key> getKey() {
if (key == null) {
key=AttributeList.populateKnownAttributes(this,all, org.openprovenance.prov.model.Key.class);
}
return this.key;
} | java | public List<org.openprovenance.prov.model.Key> getKey() {
if (key == null) {
key=AttributeList.populateKnownAttributes(this,all, org.openprovenance.prov.model.Key.class);
}
return this.key;
} | [
"public",
"List",
"<",
"org",
".",
"openprovenance",
".",
"prov",
".",
"model",
".",
"Key",
">",
"getKey",
"(",
")",
"{",
"if",
"(",
"key",
"==",
"null",
")",
"{",
"key",
"=",
"AttributeList",
".",
"populateKnownAttributes",
"(",
"this",
",",
"all",
... | Gets the value of the key 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 key property.
<p>
For example, to add a new item, do as follows:
<pre>
getKey().add(newItem);
</pre>
<p>
Objects of the following type(s) are allowed in the list
{@link Object } | [
"Gets",
"the",
"value",
"of",
"the",
"key",
"property",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-sql/src/main/java/org/openprovenance/prov/sql/DerivedByRemovalFrom.java#L165-L170 |
37,157 | lucmoreau/ProvToolbox | prov-model/src/main/java/org/openprovenance/prov/model/DOMProcessing.java | DOMProcessing.stringToQualifiedName | final public QualifiedName stringToQualifiedName(String str, org.w3c.dom.Element el) {
if (str == null)
return null;
int index = str.indexOf(':');
if (index == -1) {
QualifiedName qn = pFactory.newQualifiedName(el.lookupNamespaceURI(null), // find default namespace
// namespace
str,
null);
return qn;
}
String prefix = str.substring(0, index);
String local = str.substring(index + 1, str.length());
String escapedLocal=qnU.escapeProvLocalName(qnU.unescapeFromXsdLocalName(local));
QualifiedName qn = pFactory.newQualifiedName(convertNsFromXml(el.lookupNamespaceURI(prefix)), escapedLocal, prefix);
return qn;
} | java | final public QualifiedName stringToQualifiedName(String str, org.w3c.dom.Element el) {
if (str == null)
return null;
int index = str.indexOf(':');
if (index == -1) {
QualifiedName qn = pFactory.newQualifiedName(el.lookupNamespaceURI(null), // find default namespace
// namespace
str,
null);
return qn;
}
String prefix = str.substring(0, index);
String local = str.substring(index + 1, str.length());
String escapedLocal=qnU.escapeProvLocalName(qnU.unescapeFromXsdLocalName(local));
QualifiedName qn = pFactory.newQualifiedName(convertNsFromXml(el.lookupNamespaceURI(prefix)), escapedLocal, prefix);
return qn;
} | [
"final",
"public",
"QualifiedName",
"stringToQualifiedName",
"(",
"String",
"str",
",",
"org",
".",
"w3c",
".",
"dom",
".",
"Element",
"el",
")",
"{",
"if",
"(",
"str",
"==",
"null",
")",
"return",
"null",
";",
"int",
"index",
"=",
"str",
".",
"indexOf... | Converts a string to a QualifiedName, extracting namespace from the DOM. Ensures that the generated qualified name is
properly escaped, according to PROV-N syntax.
@param str
string to convert to QualifiedName
@param el
current Element in which this string was found (as attribute
or attribute value)
@return a qualified name {@link QualifiedName} | [
"Converts",
"a",
"string",
"to",
"a",
"QualifiedName",
"extracting",
"namespace",
"from",
"the",
"DOM",
".",
"Ensures",
"that",
"the",
"generated",
"qualified",
"name",
"is",
"properly",
"escaped",
"according",
"to",
"PROV",
"-",
"N",
"syntax",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-model/src/main/java/org/openprovenance/prov/model/DOMProcessing.java#L87-L103 |
37,158 | lucmoreau/ProvToolbox | prov-rdf/src/main/java/org/openprovenance/prov/rdf/Utility.java | Utility.parseRDF | public Document parseRDF(InputStream inputStream,
RDFFormat format,
String baseuri)
throws RDFParseException,
RDFHandlerException,
IOException {
RDFParser rdfParser = Rio.createParser(format);
return parseRDF(inputStream, rdfParser, baseuri);
} | java | public Document parseRDF(InputStream inputStream,
RDFFormat format,
String baseuri)
throws RDFParseException,
RDFHandlerException,
IOException {
RDFParser rdfParser = Rio.createParser(format);
return parseRDF(inputStream, rdfParser, baseuri);
} | [
"public",
"Document",
"parseRDF",
"(",
"InputStream",
"inputStream",
",",
"RDFFormat",
"format",
",",
"String",
"baseuri",
")",
"throws",
"RDFParseException",
",",
"RDFHandlerException",
",",
"IOException",
"{",
"RDFParser",
"rdfParser",
"=",
"Rio",
".",
"createPars... | Parse from input stream, no base uri specified. | [
"Parse",
"from",
"input",
"stream",
"no",
"base",
"uri",
"specified",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-rdf/src/main/java/org/openprovenance/prov/rdf/Utility.java#L54-L62 |
37,159 | lucmoreau/ProvToolbox | prov-rdf/src/main/java/org/openprovenance/prov/rdf/Utility.java | Utility.parseRDF | public Document parseRDF(InputStream inputStream,
RDFParser rdfParser,
String baseuri)
throws IOException,
RDFParseException,
RDFHandlerException {
RdfCollector rdfCollector = new QualifiedCollector(pFactory, onto);
rdfParser.setRDFHandler(rdfCollector);
rdfParser.parse(inputStream, baseuri);
Document doc = rdfCollector.getDocument();
Namespace ns = doc.getNamespace();
return doc;
} | java | public Document parseRDF(InputStream inputStream,
RDFParser rdfParser,
String baseuri)
throws IOException,
RDFParseException,
RDFHandlerException {
RdfCollector rdfCollector = new QualifiedCollector(pFactory, onto);
rdfParser.setRDFHandler(rdfCollector);
rdfParser.parse(inputStream, baseuri);
Document doc = rdfCollector.getDocument();
Namespace ns = doc.getNamespace();
return doc;
} | [
"public",
"Document",
"parseRDF",
"(",
"InputStream",
"inputStream",
",",
"RDFParser",
"rdfParser",
",",
"String",
"baseuri",
")",
"throws",
"IOException",
",",
"RDFParseException",
",",
"RDFHandlerException",
"{",
"RdfCollector",
"rdfCollector",
"=",
"new",
"Qualifie... | Parse from input stream passing base uri . | [
"Parse",
"from",
"input",
"stream",
"passing",
"base",
"uri",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-rdf/src/main/java/org/openprovenance/prov/rdf/Utility.java#L66-L78 |
37,160 | lucmoreau/ProvToolbox | prov-model/src/main/java/org/openprovenance/prov/model/ProvUtilities.java | ProvUtilities.hasNoTime | public boolean hasNoTime(Statement o) {
if (o instanceof HasTime) return false;
if (o instanceof Activity) return false;
return true;
/* OLD Definition
return (o instanceof WasDerivedFrom)
|| (o instanceof ActedOnBehalfOf)
|| (o instanceof WasInformedBy)
|| (o instanceof WasAttributedTo)
|| (o instanceof WasAssociatedWith)
|| (o instanceof WasInfluencedBy)
|| (o instanceof SpecializationOf)
|| (o instanceof AlternateOf)
|| (o instanceof MentionOf)
|| (o instanceof HadMember);
*/
} | java | public boolean hasNoTime(Statement o) {
if (o instanceof HasTime) return false;
if (o instanceof Activity) return false;
return true;
/* OLD Definition
return (o instanceof WasDerivedFrom)
|| (o instanceof ActedOnBehalfOf)
|| (o instanceof WasInformedBy)
|| (o instanceof WasAttributedTo)
|| (o instanceof WasAssociatedWith)
|| (o instanceof WasInfluencedBy)
|| (o instanceof SpecializationOf)
|| (o instanceof AlternateOf)
|| (o instanceof MentionOf)
|| (o instanceof HadMember);
*/
} | [
"public",
"boolean",
"hasNoTime",
"(",
"Statement",
"o",
")",
"{",
"if",
"(",
"o",
"instanceof",
"HasTime",
")",
"return",
"false",
";",
"if",
"(",
"o",
"instanceof",
"Activity",
")",
"return",
"false",
";",
"return",
"true",
";",
"/* OLD Definition\n ... | Indicates whether object has no time field. | [
"Indicates",
"whether",
"object",
"has",
"no",
"time",
"field",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-model/src/main/java/org/openprovenance/prov/model/ProvUtilities.java#L1152-L1168 |
37,161 | lucmoreau/ProvToolbox | prov-dot/src/main/java/org/openprovenance/prov/dot/ProvToDot.java | ProvToDot.selectColor | public String selectColor(List<String> colors) {
String tr="transparent";
for (String c: colors) {
if (!(c.equals(tr))) return c;
}
return tr;
} | java | public String selectColor(List<String> colors) {
String tr="transparent";
for (String c: colors) {
if (!(c.equals(tr))) return c;
}
return tr;
} | [
"public",
"String",
"selectColor",
"(",
"List",
"<",
"String",
">",
"colors",
")",
"{",
"String",
"tr",
"=",
"\"transparent\"",
";",
"for",
"(",
"String",
"c",
":",
"colors",
")",
"{",
"if",
"(",
"!",
"(",
"c",
".",
"equals",
"(",
"tr",
")",
")",
... | returns the first non transparent color | [
"returns",
"the",
"first",
"non",
"transparent",
"color"
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-dot/src/main/java/org/openprovenance/prov/dot/ProvToDot.java#L797-L803 |
37,162 | lucmoreau/ProvToolbox | prov-sql/src/main/java/org/openprovenance/prov/sql/AlternateOf.java | AlternateOf.getAlternate1 | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "ALTERNATE1")
public org.openprovenance.prov.model.QualifiedName getAlternate1() {
return alternate1;
} | java | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "ALTERNATE1")
public org.openprovenance.prov.model.QualifiedName getAlternate1() {
return alternate1;
} | [
"@",
"ManyToOne",
"(",
"targetEntity",
"=",
"org",
".",
"openprovenance",
".",
"prov",
".",
"sql",
".",
"QualifiedName",
".",
"class",
",",
"cascade",
"=",
"{",
"CascadeType",
".",
"ALL",
"}",
")",
"@",
"JoinColumn",
"(",
"name",
"=",
"\"ALTERNATE1\"",
"... | Gets the value of the alternate1 property.
@return
possible object is
{@link org.openprovenance.prov.sql.IDRef } | [
"Gets",
"the",
"value",
"of",
"the",
"alternate1",
"property",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-sql/src/main/java/org/openprovenance/prov/sql/AlternateOf.java#L70-L76 |
37,163 | lucmoreau/ProvToolbox | prov-sql/src/main/java/org/openprovenance/prov/sql/AlternateOf.java | AlternateOf.getAlternate2 | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "ALTERNATE2")
public org.openprovenance.prov.model.QualifiedName getAlternate2() {
return alternate2;
} | java | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "ALTERNATE2")
public org.openprovenance.prov.model.QualifiedName getAlternate2() {
return alternate2;
} | [
"@",
"ManyToOne",
"(",
"targetEntity",
"=",
"org",
".",
"openprovenance",
".",
"prov",
".",
"sql",
".",
"QualifiedName",
".",
"class",
",",
"cascade",
"=",
"{",
"CascadeType",
".",
"ALL",
"}",
")",
"@",
"JoinColumn",
"(",
"name",
"=",
"\"ALTERNATE2\"",
"... | Gets the value of the alternate2 property.
@return
possible object is
{@link org.openprovenance.prov.sql.IDRef } | [
"Gets",
"the",
"value",
"of",
"the",
"alternate2",
"property",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-sql/src/main/java/org/openprovenance/prov/sql/AlternateOf.java#L98-L104 |
37,164 | lucmoreau/ProvToolbox | prov-sql/src/main/java/org/openprovenance/prov/sql/WasAssociatedWith.java | WasAssociatedWith.getPlan | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "PLAN")
public org.openprovenance.prov.model.QualifiedName getPlan() {
return plan;
} | java | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "PLAN")
public org.openprovenance.prov.model.QualifiedName getPlan() {
return plan;
} | [
"@",
"ManyToOne",
"(",
"targetEntity",
"=",
"org",
".",
"openprovenance",
".",
"prov",
".",
"sql",
".",
"QualifiedName",
".",
"class",
",",
"cascade",
"=",
"{",
"CascadeType",
".",
"ALL",
"}",
")",
"@",
"JoinColumn",
"(",
"name",
"=",
"\"PLAN\"",
")",
... | Gets the value of the plan property.
@return
possible object is
{@link org.openprovenance.prov.sql.IDRef } | [
"Gets",
"the",
"value",
"of",
"the",
"plan",
"property",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-sql/src/main/java/org/openprovenance/prov/sql/WasAssociatedWith.java#L165-L171 |
37,165 | lucmoreau/ProvToolbox | prov-sql/src/main/java/org/openprovenance/prov/sql/WasInfluencedBy.java | WasInfluencedBy.getInfluencee | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "INFLUENCEE")
public org.openprovenance.prov.model.QualifiedName getInfluencee() {
return influencee;
} | java | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "INFLUENCEE")
public org.openprovenance.prov.model.QualifiedName getInfluencee() {
return influencee;
} | [
"@",
"ManyToOne",
"(",
"targetEntity",
"=",
"org",
".",
"openprovenance",
".",
"prov",
".",
"sql",
".",
"QualifiedName",
".",
"class",
",",
"cascade",
"=",
"{",
"CascadeType",
".",
"ALL",
"}",
")",
"@",
"JoinColumn",
"(",
"name",
"=",
"\"INFLUENCEE\"",
"... | Gets the value of the influencee property.
@return
possible object is
{@link org.openprovenance.prov.sql.IDRef } | [
"Gets",
"the",
"value",
"of",
"the",
"influencee",
"property",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-sql/src/main/java/org/openprovenance/prov/sql/WasInfluencedBy.java#L103-L109 |
37,166 | lucmoreau/ProvToolbox | prov-sql/src/main/java/org/openprovenance/prov/sql/WasInfluencedBy.java | WasInfluencedBy.getInfluencer | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "INFLUENCER")
public org.openprovenance.prov.model.QualifiedName getInfluencer() {
return influencer;
} | java | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "INFLUENCER")
public org.openprovenance.prov.model.QualifiedName getInfluencer() {
return influencer;
} | [
"@",
"ManyToOne",
"(",
"targetEntity",
"=",
"org",
".",
"openprovenance",
".",
"prov",
".",
"sql",
".",
"QualifiedName",
".",
"class",
",",
"cascade",
"=",
"{",
"CascadeType",
".",
"ALL",
"}",
")",
"@",
"JoinColumn",
"(",
"name",
"=",
"\"INFLUENCER\"",
"... | Gets the value of the influencer property.
@return
possible object is
{@link org.openprovenance.prov.sql.IDRef } | [
"Gets",
"the",
"value",
"of",
"the",
"influencer",
"property",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-sql/src/main/java/org/openprovenance/prov/sql/WasInfluencedBy.java#L131-L137 |
37,167 | lucmoreau/ProvToolbox | prov-sql/src/main/java/org/openprovenance/prov/sql/WasDerivedFrom.java | WasDerivedFrom.getGeneratedEntity | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "GENERATED_ENTITY")
public org.openprovenance.prov.model.QualifiedName getGeneratedEntity() {
return generatedEntity;
} | java | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "GENERATED_ENTITY")
public org.openprovenance.prov.model.QualifiedName getGeneratedEntity() {
return generatedEntity;
} | [
"@",
"ManyToOne",
"(",
"targetEntity",
"=",
"org",
".",
"openprovenance",
".",
"prov",
".",
"sql",
".",
"QualifiedName",
".",
"class",
",",
"cascade",
"=",
"{",
"CascadeType",
".",
"ALL",
"}",
")",
"@",
"JoinColumn",
"(",
"name",
"=",
"\"GENERATED_ENTITY\"... | Gets the value of the generatedEntity property.
@return
possible object is
{@link org.openprovenance.prov.sql.IDRef } | [
"Gets",
"the",
"value",
"of",
"the",
"generatedEntity",
"property",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-sql/src/main/java/org/openprovenance/prov/sql/WasDerivedFrom.java#L120-L126 |
37,168 | lucmoreau/ProvToolbox | prov-sql/src/main/java/org/openprovenance/prov/sql/WasDerivedFrom.java | WasDerivedFrom.getUsedEntity | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "USED_ENTITY")
public org.openprovenance.prov.model.QualifiedName getUsedEntity() {
return usedEntity;
} | java | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "USED_ENTITY")
public org.openprovenance.prov.model.QualifiedName getUsedEntity() {
return usedEntity;
} | [
"@",
"ManyToOne",
"(",
"targetEntity",
"=",
"org",
".",
"openprovenance",
".",
"prov",
".",
"sql",
".",
"QualifiedName",
".",
"class",
",",
"cascade",
"=",
"{",
"CascadeType",
".",
"ALL",
"}",
")",
"@",
"JoinColumn",
"(",
"name",
"=",
"\"USED_ENTITY\"",
... | Gets the value of the usedEntity property.
@return
possible object is
{@link org.openprovenance.prov.sql.IDRef } | [
"Gets",
"the",
"value",
"of",
"the",
"usedEntity",
"property",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-sql/src/main/java/org/openprovenance/prov/sql/WasDerivedFrom.java#L148-L154 |
37,169 | lucmoreau/ProvToolbox | prov-sql/src/main/java/org/openprovenance/prov/sql/WasDerivedFrom.java | WasDerivedFrom.getGeneration | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "GENERATION")
public org.openprovenance.prov.model.QualifiedName getGeneration() {
return generation;
} | java | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "GENERATION")
public org.openprovenance.prov.model.QualifiedName getGeneration() {
return generation;
} | [
"@",
"ManyToOne",
"(",
"targetEntity",
"=",
"org",
".",
"openprovenance",
".",
"prov",
".",
"sql",
".",
"QualifiedName",
".",
"class",
",",
"cascade",
"=",
"{",
"CascadeType",
".",
"ALL",
"}",
")",
"@",
"JoinColumn",
"(",
"name",
"=",
"\"GENERATION\"",
"... | Gets the value of the generation property.
@return
possible object is
{@link org.openprovenance.prov.sql.IDRef } | [
"Gets",
"the",
"value",
"of",
"the",
"generation",
"property",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-sql/src/main/java/org/openprovenance/prov/sql/WasDerivedFrom.java#L204-L210 |
37,170 | lucmoreau/ProvToolbox | prov-sql/src/main/java/org/openprovenance/prov/sql/WasDerivedFrom.java | WasDerivedFrom.getUsage | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "USAGE")
public org.openprovenance.prov.model.QualifiedName getUsage() {
return usage;
} | java | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "USAGE")
public org.openprovenance.prov.model.QualifiedName getUsage() {
return usage;
} | [
"@",
"ManyToOne",
"(",
"targetEntity",
"=",
"org",
".",
"openprovenance",
".",
"prov",
".",
"sql",
".",
"QualifiedName",
".",
"class",
",",
"cascade",
"=",
"{",
"CascadeType",
".",
"ALL",
"}",
")",
"@",
"JoinColumn",
"(",
"name",
"=",
"\"USAGE\"",
")",
... | Gets the value of the usage property.
@return
possible object is
{@link org.openprovenance.prov.sql.IDRef } | [
"Gets",
"the",
"value",
"of",
"the",
"usage",
"property",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-sql/src/main/java/org/openprovenance/prov/sql/WasDerivedFrom.java#L232-L238 |
37,171 | lucmoreau/ProvToolbox | prov-sql/src/main/java/org/openprovenance/prov/sql/TypedValue.java | TypedValue.getValueItem | @Embedded
public AValue getValueItem() {
if ((avalue==null) && (value!=null)) {
if (type==null) {
avalue=SQLValueConverter.convertToAValue(vc.getXsdType(value), value);
} else if (value instanceof LangString) {
avalue=SQLValueConverter.convertToAValue(type, ((LangString) value).getValue());
} else if (value instanceof org.openprovenance.prov.model.QualifiedName) {
avalue=SQLValueConverter.convertToAValue(type, (QualifiedName) value);
} else {
avalue=SQLValueConverter.convertToAValue(type, vc.convertToJava(type, (String)value));
}
}
return avalue;
} | java | @Embedded
public AValue getValueItem() {
if ((avalue==null) && (value!=null)) {
if (type==null) {
avalue=SQLValueConverter.convertToAValue(vc.getXsdType(value), value);
} else if (value instanceof LangString) {
avalue=SQLValueConverter.convertToAValue(type, ((LangString) value).getValue());
} else if (value instanceof org.openprovenance.prov.model.QualifiedName) {
avalue=SQLValueConverter.convertToAValue(type, (QualifiedName) value);
} else {
avalue=SQLValueConverter.convertToAValue(type, vc.convertToJava(type, (String)value));
}
}
return avalue;
} | [
"@",
"Embedded",
"public",
"AValue",
"getValueItem",
"(",
")",
"{",
"if",
"(",
"(",
"avalue",
"==",
"null",
")",
"&&",
"(",
"value",
"!=",
"null",
")",
")",
"{",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"avalue",
"=",
"SQLValueConverter",
".",
"c... | Gets the value of the test property.
@return
possible object is
{@link AValue } | [
"Gets",
"the",
"value",
"of",
"the",
"test",
"property",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-sql/src/main/java/org/openprovenance/prov/sql/TypedValue.java#L184-L199 |
37,172 | lucmoreau/ProvToolbox | prov-sql/src/main/java/org/openprovenance/prov/sql/TypedValue.java | TypedValue.setValueItem | public void setValueItem(AValue value) {
this.avalue=value;
if (value!=null) {
Object o=SQLValueConverter.convertFromAValue(value);
if (o!=null) {
if (o instanceof QualifiedName) {
this.value=o;
} else {
this.value = o.toString();
}
}
}
} | java | public void setValueItem(AValue value) {
this.avalue=value;
if (value!=null) {
Object o=SQLValueConverter.convertFromAValue(value);
if (o!=null) {
if (o instanceof QualifiedName) {
this.value=o;
} else {
this.value = o.toString();
}
}
}
} | [
"public",
"void",
"setValueItem",
"(",
"AValue",
"value",
")",
"{",
"this",
".",
"avalue",
"=",
"value",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"Object",
"o",
"=",
"SQLValueConverter",
".",
"convertFromAValue",
"(",
"value",
")",
";",
"if",
"... | Sets the value of the test property.
@param value
allowed object is
{@link AValue } | [
"Sets",
"the",
"value",
"of",
"the",
"test",
"property",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-sql/src/main/java/org/openprovenance/prov/sql/TypedValue.java#L210-L223 |
37,173 | lucmoreau/ProvToolbox | prov-sql/src/main/java/org/openprovenance/prov/sql/WasStartedBy.java | WasStartedBy.getTrigger | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "TRIGGER_")
public org.openprovenance.prov.model.QualifiedName getTrigger() {
return trigger;
} | java | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "TRIGGER_")
public org.openprovenance.prov.model.QualifiedName getTrigger() {
return trigger;
} | [
"@",
"ManyToOne",
"(",
"targetEntity",
"=",
"org",
".",
"openprovenance",
".",
"prov",
".",
"sql",
".",
"QualifiedName",
".",
"class",
",",
"cascade",
"=",
"{",
"CascadeType",
".",
"ALL",
"}",
")",
"@",
"JoinColumn",
"(",
"name",
"=",
"\"TRIGGER_\"",
")"... | Gets the value of the trigger property.
@return
possible object is
{@link org.openprovenance.prov.sql.IDRef } | [
"Gets",
"the",
"value",
"of",
"the",
"trigger",
"property",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-sql/src/main/java/org/openprovenance/prov/sql/WasStartedBy.java#L151-L157 |
37,174 | lucmoreau/ProvToolbox | prov-sql/src/main/java/org/openprovenance/prov/sql/WasStartedBy.java | WasStartedBy.getStarter | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "STARTER")
public org.openprovenance.prov.model.QualifiedName getStarter() {
return starter;
} | java | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "STARTER")
public org.openprovenance.prov.model.QualifiedName getStarter() {
return starter;
} | [
"@",
"ManyToOne",
"(",
"targetEntity",
"=",
"org",
".",
"openprovenance",
".",
"prov",
".",
"sql",
".",
"QualifiedName",
".",
"class",
",",
"cascade",
"=",
"{",
"CascadeType",
".",
"ALL",
"}",
")",
"@",
"JoinColumn",
"(",
"name",
"=",
"\"STARTER\"",
")",... | Gets the value of the starter property.
@return
possible object is
{@link org.openprovenance.prov.sql.IDRef } | [
"Gets",
"the",
"value",
"of",
"the",
"starter",
"property",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-sql/src/main/java/org/openprovenance/prov/sql/WasStartedBy.java#L179-L185 |
37,175 | lucmoreau/ProvToolbox | prov-n/src/main/java/org/openprovenance/prov/notation/Utility.java | Utility.convertJavaBeanToJavaBean | public Object convertJavaBeanToJavaBean(Document doc, ProvFactory pFactory) {
BeanTraversal bt=new BeanTraversal(pFactory, pFactory);
Document o=bt.doAction(doc);
return o;
} | java | public Object convertJavaBeanToJavaBean(Document doc, ProvFactory pFactory) {
BeanTraversal bt=new BeanTraversal(pFactory, pFactory);
Document o=bt.doAction(doc);
return o;
} | [
"public",
"Object",
"convertJavaBeanToJavaBean",
"(",
"Document",
"doc",
",",
"ProvFactory",
"pFactory",
")",
"{",
"BeanTraversal",
"bt",
"=",
"new",
"BeanTraversal",
"(",
"pFactory",
",",
"pFactory",
")",
";",
"Document",
"o",
"=",
"bt",
".",
"doAction",
"(",... | A conversion function that copies a Java Bean deeply. | [
"A",
"conversion",
"function",
"that",
"copies",
"a",
"Java",
"Bean",
"deeply",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-n/src/main/java/org/openprovenance/prov/notation/Utility.java#L124-L128 |
37,176 | lucmoreau/ProvToolbox | prov-sql/src/main/java/org/openprovenance/prov/sql/AValue.java | AValue.getQualifiedName | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "QN")
public QualifiedName getQualifiedName() {
return qualifiedName;
} | java | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "QN")
public QualifiedName getQualifiedName() {
return qualifiedName;
} | [
"@",
"ManyToOne",
"(",
"targetEntity",
"=",
"org",
".",
"openprovenance",
".",
"prov",
".",
"sql",
".",
"QualifiedName",
".",
"class",
",",
"cascade",
"=",
"{",
"CascadeType",
".",
"ALL",
"}",
")",
"@",
"JoinColumn",
"(",
"name",
"=",
"\"QN\"",
")",
"p... | Gets the value of the qualifiedName property.
@return
possible object is
{@link QualifiedName } | [
"Gets",
"the",
"value",
"of",
"the",
"qualifiedName",
"property",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-sql/src/main/java/org/openprovenance/prov/sql/AValue.java#L239-L245 |
37,177 | lucmoreau/ProvToolbox | prov-sql/src/main/java/org/openprovenance/prov/sql/WasEndedBy.java | WasEndedBy.getEnder | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "ENDER")
public org.openprovenance.prov.model.QualifiedName getEnder() {
return ender;
} | java | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "ENDER")
public org.openprovenance.prov.model.QualifiedName getEnder() {
return ender;
} | [
"@",
"ManyToOne",
"(",
"targetEntity",
"=",
"org",
".",
"openprovenance",
".",
"prov",
".",
"sql",
".",
"QualifiedName",
".",
"class",
",",
"cascade",
"=",
"{",
"CascadeType",
".",
"ALL",
"}",
")",
"@",
"JoinColumn",
"(",
"name",
"=",
"\"ENDER\"",
")",
... | Gets the value of the ender property.
@return
possible object is
{@link org.openprovenance.prov.sql.IDRef } | [
"Gets",
"the",
"value",
"of",
"the",
"ender",
"property",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-sql/src/main/java/org/openprovenance/prov/sql/WasEndedBy.java#L179-L185 |
37,178 | lucmoreau/ProvToolbox | prov-xml/src/main/java/org/openprovenance/prov/xml/ProvDeserialiser.java | ProvDeserialiser.updateNamespaces | public void updateNamespaces(Document document) {
Namespace rootNamespace = Namespace.gatherNamespaces(document);
document.setNamespace(rootNamespace);
for (org.openprovenance.prov.model.Bundle bu: utils.getBundle(document)) {
Namespace ns=bu.getNamespace();
if (ns!=null) {
ns.setParent(rootNamespace);
} else {
ns=new Namespace();
ns.setParent(rootNamespace);
bu.setNamespace(ns);
}
}
} | java | public void updateNamespaces(Document document) {
Namespace rootNamespace = Namespace.gatherNamespaces(document);
document.setNamespace(rootNamespace);
for (org.openprovenance.prov.model.Bundle bu: utils.getBundle(document)) {
Namespace ns=bu.getNamespace();
if (ns!=null) {
ns.setParent(rootNamespace);
} else {
ns=new Namespace();
ns.setParent(rootNamespace);
bu.setNamespace(ns);
}
}
} | [
"public",
"void",
"updateNamespaces",
"(",
"Document",
"document",
")",
"{",
"Namespace",
"rootNamespace",
"=",
"Namespace",
".",
"gatherNamespaces",
"(",
"document",
")",
";",
"document",
".",
"setNamespace",
"(",
"rootNamespace",
")",
";",
"for",
"(",
"org",
... | After reading a document, this method should be called to ensure that Namespaces are properly chained.
@param document a {@link Document} to update | [
"After",
"reading",
"a",
"document",
"this",
"method",
"should",
"be",
"called",
"to",
"ensure",
"that",
"Namespaces",
"are",
"properly",
"chained",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-xml/src/main/java/org/openprovenance/prov/xml/ProvDeserialiser.java#L80-L93 |
37,179 | lucmoreau/ProvToolbox | prov-sql/src/main/java/org/openprovenance/prov/sql/WasInformedBy.java | WasInformedBy.getInformed | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "INFORMED")
public org.openprovenance.prov.model.QualifiedName getInformed() {
return informed;
} | java | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "INFORMED")
public org.openprovenance.prov.model.QualifiedName getInformed() {
return informed;
} | [
"@",
"ManyToOne",
"(",
"targetEntity",
"=",
"org",
".",
"openprovenance",
".",
"prov",
".",
"sql",
".",
"QualifiedName",
".",
"class",
",",
"cascade",
"=",
"{",
"CascadeType",
".",
"ALL",
"}",
")",
"@",
"JoinColumn",
"(",
"name",
"=",
"\"INFORMED\"",
")"... | Gets the value of the informed property.
@return
possible object is
{@link org.openprovenance.prov.sql.IDRef } | [
"Gets",
"the",
"value",
"of",
"the",
"informed",
"property",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-sql/src/main/java/org/openprovenance/prov/sql/WasInformedBy.java#L104-L110 |
37,180 | lucmoreau/ProvToolbox | prov-sql/src/main/java/org/openprovenance/prov/sql/WasInformedBy.java | WasInformedBy.getInformant | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "INFORMANT")
public org.openprovenance.prov.model.QualifiedName getInformant() {
return informant;
} | java | @ManyToOne(targetEntity = org.openprovenance.prov.sql.QualifiedName.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "INFORMANT")
public org.openprovenance.prov.model.QualifiedName getInformant() {
return informant;
} | [
"@",
"ManyToOne",
"(",
"targetEntity",
"=",
"org",
".",
"openprovenance",
".",
"prov",
".",
"sql",
".",
"QualifiedName",
".",
"class",
",",
"cascade",
"=",
"{",
"CascadeType",
".",
"ALL",
"}",
")",
"@",
"JoinColumn",
"(",
"name",
"=",
"\"INFORMANT\"",
")... | Gets the value of the informant property.
@return
possible object is
{@link org.openprovenance.prov.sql.IDRef } | [
"Gets",
"the",
"value",
"of",
"the",
"informant",
"property",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-sql/src/main/java/org/openprovenance/prov/sql/WasInformedBy.java#L132-L138 |
37,181 | lucmoreau/ProvToolbox | prov-model/src/main/java/org/openprovenance/prov/model/IndexedDocument.java | IndexedDocument.add | public <T extends Relation> T add(T statement,
int num,
Collection<T> anonRelationCollection,
HashMap<QualifiedName, Collection<T>> namedRelationMap,
HashMap<QualifiedName, Collection<T>> effectRelationMap,
HashMap<QualifiedName, Collection<T>> causeRelationMap) {
QualifiedName aid2 = u.getEffect(statement); //wib.getInformed();
QualifiedName aid1 = u.getCause(statement); //wib.getInformant();
statement = pFactory.newStatement(statement); // clone
QualifiedName id;
if (statement instanceof Identifiable) {
id=((Identifiable)statement).getId();
} else {
id=null;
}
if (id == null) {
boolean found = false;
Collection<T> relationCollection = effectRelationMap.get(aid2);
if (relationCollection == null) {
relationCollection = new LinkedList<T>();
relationCollection.add(statement);
effectRelationMap.put(aid2, relationCollection);
} else {
for (T u : relationCollection) {
if (u.equals(statement)) {
found = true;
statement = u;
break;
}
}
if (!found) {
relationCollection.add(statement);
}
}
relationCollection = causeRelationMap.get(aid1);
if (relationCollection == null) {
relationCollection = new LinkedList<T>();
relationCollection.add(statement);
causeRelationMap.put(aid1, relationCollection);
} else {
if (!found) {
// if we had not found it in the first table, then we
// have to add it here too
relationCollection.add(statement);
}
}
if (!found) {
anonRelationCollection.add(statement);
}
} else {
Collection<T> relationCollection=namedRelationMap.get(id);
if (relationCollection==null) {
relationCollection=new LinkedList<T>();
relationCollection.add(statement);
namedRelationMap.put(id, relationCollection);
} else {
boolean found=false;
for (T u1: relationCollection) {
if (sameEdge(u1,statement,num)) {
found=true;
mergeAttributes(u1, statement);
break;
}
}
if (!found) {
relationCollection.add(statement);
}
}
}
return statement;
} | java | public <T extends Relation> T add(T statement,
int num,
Collection<T> anonRelationCollection,
HashMap<QualifiedName, Collection<T>> namedRelationMap,
HashMap<QualifiedName, Collection<T>> effectRelationMap,
HashMap<QualifiedName, Collection<T>> causeRelationMap) {
QualifiedName aid2 = u.getEffect(statement); //wib.getInformed();
QualifiedName aid1 = u.getCause(statement); //wib.getInformant();
statement = pFactory.newStatement(statement); // clone
QualifiedName id;
if (statement instanceof Identifiable) {
id=((Identifiable)statement).getId();
} else {
id=null;
}
if (id == null) {
boolean found = false;
Collection<T> relationCollection = effectRelationMap.get(aid2);
if (relationCollection == null) {
relationCollection = new LinkedList<T>();
relationCollection.add(statement);
effectRelationMap.put(aid2, relationCollection);
} else {
for (T u : relationCollection) {
if (u.equals(statement)) {
found = true;
statement = u;
break;
}
}
if (!found) {
relationCollection.add(statement);
}
}
relationCollection = causeRelationMap.get(aid1);
if (relationCollection == null) {
relationCollection = new LinkedList<T>();
relationCollection.add(statement);
causeRelationMap.put(aid1, relationCollection);
} else {
if (!found) {
// if we had not found it in the first table, then we
// have to add it here too
relationCollection.add(statement);
}
}
if (!found) {
anonRelationCollection.add(statement);
}
} else {
Collection<T> relationCollection=namedRelationMap.get(id);
if (relationCollection==null) {
relationCollection=new LinkedList<T>();
relationCollection.add(statement);
namedRelationMap.put(id, relationCollection);
} else {
boolean found=false;
for (T u1: relationCollection) {
if (sameEdge(u1,statement,num)) {
found=true;
mergeAttributes(u1, statement);
break;
}
}
if (!found) {
relationCollection.add(statement);
}
}
}
return statement;
} | [
"public",
"<",
"T",
"extends",
"Relation",
">",
"T",
"add",
"(",
"T",
"statement",
",",
"int",
"num",
",",
"Collection",
"<",
"T",
">",
"anonRelationCollection",
",",
"HashMap",
"<",
"QualifiedName",
",",
"Collection",
"<",
"T",
">",
">",
"namedRelationMap... | Add an edge to the graph. Update namedRelationMap, effectRelationMap and causeRelationMap, accordingly.
Edges with different attributes are considered distinct. | [
"Add",
"an",
"edge",
"to",
"the",
"graph",
".",
"Update",
"namedRelationMap",
"effectRelationMap",
"and",
"causeRelationMap",
"accordingly",
".",
"Edges",
"with",
"different",
"attributes",
"are",
"considered",
"distinct",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-model/src/main/java/org/openprovenance/prov/model/IndexedDocument.java#L414-L490 |
37,182 | lucmoreau/ProvToolbox | prov-xml/src/main/java/org/openprovenance/prov/xml/AnyAdapter.java | AnyAdapter.marshal | public Object marshal(org.openprovenance.prov.model.Attribute attribute) {
return DOMProcessing.marshalAttribute(attribute);
} | java | public Object marshal(org.openprovenance.prov.model.Attribute attribute) {
return DOMProcessing.marshalAttribute(attribute);
} | [
"public",
"Object",
"marshal",
"(",
"org",
".",
"openprovenance",
".",
"prov",
".",
"model",
".",
"Attribute",
"attribute",
")",
"{",
"return",
"DOMProcessing",
".",
"marshalAttribute",
"(",
"attribute",
")",
";",
"}"
] | Marshals an Attribute to a DOM Element.
@see javax.xml.bind.annotation.adapters.XmlAdapter#marshal(java.lang.Object) | [
"Marshals",
"an",
"Attribute",
"to",
"a",
"DOM",
"Element",
"."
] | f865952868ffb69432937b08728c86bebbe4678a | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-xml/src/main/java/org/openprovenance/prov/xml/AnyAdapter.java#L56-L58 |
37,183 | sniggle/simple-pgp | simple-pgp-java/src/main/java/me/sniggle/pgp/crypt/internal/BasePGPCommon.java | BasePGPCommon.retrieveSecretKey | protected PGPSecretKey retrieveSecretKey(PGPSecretKeyRingCollection secretKeyRingCollection, KeyFilter<PGPSecretKey> keyFilter) throws PGPException {
LOGGER.trace("retrieveSecretKey(PGPSecretKeyRingCollection, KeyFilter<PGPSecretKey>)");
LOGGER.trace("Secret KeyRing Collection: {}, Key Filter: {}", secretKeyRingCollection == null ? "not set" : "set", keyFilter == null ? "not set" : "set");
PGPSecretKey result = null;
Iterator<PGPSecretKeyRing> secretKeyRingIterator = secretKeyRingCollection.getKeyRings();
PGPSecretKeyRing secretKeyRing = null;
LOGGER.debug("Iterating secret key ring");
while( result == null && secretKeyRingIterator.hasNext() ) {
secretKeyRing = secretKeyRingIterator.next();
Iterator<PGPSecretKey> secretKeyIterator = secretKeyRing.getSecretKeys();
LOGGER.debug("Iterating secret keys in key ring");
while( secretKeyIterator.hasNext() ) {
PGPSecretKey secretKey = secretKeyIterator.next();
LOGGER.info("Found secret key: {}", secretKey.getKeyID());
LOGGER.debug("Checking secret key with filter");
if (keyFilter.accept(secretKey)) {
LOGGER.info("Key {} selected from secret key ring");
result = secretKey;
}
}
}
return result;
} | java | protected PGPSecretKey retrieveSecretKey(PGPSecretKeyRingCollection secretKeyRingCollection, KeyFilter<PGPSecretKey> keyFilter) throws PGPException {
LOGGER.trace("retrieveSecretKey(PGPSecretKeyRingCollection, KeyFilter<PGPSecretKey>)");
LOGGER.trace("Secret KeyRing Collection: {}, Key Filter: {}", secretKeyRingCollection == null ? "not set" : "set", keyFilter == null ? "not set" : "set");
PGPSecretKey result = null;
Iterator<PGPSecretKeyRing> secretKeyRingIterator = secretKeyRingCollection.getKeyRings();
PGPSecretKeyRing secretKeyRing = null;
LOGGER.debug("Iterating secret key ring");
while( result == null && secretKeyRingIterator.hasNext() ) {
secretKeyRing = secretKeyRingIterator.next();
Iterator<PGPSecretKey> secretKeyIterator = secretKeyRing.getSecretKeys();
LOGGER.debug("Iterating secret keys in key ring");
while( secretKeyIterator.hasNext() ) {
PGPSecretKey secretKey = secretKeyIterator.next();
LOGGER.info("Found secret key: {}", secretKey.getKeyID());
LOGGER.debug("Checking secret key with filter");
if (keyFilter.accept(secretKey)) {
LOGGER.info("Key {} selected from secret key ring");
result = secretKey;
}
}
}
return result;
} | [
"protected",
"PGPSecretKey",
"retrieveSecretKey",
"(",
"PGPSecretKeyRingCollection",
"secretKeyRingCollection",
",",
"KeyFilter",
"<",
"PGPSecretKey",
">",
"keyFilter",
")",
"throws",
"PGPException",
"{",
"LOGGER",
".",
"trace",
"(",
"\"retrieveSecretKey(PGPSecretKeyRingColle... | retrieve the appropriate secret key from the secret key ring collection
based on the key filter
@param secretKeyRingCollection
the PGP secret key ring collection
@param keyFilter
the key filter to apply
@return the secret key or null if none matches the filter
@throws PGPException | [
"retrieve",
"the",
"appropriate",
"secret",
"key",
"from",
"the",
"secret",
"key",
"ring",
"collection",
"based",
"on",
"the",
"key",
"filter"
] | 2ab83e4d370b8189f767d8e4e4c7e6020e60fbe3 | https://github.com/sniggle/simple-pgp/blob/2ab83e4d370b8189f767d8e4e4c7e6020e60fbe3/simple-pgp-java/src/main/java/me/sniggle/pgp/crypt/internal/BasePGPCommon.java#L79-L101 |
37,184 | sniggle/simple-pgp | simple-pgp-java/src/main/java/me/sniggle/pgp/crypt/internal/BasePGPCommon.java | BasePGPCommon.findSecretKey | protected PGPSecretKey findSecretKey(InputStream secretKey, final long keyId) throws IOException, PGPException {
LOGGER.trace("findSecretKey(InputStream, long)");
LOGGER.trace("Secret Key: {}, Key ID: {}", secretKey == null ? "not set" : "set", keyId);
return findSecretKey(secretKey, new KeyFilter<PGPSecretKey>() {
@Override
public boolean accept(PGPSecretKey secretKey) {
return secretKey.getKeyID() == keyId;
}
});
} | java | protected PGPSecretKey findSecretKey(InputStream secretKey, final long keyId) throws IOException, PGPException {
LOGGER.trace("findSecretKey(InputStream, long)");
LOGGER.trace("Secret Key: {}, Key ID: {}", secretKey == null ? "not set" : "set", keyId);
return findSecretKey(secretKey, new KeyFilter<PGPSecretKey>() {
@Override
public boolean accept(PGPSecretKey secretKey) {
return secretKey.getKeyID() == keyId;
}
});
} | [
"protected",
"PGPSecretKey",
"findSecretKey",
"(",
"InputStream",
"secretKey",
",",
"final",
"long",
"keyId",
")",
"throws",
"IOException",
",",
"PGPException",
"{",
"LOGGER",
".",
"trace",
"(",
"\"findSecretKey(InputStream, long)\"",
")",
";",
"LOGGER",
".",
"trace... | helper method to read a specific secret key
@param secretKey
the secret key stream
@param keyId
the key id
@return the applicable secret key or null if none is part of the stream for the key id
@throws IOException
@throws PGPException | [
"helper",
"method",
"to",
"read",
"a",
"specific",
"secret",
"key"
] | 2ab83e4d370b8189f767d8e4e4c7e6020e60fbe3 | https://github.com/sniggle/simple-pgp/blob/2ab83e4d370b8189f767d8e4e4c7e6020e60fbe3/simple-pgp-java/src/main/java/me/sniggle/pgp/crypt/internal/BasePGPCommon.java#L143-L152 |
37,185 | sniggle/simple-pgp | simple-pgp-java/src/main/java/me/sniggle/pgp/crypt/internal/BasePGPCommon.java | BasePGPCommon.findSecretKey | protected PGPSecretKey findSecretKey(InputStream secretKey, KeyFilter<PGPSecretKey> keyFilter) throws IOException, PGPException {
LOGGER.trace("findSecretKey(InputStream, KeyFilter<PGPSecretKey>)");
PGPSecretKey result = null;
LOGGER.debug("Wrapping secret key stream in ArmoredInputStream");
try( InputStream armoredSecretKey = new ArmoredInputStream(secretKey) ) {
LOGGER.debug("Creating PGPSecretKeyRingCollection");
PGPSecretKeyRingCollection keyRingCollection = new PGPSecretKeyRingCollection(armoredSecretKey, new BcKeyFingerprintCalculator());
result = retrieveSecretKey(keyRingCollection, keyFilter);
}
return result;
} | java | protected PGPSecretKey findSecretKey(InputStream secretKey, KeyFilter<PGPSecretKey> keyFilter) throws IOException, PGPException {
LOGGER.trace("findSecretKey(InputStream, KeyFilter<PGPSecretKey>)");
PGPSecretKey result = null;
LOGGER.debug("Wrapping secret key stream in ArmoredInputStream");
try( InputStream armoredSecretKey = new ArmoredInputStream(secretKey) ) {
LOGGER.debug("Creating PGPSecretKeyRingCollection");
PGPSecretKeyRingCollection keyRingCollection = new PGPSecretKeyRingCollection(armoredSecretKey, new BcKeyFingerprintCalculator());
result = retrieveSecretKey(keyRingCollection, keyFilter);
}
return result;
} | [
"protected",
"PGPSecretKey",
"findSecretKey",
"(",
"InputStream",
"secretKey",
",",
"KeyFilter",
"<",
"PGPSecretKey",
">",
"keyFilter",
")",
"throws",
"IOException",
",",
"PGPException",
"{",
"LOGGER",
".",
"trace",
"(",
"\"findSecretKey(InputStream, KeyFilter<PGPSecretKe... | reads the given secret key and applies the provided key filter
@param secretKey
the secret key stream
@param keyFilter
the filter to apply on the stream
@return the secret key or null if none matches the filter acceptance criteria
@throws IOException
@throws PGPException | [
"reads",
"the",
"given",
"secret",
"key",
"and",
"applies",
"the",
"provided",
"key",
"filter"
] | 2ab83e4d370b8189f767d8e4e4c7e6020e60fbe3 | https://github.com/sniggle/simple-pgp/blob/2ab83e4d370b8189f767d8e4e4c7e6020e60fbe3/simple-pgp-java/src/main/java/me/sniggle/pgp/crypt/internal/BasePGPCommon.java#L165-L175 |
37,186 | sniggle/simple-pgp | simple-pgp-java/src/main/java/me/sniggle/pgp/crypt/internal/BasePGPCommon.java | BasePGPCommon.findPrivateKey | protected PGPPrivateKey findPrivateKey(PGPSecretKey pgpSecretKey, String password) throws PGPException {
LOGGER.trace("findPrivateKey(PGPSecretKey, String)");
LOGGER.trace("Secret Key: {}, Password: {}", pgpSecretKey == null ? "not set" : "set", password == null ? "not set" : "********");
PGPPrivateKey result = null;
PBESecretKeyDecryptor pbeSecretKeyDecryptor = new BcPBESecretKeyDecryptorBuilder(new BcPGPDigestCalculatorProvider()).build(password.toCharArray());
LOGGER.info("Extracting private key");
result = pgpSecretKey.extractPrivateKey(pbeSecretKeyDecryptor);
if( result == null && LOGGER.isErrorEnabled() ) {
LOGGER.error("No private key could be extracted");
}
return result;
} | java | protected PGPPrivateKey findPrivateKey(PGPSecretKey pgpSecretKey, String password) throws PGPException {
LOGGER.trace("findPrivateKey(PGPSecretKey, String)");
LOGGER.trace("Secret Key: {}, Password: {}", pgpSecretKey == null ? "not set" : "set", password == null ? "not set" : "********");
PGPPrivateKey result = null;
PBESecretKeyDecryptor pbeSecretKeyDecryptor = new BcPBESecretKeyDecryptorBuilder(new BcPGPDigestCalculatorProvider()).build(password.toCharArray());
LOGGER.info("Extracting private key");
result = pgpSecretKey.extractPrivateKey(pbeSecretKeyDecryptor);
if( result == null && LOGGER.isErrorEnabled() ) {
LOGGER.error("No private key could be extracted");
}
return result;
} | [
"protected",
"PGPPrivateKey",
"findPrivateKey",
"(",
"PGPSecretKey",
"pgpSecretKey",
",",
"String",
"password",
")",
"throws",
"PGPException",
"{",
"LOGGER",
".",
"trace",
"(",
"\"findPrivateKey(PGPSecretKey, String)\"",
")",
";",
"LOGGER",
".",
"trace",
"(",
"\"Secre... | read the private key from the given secret key
@param pgpSecretKey
the secret key
@param password
the password to unlock the private key
@return the unlocked private key
@throws PGPException | [
"read",
"the",
"private",
"key",
"from",
"the",
"given",
"secret",
"key"
] | 2ab83e4d370b8189f767d8e4e4c7e6020e60fbe3 | https://github.com/sniggle/simple-pgp/blob/2ab83e4d370b8189f767d8e4e4c7e6020e60fbe3/simple-pgp-java/src/main/java/me/sniggle/pgp/crypt/internal/BasePGPCommon.java#L261-L272 |
37,187 | sniggle/simple-pgp | simple-pgp-java/src/main/java/me/sniggle/pgp/crypt/internal/BasePGPCommon.java | BasePGPCommon.findPublicKey | protected PGPPublicKey findPublicKey(InputStream publicKey, KeyFilter<PGPPublicKey> keyFilter ) {
LOGGER.trace("findPublicKey(InputStream, KeyFilter<PGPPublicKey>)");
LOGGER.trace("Public Key: {}, Key Filter: {}", publicKey == null ? "not set" : "set", keyFilter == null ? "not set" : "set");
return retrievePublicKey(readPublicKeyRing(publicKey), keyFilter);
} | java | protected PGPPublicKey findPublicKey(InputStream publicKey, KeyFilter<PGPPublicKey> keyFilter ) {
LOGGER.trace("findPublicKey(InputStream, KeyFilter<PGPPublicKey>)");
LOGGER.trace("Public Key: {}, Key Filter: {}", publicKey == null ? "not set" : "set", keyFilter == null ? "not set" : "set");
return retrievePublicKey(readPublicKeyRing(publicKey), keyFilter);
} | [
"protected",
"PGPPublicKey",
"findPublicKey",
"(",
"InputStream",
"publicKey",
",",
"KeyFilter",
"<",
"PGPPublicKey",
">",
"keyFilter",
")",
"{",
"LOGGER",
".",
"trace",
"(",
"\"findPublicKey(InputStream, KeyFilter<PGPPublicKey>)\"",
")",
";",
"LOGGER",
".",
"trace",
... | reads the public key from the given stream
@param publicKey
the input key stream
@param keyFilter
the filter to apply
@return the matching PGP public key | [
"reads",
"the",
"public",
"key",
"from",
"the",
"given",
"stream"
] | 2ab83e4d370b8189f767d8e4e4c7e6020e60fbe3 | https://github.com/sniggle/simple-pgp/blob/2ab83e4d370b8189f767d8e4e4c7e6020e60fbe3/simple-pgp-java/src/main/java/me/sniggle/pgp/crypt/internal/BasePGPCommon.java#L283-L287 |
37,188 | sniggle/simple-pgp | simple-pgp-java/src/main/java/me/sniggle/pgp/crypt/internal/BasePGPCommon.java | BasePGPCommon.retrievePublicKey | protected PGPPublicKey retrievePublicKey(PGPPublicKeyRing publicKeyRing, KeyFilter<PGPPublicKey> keyFilter) {
LOGGER.trace("retrievePublicKey(PGPPublicKeyRing, KeyFilter<PGPPublicKey>)");
PGPPublicKey result = null;
Iterator<PGPPublicKey> publicKeyIterator = publicKeyRing.getPublicKeys();
LOGGER.debug("Iterating through public keys in public key ring");
while( result == null && publicKeyIterator.hasNext() ) {
PGPPublicKey key = publicKeyIterator.next();
LOGGER.info("Found secret key: {}", key.getKeyID());
LOGGER.debug("Checking public key with filter");
if( keyFilter.accept(key) ) {
LOGGER.info("Public key {} selected from key ring", key.getKeyID());
result = key;
}
}
return result;
} | java | protected PGPPublicKey retrievePublicKey(PGPPublicKeyRing publicKeyRing, KeyFilter<PGPPublicKey> keyFilter) {
LOGGER.trace("retrievePublicKey(PGPPublicKeyRing, KeyFilter<PGPPublicKey>)");
PGPPublicKey result = null;
Iterator<PGPPublicKey> publicKeyIterator = publicKeyRing.getPublicKeys();
LOGGER.debug("Iterating through public keys in public key ring");
while( result == null && publicKeyIterator.hasNext() ) {
PGPPublicKey key = publicKeyIterator.next();
LOGGER.info("Found secret key: {}", key.getKeyID());
LOGGER.debug("Checking public key with filter");
if( keyFilter.accept(key) ) {
LOGGER.info("Public key {} selected from key ring", key.getKeyID());
result = key;
}
}
return result;
} | [
"protected",
"PGPPublicKey",
"retrievePublicKey",
"(",
"PGPPublicKeyRing",
"publicKeyRing",
",",
"KeyFilter",
"<",
"PGPPublicKey",
">",
"keyFilter",
")",
"{",
"LOGGER",
".",
"trace",
"(",
"\"retrievePublicKey(PGPPublicKeyRing, KeyFilter<PGPPublicKey>)\"",
")",
";",
"PGPPubl... | reads the PGP public key from a PublicKeyRing
@param publicKeyRing
the source public key ring
@param keyFilter
the filter to apply
@return the matching PGP public or null if none matches | [
"reads",
"the",
"PGP",
"public",
"key",
"from",
"a",
"PublicKeyRing"
] | 2ab83e4d370b8189f767d8e4e4c7e6020e60fbe3 | https://github.com/sniggle/simple-pgp/blob/2ab83e4d370b8189f767d8e4e4c7e6020e60fbe3/simple-pgp-java/src/main/java/me/sniggle/pgp/crypt/internal/BasePGPCommon.java#L298-L313 |
37,189 | sniggle/simple-pgp | simple-pgp-java/src/main/java/me/sniggle/pgp/crypt/internal/BasePGPCommon.java | BasePGPCommon.readPublicKeyRing | protected PGPPublicKeyRing readPublicKeyRing(InputStream publicKey) {
LOGGER.trace("readPublicKeyRing(InputStream)");
PGPPublicKeyRing result = null;
LOGGER.debug("Wrapping public key stream in decoder stream");
try( InputStream decoderStream = PGPUtil.getDecoderStream(publicKey) ) {
LOGGER.debug("Creating PGP Object Factory");
PGPObjectFactory pgpObjectFactory = new PGPObjectFactory(decoderStream, new BcKeyFingerprintCalculator());
Object o = null;
LOGGER.debug("Looking up PGP Public KeyRing");
while( (o = pgpObjectFactory.nextObject()) != null && result == null ) {
if( o instanceof PGPPublicKeyRing ) {
LOGGER.info("PGP Public KeyRing retrieved");
result = (PGPPublicKeyRing)o;
}
}
} catch (IOException e) {
LOGGER.error("{}", e.getMessage());
}
return result;
} | java | protected PGPPublicKeyRing readPublicKeyRing(InputStream publicKey) {
LOGGER.trace("readPublicKeyRing(InputStream)");
PGPPublicKeyRing result = null;
LOGGER.debug("Wrapping public key stream in decoder stream");
try( InputStream decoderStream = PGPUtil.getDecoderStream(publicKey) ) {
LOGGER.debug("Creating PGP Object Factory");
PGPObjectFactory pgpObjectFactory = new PGPObjectFactory(decoderStream, new BcKeyFingerprintCalculator());
Object o = null;
LOGGER.debug("Looking up PGP Public KeyRing");
while( (o = pgpObjectFactory.nextObject()) != null && result == null ) {
if( o instanceof PGPPublicKeyRing ) {
LOGGER.info("PGP Public KeyRing retrieved");
result = (PGPPublicKeyRing)o;
}
}
} catch (IOException e) {
LOGGER.error("{}", e.getMessage());
}
return result;
} | [
"protected",
"PGPPublicKeyRing",
"readPublicKeyRing",
"(",
"InputStream",
"publicKey",
")",
"{",
"LOGGER",
".",
"trace",
"(",
"\"readPublicKeyRing(InputStream)\"",
")",
";",
"PGPPublicKeyRing",
"result",
"=",
"null",
";",
"LOGGER",
".",
"debug",
"(",
"\"Wrapping publi... | reads the public key ring from the input stream
@param publicKey
the public key stream
@return the public key ring | [
"reads",
"the",
"public",
"key",
"ring",
"from",
"the",
"input",
"stream"
] | 2ab83e4d370b8189f767d8e4e4c7e6020e60fbe3 | https://github.com/sniggle/simple-pgp/blob/2ab83e4d370b8189f767d8e4e4c7e6020e60fbe3/simple-pgp-java/src/main/java/me/sniggle/pgp/crypt/internal/BasePGPCommon.java#L322-L341 |
37,190 | sniggle/simple-pgp | simple-pgp-api/src/main/java/me/sniggle/pgp/crypt/internal/io/IOUtils.java | IOUtils.copy | public static void copy(InputStream inputStream, OutputStream outputStream) throws IOException {
LOGGER.trace("copy(InputStream, OutputStream)");
copy(inputStream, outputStream, new byte[BUFFER_SIZE]);
} | java | public static void copy(InputStream inputStream, OutputStream outputStream) throws IOException {
LOGGER.trace("copy(InputStream, OutputStream)");
copy(inputStream, outputStream, new byte[BUFFER_SIZE]);
} | [
"public",
"static",
"void",
"copy",
"(",
"InputStream",
"inputStream",
",",
"OutputStream",
"outputStream",
")",
"throws",
"IOException",
"{",
"LOGGER",
".",
"trace",
"(",
"\"copy(InputStream, OutputStream)\"",
")",
";",
"copy",
"(",
"inputStream",
",",
"outputStrea... | copies the input stream to the output stream
@param inputStream
the source stream
@param outputStream
the target stream
@throws IOException | [
"copies",
"the",
"input",
"stream",
"to",
"the",
"output",
"stream"
] | 2ab83e4d370b8189f767d8e4e4c7e6020e60fbe3 | https://github.com/sniggle/simple-pgp/blob/2ab83e4d370b8189f767d8e4e4c7e6020e60fbe3/simple-pgp-api/src/main/java/me/sniggle/pgp/crypt/internal/io/IOUtils.java#L54-L57 |
37,191 | sniggle/simple-pgp | simple-pgp-api/src/main/java/me/sniggle/pgp/crypt/internal/io/IOUtils.java | IOUtils.copy | public static void copy(InputStream inputStream, OutputStream outputStream, byte[] buffer) throws IOException {
LOGGER.trace("copy(InputStream, OutputStream, byte[])");
copy(inputStream, outputStream, buffer, null);
} | java | public static void copy(InputStream inputStream, OutputStream outputStream, byte[] buffer) throws IOException {
LOGGER.trace("copy(InputStream, OutputStream, byte[])");
copy(inputStream, outputStream, buffer, null);
} | [
"public",
"static",
"void",
"copy",
"(",
"InputStream",
"inputStream",
",",
"OutputStream",
"outputStream",
",",
"byte",
"[",
"]",
"buffer",
")",
"throws",
"IOException",
"{",
"LOGGER",
".",
"trace",
"(",
"\"copy(InputStream, OutputStream, byte[])\"",
")",
";",
"c... | copies the input stream to the output stream using a custom buffer size
@param inputStream
the source stream
@param outputStream
the target strem
@param buffer
the custom buffer
@throws IOException | [
"copies",
"the",
"input",
"stream",
"to",
"the",
"output",
"stream",
"using",
"a",
"custom",
"buffer",
"size"
] | 2ab83e4d370b8189f767d8e4e4c7e6020e60fbe3 | https://github.com/sniggle/simple-pgp/blob/2ab83e4d370b8189f767d8e4e4c7e6020e60fbe3/simple-pgp-api/src/main/java/me/sniggle/pgp/crypt/internal/io/IOUtils.java#L70-L73 |
37,192 | sniggle/simple-pgp | simple-pgp-api/src/main/java/me/sniggle/pgp/crypt/internal/io/IOUtils.java | IOUtils.copy | public static void copy(InputStream inputStream, final OutputStream outputStream, byte[] buffer, final StreamHandler addtionalHandling) throws IOException {
LOGGER.trace("copy(InputStream, OutputStream, byte[], StreamHandler)");
LOGGER.debug("buffer size: {} bytes", (buffer!=null) ? buffer.length : "null");
process(inputStream, new StreamHandler() {
@Override
public void handleStreamBuffer(byte[] buffer, int offset, int length) throws IOException {
outputStream.write(buffer, offset, length);
if( addtionalHandling != null ) {
addtionalHandling.handleStreamBuffer(buffer, offset, length);
}
}
}, buffer);
} | java | public static void copy(InputStream inputStream, final OutputStream outputStream, byte[] buffer, final StreamHandler addtionalHandling) throws IOException {
LOGGER.trace("copy(InputStream, OutputStream, byte[], StreamHandler)");
LOGGER.debug("buffer size: {} bytes", (buffer!=null) ? buffer.length : "null");
process(inputStream, new StreamHandler() {
@Override
public void handleStreamBuffer(byte[] buffer, int offset, int length) throws IOException {
outputStream.write(buffer, offset, length);
if( addtionalHandling != null ) {
addtionalHandling.handleStreamBuffer(buffer, offset, length);
}
}
}, buffer);
} | [
"public",
"static",
"void",
"copy",
"(",
"InputStream",
"inputStream",
",",
"final",
"OutputStream",
"outputStream",
",",
"byte",
"[",
"]",
"buffer",
",",
"final",
"StreamHandler",
"addtionalHandling",
")",
"throws",
"IOException",
"{",
"LOGGER",
".",
"trace",
"... | copies the input stream to the output stream using a custom buffer size and applying additional stream handling
@param inputStream
the source stream
@param outputStream
the target stream
@param buffer
the custom buffer
@param addtionalHandling
a stream handler that allows additional handling of the stream
@throws IOException | [
"copies",
"the",
"input",
"stream",
"to",
"the",
"output",
"stream",
"using",
"a",
"custom",
"buffer",
"size",
"and",
"applying",
"additional",
"stream",
"handling"
] | 2ab83e4d370b8189f767d8e4e4c7e6020e60fbe3 | https://github.com/sniggle/simple-pgp/blob/2ab83e4d370b8189f767d8e4e4c7e6020e60fbe3/simple-pgp-api/src/main/java/me/sniggle/pgp/crypt/internal/io/IOUtils.java#L88-L101 |
37,193 | sniggle/simple-pgp | simple-pgp-api/src/main/java/me/sniggle/pgp/crypt/internal/io/IOUtils.java | IOUtils.process | public static void process(InputStream inputStream, StreamHandler handler) throws IOException {
LOGGER.trace("process(InputStream, StreamHandler)");
process(inputStream, handler, new byte[BUFFER_SIZE]);
} | java | public static void process(InputStream inputStream, StreamHandler handler) throws IOException {
LOGGER.trace("process(InputStream, StreamHandler)");
process(inputStream, handler, new byte[BUFFER_SIZE]);
} | [
"public",
"static",
"void",
"process",
"(",
"InputStream",
"inputStream",
",",
"StreamHandler",
"handler",
")",
"throws",
"IOException",
"{",
"LOGGER",
".",
"trace",
"(",
"\"process(InputStream, StreamHandler)\"",
")",
";",
"process",
"(",
"inputStream",
",",
"handl... | generic processing of a stream
@param inputStream
the input stream to process
@param handler
the handler to apply on the stream
@throws IOException | [
"generic",
"processing",
"of",
"a",
"stream"
] | 2ab83e4d370b8189f767d8e4e4c7e6020e60fbe3 | https://github.com/sniggle/simple-pgp/blob/2ab83e4d370b8189f767d8e4e4c7e6020e60fbe3/simple-pgp-api/src/main/java/me/sniggle/pgp/crypt/internal/io/IOUtils.java#L112-L115 |
37,194 | sniggle/simple-pgp | simple-pgp-api/src/main/java/me/sniggle/pgp/crypt/internal/io/IOUtils.java | IOUtils.process | public static void process(InputStream inputStream, StreamHandler handler, byte[] buffer) throws IOException {
LOGGER.trace("process(InputStream, StreamHandler, byte[])");
LOGGER.debug("buffer size: {} bytes", buffer != null ? buffer.length : "null");
int read = -1;
while( (read = inputStream.read(buffer)) != -1 ) {
LOGGER.debug("{} bytes read from stream", read);
handler.handleStreamBuffer(buffer, 0, read);
}
} | java | public static void process(InputStream inputStream, StreamHandler handler, byte[] buffer) throws IOException {
LOGGER.trace("process(InputStream, StreamHandler, byte[])");
LOGGER.debug("buffer size: {} bytes", buffer != null ? buffer.length : "null");
int read = -1;
while( (read = inputStream.read(buffer)) != -1 ) {
LOGGER.debug("{} bytes read from stream", read);
handler.handleStreamBuffer(buffer, 0, read);
}
} | [
"public",
"static",
"void",
"process",
"(",
"InputStream",
"inputStream",
",",
"StreamHandler",
"handler",
",",
"byte",
"[",
"]",
"buffer",
")",
"throws",
"IOException",
"{",
"LOGGER",
".",
"trace",
"(",
"\"process(InputStream, StreamHandler, byte[])\"",
")",
";",
... | generic processing of a stream with a custom buffer
@param inputStream
the input stream to process
@param handler
the handler to apply on the stream
@param buffer
the buffer to use for stream handling
@throws IOException | [
"generic",
"processing",
"of",
"a",
"stream",
"with",
"a",
"custom",
"buffer"
] | 2ab83e4d370b8189f767d8e4e4c7e6020e60fbe3 | https://github.com/sniggle/simple-pgp/blob/2ab83e4d370b8189f767d8e4e4c7e6020e60fbe3/simple-pgp-api/src/main/java/me/sniggle/pgp/crypt/internal/io/IOUtils.java#L128-L136 |
37,195 | sniggle/simple-pgp | simple-pgp-java/src/main/java/me/sniggle/pgp/crypt/PGPKeyPairGenerator.java | PGPKeyPairGenerator.createKeyRingGenerator | private PGPKeyRingGenerator createKeyRingGenerator(String userId, String password, int keySize) {
LOGGER.trace("createKeyRingGenerator(String, String, int)");
LOGGER.trace("User ID: {}, Password: {}, Key Size: {}", userId, password == null ? "not set" : "********", keySize);
PGPKeyRingGenerator generator = null;
try {
LOGGER.debug("Creating RSA key pair generator");
RSAKeyPairGenerator generator1 = new RSAKeyPairGenerator();
generator1.init(new RSAKeyGenerationParameters(BigInteger.valueOf(0x10001), getSecureRandom(), keySize, 12));
LOGGER.debug("Generating Signing Key Pair");
BcPGPKeyPair signingKeyPair = new BcPGPKeyPair(PGPPublicKey.RSA_SIGN, generator1.generateKeyPair(), new Date());
LOGGER.debug("Generating Encyption Key Pair");
BcPGPKeyPair encryptionKeyPair = new BcPGPKeyPair(PGPPublicKey.RSA_ENCRYPT, generator1.generateKeyPair(), new Date());
LOGGER.debug("Generating Signature Key Properties");
PGPSignatureSubpacketGenerator signatureSubpacketGenerator = new PGPSignatureSubpacketGenerator();
signatureSubpacketGenerator.setKeyFlags(false, KeyFlags.SIGN_DATA | KeyFlags.CERTIFY_OTHER);
signatureSubpacketGenerator.setPreferredSymmetricAlgorithms(false, getPreferredEncryptionAlgorithms());
signatureSubpacketGenerator.setPreferredHashAlgorithms(false, getPreferredHashingAlgorithms());
signatureSubpacketGenerator.setPreferredCompressionAlgorithms(false, getPreferredCompressionAlgorithms());
LOGGER.debug("Generating Encyption Key Properties");
PGPSignatureSubpacketGenerator encryptionSubpacketGenerator = new PGPSignatureSubpacketGenerator();
encryptionSubpacketGenerator.setKeyFlags(false, KeyFlags.ENCRYPT_COMMS | KeyFlags.ENCRYPT_STORAGE);
LOGGER.info("Creating PGP Key Ring Generator");
generator = new PGPKeyRingGenerator(PGPPublicKey.RSA_SIGN, signingKeyPair, userId, new BcPGPDigestCalculatorProvider().get(HashAlgorithmTags.SHA1), signatureSubpacketGenerator.generate(), null, new BcPGPContentSignerBuilder(PGPPublicKey.RSA_SIGN, HashAlgorithmTags.SHA256), new BcPBESecretKeyEncryptorBuilder(getEncryptionAlgorithm()).build(password.toCharArray()));
generator.addSubKey(encryptionKeyPair, encryptionSubpacketGenerator.generate(), null);
} catch (PGPException e) {
LOGGER.error("{}", e.getMessage());
generator = null;
}
return generator;
} | java | private PGPKeyRingGenerator createKeyRingGenerator(String userId, String password, int keySize) {
LOGGER.trace("createKeyRingGenerator(String, String, int)");
LOGGER.trace("User ID: {}, Password: {}, Key Size: {}", userId, password == null ? "not set" : "********", keySize);
PGPKeyRingGenerator generator = null;
try {
LOGGER.debug("Creating RSA key pair generator");
RSAKeyPairGenerator generator1 = new RSAKeyPairGenerator();
generator1.init(new RSAKeyGenerationParameters(BigInteger.valueOf(0x10001), getSecureRandom(), keySize, 12));
LOGGER.debug("Generating Signing Key Pair");
BcPGPKeyPair signingKeyPair = new BcPGPKeyPair(PGPPublicKey.RSA_SIGN, generator1.generateKeyPair(), new Date());
LOGGER.debug("Generating Encyption Key Pair");
BcPGPKeyPair encryptionKeyPair = new BcPGPKeyPair(PGPPublicKey.RSA_ENCRYPT, generator1.generateKeyPair(), new Date());
LOGGER.debug("Generating Signature Key Properties");
PGPSignatureSubpacketGenerator signatureSubpacketGenerator = new PGPSignatureSubpacketGenerator();
signatureSubpacketGenerator.setKeyFlags(false, KeyFlags.SIGN_DATA | KeyFlags.CERTIFY_OTHER);
signatureSubpacketGenerator.setPreferredSymmetricAlgorithms(false, getPreferredEncryptionAlgorithms());
signatureSubpacketGenerator.setPreferredHashAlgorithms(false, getPreferredHashingAlgorithms());
signatureSubpacketGenerator.setPreferredCompressionAlgorithms(false, getPreferredCompressionAlgorithms());
LOGGER.debug("Generating Encyption Key Properties");
PGPSignatureSubpacketGenerator encryptionSubpacketGenerator = new PGPSignatureSubpacketGenerator();
encryptionSubpacketGenerator.setKeyFlags(false, KeyFlags.ENCRYPT_COMMS | KeyFlags.ENCRYPT_STORAGE);
LOGGER.info("Creating PGP Key Ring Generator");
generator = new PGPKeyRingGenerator(PGPPublicKey.RSA_SIGN, signingKeyPair, userId, new BcPGPDigestCalculatorProvider().get(HashAlgorithmTags.SHA1), signatureSubpacketGenerator.generate(), null, new BcPGPContentSignerBuilder(PGPPublicKey.RSA_SIGN, HashAlgorithmTags.SHA256), new BcPBESecretKeyEncryptorBuilder(getEncryptionAlgorithm()).build(password.toCharArray()));
generator.addSubKey(encryptionKeyPair, encryptionSubpacketGenerator.generate(), null);
} catch (PGPException e) {
LOGGER.error("{}", e.getMessage());
generator = null;
}
return generator;
} | [
"private",
"PGPKeyRingGenerator",
"createKeyRingGenerator",
"(",
"String",
"userId",
",",
"String",
"password",
",",
"int",
"keySize",
")",
"{",
"LOGGER",
".",
"trace",
"(",
"\"createKeyRingGenerator(String, String, int)\"",
")",
";",
"LOGGER",
".",
"trace",
"(",
"\... | creates and initializes a PGP Key Ring Generator
@param userId
the user id to use
@param password
the password used for the private key
@param keySize
the key size used for the keys
@return the initialized key ring generator or null if something goes wrong | [
"creates",
"and",
"initializes",
"a",
"PGP",
"Key",
"Ring",
"Generator"
] | 2ab83e4d370b8189f767d8e4e4c7e6020e60fbe3 | https://github.com/sniggle/simple-pgp/blob/2ab83e4d370b8189f767d8e4e4c7e6020e60fbe3/simple-pgp-java/src/main/java/me/sniggle/pgp/crypt/PGPKeyPairGenerator.java#L47-L78 |
37,196 | foo4u/spring-mvc-cache-control | spring-mvc-cache-control-demo/src/main/java/net/rossillo/spring/web/mvc/demo/DemoController.java | DemoController.handleProducDirectionsRequest | @CacheControl(policy = { CachePolicy.MUST_REVALIDATE }, maxAge = 15 * 60)
@RequestMapping("/directions.do")
public String handleProducDirectionsRequest(Model model) {
model.addAttribute("pageName", "Directions");
return "page";
} | java | @CacheControl(policy = { CachePolicy.MUST_REVALIDATE }, maxAge = 15 * 60)
@RequestMapping("/directions.do")
public String handleProducDirectionsRequest(Model model) {
model.addAttribute("pageName", "Directions");
return "page";
} | [
"@",
"CacheControl",
"(",
"policy",
"=",
"{",
"CachePolicy",
".",
"MUST_REVALIDATE",
"}",
",",
"maxAge",
"=",
"15",
"*",
"60",
")",
"@",
"RequestMapping",
"(",
"\"/directions.do\"",
")",
"public",
"String",
"handleProducDirectionsRequest",
"(",
"Model",
"model",... | Directions page allowing caching for 15 minutes, but requiring
re-revalidation before serving user a potentially stale resource. | [
"Directions",
"page",
"allowing",
"caching",
"for",
"15",
"minutes",
"but",
"requiring",
"re",
"-",
"revalidation",
"before",
"serving",
"user",
"a",
"potentially",
"stale",
"resource",
"."
] | ccfe110e17341ecaa45e7e81aca3fd380bbae649 | https://github.com/foo4u/spring-mvc-cache-control/blob/ccfe110e17341ecaa45e7e81aca3fd380bbae649/spring-mvc-cache-control-demo/src/main/java/net/rossillo/spring/web/mvc/demo/DemoController.java#L35-L40 |
37,197 | foo4u/spring-mvc-cache-control | spring-mvc-cache-control-demo/src/main/java/net/rossillo/spring/web/mvc/demo/DemoController.java | DemoController.handleAccountRequest | @CacheControl(policy = { CachePolicy.PRIVATE, CachePolicy.MUST_REVALIDATE })
@RequestMapping("/account.do")
public String handleAccountRequest(Model model) {
model.addAttribute("pageName", "Your Account");
return "page";
} | java | @CacheControl(policy = { CachePolicy.PRIVATE, CachePolicy.MUST_REVALIDATE })
@RequestMapping("/account.do")
public String handleAccountRequest(Model model) {
model.addAttribute("pageName", "Your Account");
return "page";
} | [
"@",
"CacheControl",
"(",
"policy",
"=",
"{",
"CachePolicy",
".",
"PRIVATE",
",",
"CachePolicy",
".",
"MUST_REVALIDATE",
"}",
")",
"@",
"RequestMapping",
"(",
"\"/account.do\"",
")",
"public",
"String",
"handleAccountRequest",
"(",
"Model",
"model",
")",
"{",
... | Personalized accounts page. Content is private to the user
so it should only be stored in a private cache. | [
"Personalized",
"accounts",
"page",
".",
"Content",
"is",
"private",
"to",
"the",
"user",
"so",
"it",
"should",
"only",
"be",
"stored",
"in",
"a",
"private",
"cache",
"."
] | ccfe110e17341ecaa45e7e81aca3fd380bbae649 | https://github.com/foo4u/spring-mvc-cache-control/blob/ccfe110e17341ecaa45e7e81aca3fd380bbae649/spring-mvc-cache-control-demo/src/main/java/net/rossillo/spring/web/mvc/demo/DemoController.java#L46-L51 |
37,198 | jenkinsci/multi-branch-project-plugin | src/main/java/com/github/mjdetullio/jenkins/plugins/multibranch/TemplateDrivenMultiBranchProject.java | TemplateDrivenMultiBranchProject.makeDisabled | public void makeDisabled(boolean b) throws IOException {
if (disabled == b) {
return;
}
this.disabled = b;
Collection<P> projects = getItems();
// Manage the sub-projects
if (b) {
/*
* Populate list only if it is empty. Running this loop when the
* parent (and therefore, all sub-projects) are already disabled will
* add all branches. Obviously not desirable.
*/
if (disabledSubProjects.isEmpty()) {
for (P project : projects) {
if (project.isDisabled()) {
disabledSubProjects.add(project.getName());
}
}
}
// Always forcefully disable all sub-projects
for (P project : projects) {
project.disable();
}
} else {
// Re-enable only the projects that weren't manually marked disabled
for (P project : projects) {
if (!disabledSubProjects.contains(project.getName())) {
project.enable();
}
}
// Clear the list so it can be rebuilt when parent is disabled
disabledSubProjects.clear();
}
save();
ItemListener.fireOnUpdated(this);
} | java | public void makeDisabled(boolean b) throws IOException {
if (disabled == b) {
return;
}
this.disabled = b;
Collection<P> projects = getItems();
// Manage the sub-projects
if (b) {
/*
* Populate list only if it is empty. Running this loop when the
* parent (and therefore, all sub-projects) are already disabled will
* add all branches. Obviously not desirable.
*/
if (disabledSubProjects.isEmpty()) {
for (P project : projects) {
if (project.isDisabled()) {
disabledSubProjects.add(project.getName());
}
}
}
// Always forcefully disable all sub-projects
for (P project : projects) {
project.disable();
}
} else {
// Re-enable only the projects that weren't manually marked disabled
for (P project : projects) {
if (!disabledSubProjects.contains(project.getName())) {
project.enable();
}
}
// Clear the list so it can be rebuilt when parent is disabled
disabledSubProjects.clear();
}
save();
ItemListener.fireOnUpdated(this);
} | [
"public",
"void",
"makeDisabled",
"(",
"boolean",
"b",
")",
"throws",
"IOException",
"{",
"if",
"(",
"disabled",
"==",
"b",
")",
"{",
"return",
";",
"}",
"this",
".",
"disabled",
"=",
"b",
";",
"Collection",
"<",
"P",
">",
"projects",
"=",
"getItems",
... | Marks the build as disabled.
@param b true - disable, false - enable
@throws IOException if problem saving | [
"Marks",
"the",
"build",
"as",
"disabled",
"."
] | a98828f6b5ea4e0f69a83f3d274fe05063caad52 | https://github.com/jenkinsci/multi-branch-project-plugin/blob/a98828f6b5ea4e0f69a83f3d274fe05063caad52/src/main/java/com/github/mjdetullio/jenkins/plugins/multibranch/TemplateDrivenMultiBranchProject.java#L415-L456 |
37,199 | hawkular/hawkular-apm | client/collector/src/main/java/org/hawkular/apm/client/collector/internal/FilterProcessor.java | FilterProcessor.init | protected void init() {
for (int i = 0; i < config.getFilter().getInclusions().size(); i++) {
inclusions.add(Pattern.compile(config.getFilter().getInclusions().get(i)).asPredicate());
}
for (int i = 0; i < config.getFilter().getExclusions().size(); i++) {
exclusions.add(Pattern.compile(config.getFilter().getExclusions().get(i)).asPredicate());
}
} | java | protected void init() {
for (int i = 0; i < config.getFilter().getInclusions().size(); i++) {
inclusions.add(Pattern.compile(config.getFilter().getInclusions().get(i)).asPredicate());
}
for (int i = 0; i < config.getFilter().getExclusions().size(); i++) {
exclusions.add(Pattern.compile(config.getFilter().getExclusions().get(i)).asPredicate());
}
} | [
"protected",
"void",
"init",
"(",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"config",
".",
"getFilter",
"(",
")",
".",
"getInclusions",
"(",
")",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"inclusions",
".",
"add",
"(",
... | This method initialises the filter. | [
"This",
"method",
"initialises",
"the",
"filter",
"."
] | 57a4df0611b359597626563ea5f9ac64d4bb2533 | https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/client/collector/src/main/java/org/hawkular/apm/client/collector/internal/FilterProcessor.java#L62-L69 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.