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 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
fcrepo4/fcrepo4 | fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/ViewHelpers.java | ViewHelpers.isManagedProperty | public static boolean isManagedProperty(final Node property) {
return property.isURI() && isManagedPredicate.test(createProperty(property.getURI()));
} | java | public static boolean isManagedProperty(final Node property) {
return property.isURI() && isManagedPredicate.test(createProperty(property.getURI()));
} | [
"public",
"static",
"boolean",
"isManagedProperty",
"(",
"final",
"Node",
"property",
")",
"{",
"return",
"property",
".",
"isURI",
"(",
")",
"&&",
"isManagedPredicate",
".",
"test",
"(",
"createProperty",
"(",
"property",
".",
"getURI",
"(",
")",
")",
")",
... | Test if a Predicate is managed
@param property the property
@return whether the property is managed | [
"Test",
"if",
"a",
"Predicate",
"is",
"managed"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/ViewHelpers.java#L470-L472 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/FedoraBinaryImpl.java | FedoraBinaryImpl.getBinary | private FedoraBinary getBinary(final String extUrl) {
if (wrappedBinary == null) {
wrappedBinary = getBinaryImplementation(extUrl);
}
return wrappedBinary;
} | java | private FedoraBinary getBinary(final String extUrl) {
if (wrappedBinary == null) {
wrappedBinary = getBinaryImplementation(extUrl);
}
return wrappedBinary;
} | [
"private",
"FedoraBinary",
"getBinary",
"(",
"final",
"String",
"extUrl",
")",
"{",
"if",
"(",
"wrappedBinary",
"==",
"null",
")",
"{",
"wrappedBinary",
"=",
"getBinaryImplementation",
"(",
"extUrl",
")",
";",
"}",
"return",
"wrappedBinary",
";",
"}"
] | Get the proxied binary content object wrapped by this object
@return the fedora binary | [
"Get",
"the",
"proxied",
"binary",
"content",
"object",
"wrapped",
"by",
"this",
"object"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/FedoraBinaryImpl.java#L75-L80 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/FedoraBinaryImpl.java | FedoraBinaryImpl.getBinaryImplementation | private FedoraBinary getBinaryImplementation(final String extUrl) {
String url = extUrl;
if (url == null || url.isEmpty()) {
url = getURLInfo();
}
if (url != null) {
if (url.toLowerCase().startsWith(LOCAL_FILE_ACCESS_TYPE)) {
return new LocalFileB... | java | private FedoraBinary getBinaryImplementation(final String extUrl) {
String url = extUrl;
if (url == null || url.isEmpty()) {
url = getURLInfo();
}
if (url != null) {
if (url.toLowerCase().startsWith(LOCAL_FILE_ACCESS_TYPE)) {
return new LocalFileB... | [
"private",
"FedoraBinary",
"getBinaryImplementation",
"(",
"final",
"String",
"extUrl",
")",
"{",
"String",
"url",
"=",
"extUrl",
";",
"if",
"(",
"url",
"==",
"null",
"||",
"url",
".",
"isEmpty",
"(",
")",
")",
"{",
"url",
"=",
"getURLInfo",
"(",
")",
... | Return the proper object that can handle this type of binary
@param extUrl URL of external binary, else null if it's internal to modeshape.
@return the fedora binary, of the proper kind based on the URL or lack there of | [
"Return",
"the",
"proper",
"object",
"that",
"can",
"handle",
"this",
"type",
"of",
"binary"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/FedoraBinaryImpl.java#L87-L102 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/FedoraBinaryImpl.java | FedoraBinaryImpl.getURLInfo | private String getURLInfo() {
try {
if (hasProperty(PROXY_FOR)) {
return getNode().getProperty(PROXY_FOR).getValue().getString();
} else if (hasProperty(REDIRECTS_TO)) {
return getNode().getProperty(REDIRECTS_TO).getValue().getString();
}
... | java | private String getURLInfo() {
try {
if (hasProperty(PROXY_FOR)) {
return getNode().getProperty(PROXY_FOR).getValue().getString();
} else if (hasProperty(REDIRECTS_TO)) {
return getNode().getProperty(REDIRECTS_TO).getValue().getString();
}
... | [
"private",
"String",
"getURLInfo",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"hasProperty",
"(",
"PROXY_FOR",
")",
")",
"{",
"return",
"getNode",
"(",
")",
".",
"getProperty",
"(",
"PROXY_FOR",
")",
".",
"getValue",
"(",
")",
".",
"getString",
"(",
")",
... | Fetch the URL of the external binary
@return String containing the URL location of external binary, else null if it's an internal binary | [
"Fetch",
"the",
"URL",
"of",
"the",
"external",
"binary"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/FedoraBinaryImpl.java#L108-L120 | train |
fcrepo4/fcrepo4 | fcrepo-auth-webac/src/main/java/org/fcrepo/auth/webac/WebACFilter.java | WebACFilter.addURIToAuthorize | private void addURIToAuthorize(final HttpServletRequest httpRequest, final URI uri) {
@SuppressWarnings("unchecked")
Set<URI> targetURIs = (Set<URI>) httpRequest.getAttribute(URIS_TO_AUTHORIZE);
if (targetURIs == null) {
targetURIs = new HashSet<>();
httpRequest.setAttrib... | java | private void addURIToAuthorize(final HttpServletRequest httpRequest, final URI uri) {
@SuppressWarnings("unchecked")
Set<URI> targetURIs = (Set<URI>) httpRequest.getAttribute(URIS_TO_AUTHORIZE);
if (targetURIs == null) {
targetURIs = new HashSet<>();
httpRequest.setAttrib... | [
"private",
"void",
"addURIToAuthorize",
"(",
"final",
"HttpServletRequest",
"httpRequest",
",",
"final",
"URI",
"uri",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"Set",
"<",
"URI",
">",
"targetURIs",
"=",
"(",
"Set",
"<",
"URI",
">",
")",
... | Add URIs to collect permissions information for.
@param httpRequest the request.
@param uri the uri to check. | [
"Add",
"URIs",
"to",
"collect",
"permissions",
"information",
"for",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-auth-webac/src/main/java/org/fcrepo/auth/webac/WebACFilter.java#L169-L177 | train |
fcrepo4/fcrepo4 | fcrepo-auth-webac/src/main/java/org/fcrepo/auth/webac/WebACFilter.java | WebACFilter.isPayloadIndirectOrDirect | private boolean isPayloadIndirectOrDirect(final HttpServletRequest request) {
return Collections.list(request.getHeaders("Link")).stream().map(Link::valueOf).map(Link::getUri)
.anyMatch(l -> directOrIndirect.contains(l));
} | java | private boolean isPayloadIndirectOrDirect(final HttpServletRequest request) {
return Collections.list(request.getHeaders("Link")).stream().map(Link::valueOf).map(Link::getUri)
.anyMatch(l -> directOrIndirect.contains(l));
} | [
"private",
"boolean",
"isPayloadIndirectOrDirect",
"(",
"final",
"HttpServletRequest",
"request",
")",
"{",
"return",
"Collections",
".",
"list",
"(",
"request",
".",
"getHeaders",
"(",
"\"Link\"",
")",
")",
".",
"stream",
"(",
")",
".",
"map",
"(",
"Link",
... | Is the request to create an indirect or direct container.
@param request The current request
@return whether we are acting on/creating an indirect/direct container. | [
"Is",
"the",
"request",
"to",
"create",
"an",
"indirect",
"or",
"direct",
"container",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-auth-webac/src/main/java/org/fcrepo/auth/webac/WebACFilter.java#L515-L518 | train |
fcrepo4/fcrepo4 | fcrepo-auth-webac/src/main/java/org/fcrepo/auth/webac/WebACFilter.java | WebACFilter.isResourceIndirectOrDirect | private boolean isResourceIndirectOrDirect(final FedoraResource resource) {
return resource.getTypes().stream().anyMatch(l -> directOrIndirect.contains(l));
} | java | private boolean isResourceIndirectOrDirect(final FedoraResource resource) {
return resource.getTypes().stream().anyMatch(l -> directOrIndirect.contains(l));
} | [
"private",
"boolean",
"isResourceIndirectOrDirect",
"(",
"final",
"FedoraResource",
"resource",
")",
"{",
"return",
"resource",
".",
"getTypes",
"(",
")",
".",
"stream",
"(",
")",
".",
"anyMatch",
"(",
"l",
"->",
"directOrIndirect",
".",
"contains",
"(",
"l",
... | Is the current resource a direct or indirect container
@param request
@return | [
"Is",
"the",
"current",
"resource",
"a",
"direct",
"or",
"indirect",
"container"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-auth-webac/src/main/java/org/fcrepo/auth/webac/WebACFilter.java#L526-L528 | train |
fcrepo4/fcrepo4 | fcrepo-auth-webac/src/main/java/org/fcrepo/auth/webac/WebACFilter.java | WebACFilter.isAuthorizedForMembershipResource | private boolean isAuthorizedForMembershipResource(final HttpServletRequest request, final Subject currentUser)
throws IOException {
if (resourceExists(request) && request.getMethod().equalsIgnoreCase("POST")) {
// Check resource if it exists and we are POSTing to it.
if (isRe... | java | private boolean isAuthorizedForMembershipResource(final HttpServletRequest request, final Subject currentUser)
throws IOException {
if (resourceExists(request) && request.getMethod().equalsIgnoreCase("POST")) {
// Check resource if it exists and we are POSTing to it.
if (isRe... | [
"private",
"boolean",
"isAuthorizedForMembershipResource",
"(",
"final",
"HttpServletRequest",
"request",
",",
"final",
"Subject",
"currentUser",
")",
"throws",
"IOException",
"{",
"if",
"(",
"resourceExists",
"(",
"request",
")",
"&&",
"request",
".",
"getMethod",
... | Check if we are authorized to access the target of membershipRelation if required. Really this is a test for
failure. The default is true because we might not be looking at an indirect or direct container.
@param request The current request
@param currentUser The current principal
@return Whether we are creating an in... | [
"Check",
"if",
"we",
"are",
"authorized",
"to",
"access",
"the",
"target",
"of",
"membershipRelation",
"if",
"required",
".",
"Really",
"this",
"is",
"a",
"test",
"for",
"failure",
".",
"The",
"default",
"is",
"true",
"because",
"we",
"might",
"not",
"be",... | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-auth-webac/src/main/java/org/fcrepo/auth/webac/WebACFilter.java#L539-L604 | train |
fcrepo4/fcrepo4 | fcrepo-auth-webac/src/main/java/org/fcrepo/auth/webac/WebACFilter.java | WebACFilter.getHasMemberFromRequest | private URI getHasMemberFromRequest(final HttpServletRequest request) throws IOException {
final String baseUri = request.getRequestURL().toString();
final RDFReader reader;
final String contentType = request.getContentType();
final Lang format = contentTypeToLang(contentType);
f... | java | private URI getHasMemberFromRequest(final HttpServletRequest request) throws IOException {
final String baseUri = request.getRequestURL().toString();
final RDFReader reader;
final String contentType = request.getContentType();
final Lang format = contentTypeToLang(contentType);
f... | [
"private",
"URI",
"getHasMemberFromRequest",
"(",
"final",
"HttpServletRequest",
"request",
")",
"throws",
"IOException",
"{",
"final",
"String",
"baseUri",
"=",
"request",
".",
"getRequestURL",
"(",
")",
".",
"toString",
"(",
")",
";",
"final",
"RDFReader",
"re... | Get the memberRelation object from the contents.
@param baseUri The current request URL
@param body The request body
@param contentType The content type.
@return The URI of the memberRelation object
@throws IOException when getting request's inputstream | [
"Get",
"the",
"memberRelation",
"object",
"from",
"the",
"contents",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-auth-webac/src/main/java/org/fcrepo/auth/webac/WebACFilter.java#L615-L635 | train |
fcrepo4/fcrepo4 | fcrepo-auth-webac/src/main/java/org/fcrepo/auth/webac/WebACFilter.java | WebACFilter.getHasMemberFromPatch | private URI getHasMemberFromPatch(final HttpServletRequest request) throws IOException {
final String sparqlString = IOUtils.toString(request.getInputStream(), UTF_8);
final String baseURI = request.getRequestURL().toString().replace(request.getContextPath(), "").replaceAll(
request.getP... | java | private URI getHasMemberFromPatch(final HttpServletRequest request) throws IOException {
final String sparqlString = IOUtils.toString(request.getInputStream(), UTF_8);
final String baseURI = request.getRequestURL().toString().replace(request.getContextPath(), "").replaceAll(
request.getP... | [
"private",
"URI",
"getHasMemberFromPatch",
"(",
"final",
"HttpServletRequest",
"request",
")",
"throws",
"IOException",
"{",
"final",
"String",
"sparqlString",
"=",
"IOUtils",
".",
"toString",
"(",
"request",
".",
"getInputStream",
"(",
")",
",",
"UTF_8",
")",
"... | Get the membershipRelation from a PATCH request
@param request the http request
@return URI of the first ldp:membershipRelation object.
@throws IOException converting the request body to a string. | [
"Get",
"the",
"membershipRelation",
"from",
"a",
"PATCH",
"request"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-auth-webac/src/main/java/org/fcrepo/auth/webac/WebACFilter.java#L644-L673 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-api/src/main/java/org/fcrepo/kernel/api/utils/ContentDigest.java | ContentDigest.asURI | public static URI asURI(final String algorithm, final String value) {
try {
final String scheme = DIGEST_ALGORITHM.getScheme(algorithm);
return new URI(scheme, value, null);
} catch (final URISyntaxException unlikelyException) {
LOGGER.warn("Exception creating checks... | java | public static URI asURI(final String algorithm, final String value) {
try {
final String scheme = DIGEST_ALGORITHM.getScheme(algorithm);
return new URI(scheme, value, null);
} catch (final URISyntaxException unlikelyException) {
LOGGER.warn("Exception creating checks... | [
"public",
"static",
"URI",
"asURI",
"(",
"final",
"String",
"algorithm",
",",
"final",
"String",
"value",
")",
"{",
"try",
"{",
"final",
"String",
"scheme",
"=",
"DIGEST_ALGORITHM",
".",
"getScheme",
"(",
"algorithm",
")",
";",
"return",
"new",
"URI",
"(",... | Convert a MessageDigest algorithm and checksum value to a URN
@param algorithm the message digest algorithm
@param value the checksum value
@return URI | [
"Convert",
"a",
"MessageDigest",
"algorithm",
"and",
"checksum",
"value",
"to",
"a",
"URN"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-api/src/main/java/org/fcrepo/kernel/api/utils/ContentDigest.java#L97-L107 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-api/src/main/java/org/fcrepo/kernel/api/utils/ContentDigest.java | ContentDigest.getAlgorithm | public static String getAlgorithm(final URI digestUri) {
if (digestUri == null) {
return DEFAULT_ALGORITHM;
}
return DIGEST_ALGORITHM.fromScheme(digestUri.getScheme() + ":" +
digestUri.getSchemeSpecificPart().split(":", 2)[0]).algorithm;
} | java | public static String getAlgorithm(final URI digestUri) {
if (digestUri == null) {
return DEFAULT_ALGORITHM;
}
return DIGEST_ALGORITHM.fromScheme(digestUri.getScheme() + ":" +
digestUri.getSchemeSpecificPart().split(":", 2)[0]).algorithm;
} | [
"public",
"static",
"String",
"getAlgorithm",
"(",
"final",
"URI",
"digestUri",
")",
"{",
"if",
"(",
"digestUri",
"==",
"null",
")",
"{",
"return",
"DEFAULT_ALGORITHM",
";",
"}",
"return",
"DIGEST_ALGORITHM",
".",
"fromScheme",
"(",
"digestUri",
".",
"getSchem... | Given a digest URI, get the corresponding MessageDigest algorithm
@param digestUri the digest uri
@return MessageDigest algorithm | [
"Given",
"a",
"digest",
"URI",
"get",
"the",
"corresponding",
"MessageDigest",
"algorithm"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-api/src/main/java/org/fcrepo/kernel/api/utils/ContentDigest.java#L124-L130 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/rdf/impl/LdpIsMemberOfRdfContext.java | LdpIsMemberOfRdfContext.getMemberResource | private Node getMemberResource(final FedoraResource parent) throws RepositoryException {
final Node membershipResource;
if (parent.hasProperty(LDP_MEMBER_RESOURCE)) {
final Property memberResource = getJcrNode(parent).getProperty(LDP_MEMBER_RESOURCE);
if (REFERENCE_TYPES.contai... | java | private Node getMemberResource(final FedoraResource parent) throws RepositoryException {
final Node membershipResource;
if (parent.hasProperty(LDP_MEMBER_RESOURCE)) {
final Property memberResource = getJcrNode(parent).getProperty(LDP_MEMBER_RESOURCE);
if (REFERENCE_TYPES.contai... | [
"private",
"Node",
"getMemberResource",
"(",
"final",
"FedoraResource",
"parent",
")",
"throws",
"RepositoryException",
"{",
"final",
"Node",
"membershipResource",
";",
"if",
"(",
"parent",
".",
"hasProperty",
"(",
"LDP_MEMBER_RESOURCE",
")",
")",
"{",
"final",
"P... | Get the membership resource relation asserted by the container
@param parent resource with relations
@return Node of member
@throws RepositoryException on error | [
"Get",
"the",
"membership",
"resource",
"relation",
"asserted",
"by",
"the",
"container"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/rdf/impl/LdpIsMemberOfRdfContext.java#L126-L142 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/rdf/converters/ValueConverter.java | ValueConverter.nodeForValue | public static javax.jcr.Node nodeForValue(final Session session, final Value v) throws RepositoryException {
if (v.getType() == PATH) {
return session.getNode(v.getString());
} else if (v.getType() == REFERENCE || v.getType() == WEAKREFERENCE) {
return session.getNodeByIdentifier... | java | public static javax.jcr.Node nodeForValue(final Session session, final Value v) throws RepositoryException {
if (v.getType() == PATH) {
return session.getNode(v.getString());
} else if (v.getType() == REFERENCE || v.getType() == WEAKREFERENCE) {
return session.getNodeByIdentifier... | [
"public",
"static",
"javax",
".",
"jcr",
".",
"Node",
"nodeForValue",
"(",
"final",
"Session",
"session",
",",
"final",
"Value",
"v",
")",
"throws",
"RepositoryException",
"{",
"if",
"(",
"v",
".",
"getType",
"(",
")",
"==",
"PATH",
")",
"{",
"return",
... | Get the node that a property value refers to.
@param session Session to use to load the node.
@param v Value that refers to a node.
@return the JCR node
@throws RepositoryException When there is an error accessing the node.
@throws RepositoryRuntimeException When the value type is not PATH, REFERENCE or WEAKREFERENCE. | [
"Get",
"the",
"node",
"that",
"a",
"property",
"value",
"refers",
"to",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/rdf/converters/ValueConverter.java#L179-L188 | train |
fcrepo4/fcrepo4 | fcrepo-auth-webac/src/main/java/org/fcrepo/auth/webac/WebACRolesProvider.java | WebACRolesProvider.getRoles | public Map<String, Collection<String>> getRoles(final Node node) {
return getAgentRoles(nodeConverter.convert(node));
} | java | public Map<String, Collection<String>> getRoles(final Node node) {
return getAgentRoles(nodeConverter.convert(node));
} | [
"public",
"Map",
"<",
"String",
",",
"Collection",
"<",
"String",
">",
">",
"getRoles",
"(",
"final",
"Node",
"node",
")",
"{",
"return",
"getAgentRoles",
"(",
"nodeConverter",
".",
"convert",
"(",
"node",
")",
")",
";",
"}"
] | Get the roles assigned to this Node.
@param node the subject Node
@return a set of roles for each principal | [
"Get",
"the",
"roles",
"assigned",
"to",
"this",
"Node",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-auth-webac/src/main/java/org/fcrepo/auth/webac/WebACRolesProvider.java#L110-L112 | train |
fcrepo4/fcrepo4 | fcrepo-auth-webac/src/main/java/org/fcrepo/auth/webac/WebACRolesProvider.java | WebACRolesProvider.getAgentMembers | private static Stream<String> getAgentMembers(final IdentifierConverter<Resource, FedoraResource> translator,
final FedoraResource resource, final String hashPortion) {
//resolve list of triples, accounting for hash-uris.
final List<Triple> triples = re... | java | private static Stream<String> getAgentMembers(final IdentifierConverter<Resource, FedoraResource> translator,
final FedoraResource resource, final String hashPortion) {
//resolve list of triples, accounting for hash-uris.
final List<Triple> triples = re... | [
"private",
"static",
"Stream",
"<",
"String",
">",
"getAgentMembers",
"(",
"final",
"IdentifierConverter",
"<",
"Resource",
",",
"FedoraResource",
">",
"translator",
",",
"final",
"FedoraResource",
"resource",
",",
"final",
"String",
"hashPortion",
")",
"{",
"//re... | Given a FedoraResource, return a list of agents. | [
"Given",
"a",
"FedoraResource",
"return",
"a",
"list",
"of",
"agents",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-auth-webac/src/main/java/org/fcrepo/auth/webac/WebACRolesProvider.java#L258-L276 | train |
fcrepo4/fcrepo4 | fcrepo-auth-webac/src/main/java/org/fcrepo/auth/webac/WebACRolesProvider.java | WebACRolesProvider.nodeToStringStream | private static Stream<String> nodeToStringStream(final org.apache.jena.graph.Node object) {
if (object.isURI()) {
return of(object.getURI());
} else if (object.isLiteral()) {
return of(object.getLiteralValue().toString());
} else {
return empty();
}
... | java | private static Stream<String> nodeToStringStream(final org.apache.jena.graph.Node object) {
if (object.isURI()) {
return of(object.getURI());
} else if (object.isLiteral()) {
return of(object.getLiteralValue().toString());
} else {
return empty();
}
... | [
"private",
"static",
"Stream",
"<",
"String",
">",
"nodeToStringStream",
"(",
"final",
"org",
".",
"apache",
".",
"jena",
".",
"graph",
".",
"Node",
"object",
")",
"{",
"if",
"(",
"object",
".",
"isURI",
"(",
")",
")",
"{",
"return",
"of",
"(",
"obje... | Map a Jena Node to a Stream of Strings. Any non-URI, non-Literals map to an empty Stream,
making this suitable to use with flatMap. | [
"Map",
"a",
"Jena",
"Node",
"to",
"a",
"Stream",
"of",
"Strings",
".",
"Any",
"non",
"-",
"URI",
"non",
"-",
"Literals",
"map",
"to",
"an",
"empty",
"Stream",
"making",
"this",
"suitable",
"to",
"use",
"with",
"flatMap",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-auth-webac/src/main/java/org/fcrepo/auth/webac/WebACRolesProvider.java#L290-L298 | train |
fcrepo4/fcrepo4 | fcrepo-auth-webac/src/main/java/org/fcrepo/auth/webac/WebACRolesProvider.java | WebACRolesProvider.getEffectiveAcl | static Optional<ACLHandle> getEffectiveAcl(final FedoraResource resource, final boolean ancestorAcl,
final SessionFactory sessionFactory) {
try {
final FedoraResource aclResource = resource.getAcl();
if (aclResource != null) {
... | java | static Optional<ACLHandle> getEffectiveAcl(final FedoraResource resource, final boolean ancestorAcl,
final SessionFactory sessionFactory) {
try {
final FedoraResource aclResource = resource.getAcl();
if (aclResource != null) {
... | [
"static",
"Optional",
"<",
"ACLHandle",
">",
"getEffectiveAcl",
"(",
"final",
"FedoraResource",
"resource",
",",
"final",
"boolean",
"ancestorAcl",
",",
"final",
"SessionFactory",
"sessionFactory",
")",
"{",
"try",
"{",
"final",
"FedoraResource",
"aclResource",
"=",... | Recursively find the effective ACL as a URI along with the FedoraResource that points to it.
This way, if the effective ACL is pointed to from a parent resource, the child will inherit
any permissions that correspond to access to that parent. This ACL resource may or may not exist,
and it may be external to the fedora ... | [
"Recursively",
"find",
"the",
"effective",
"ACL",
"as",
"a",
"URI",
"along",
"with",
"the",
"FedoraResource",
"that",
"points",
"to",
"it",
".",
"This",
"way",
"if",
"the",
"effective",
"ACL",
"is",
"pointed",
"to",
"from",
"a",
"parent",
"resource",
"the"... | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-auth-webac/src/main/java/org/fcrepo/auth/webac/WebACRolesProvider.java#L395-L421 | train |
fcrepo4/fcrepo4 | fcrepo-http-api/src/main/java/org/fcrepo/http/api/repository/FedoraRepositoryRestore.java | FedoraRepositoryRestore.runRestore | @POST
public Response runRestore(final InputStream bodyStream) throws IOException {
if (null == bodyStream) {
throw new WebApplicationException(serverError().entity(
"Request body must not be null").build());
}
final String body = IOUtils.toString(bodyStream... | java | @POST
public Response runRestore(final InputStream bodyStream) throws IOException {
if (null == bodyStream) {
throw new WebApplicationException(serverError().entity(
"Request body must not be null").build());
}
final String body = IOUtils.toString(bodyStream... | [
"@",
"POST",
"public",
"Response",
"runRestore",
"(",
"final",
"InputStream",
"bodyStream",
")",
"throws",
"IOException",
"{",
"if",
"(",
"null",
"==",
"bodyStream",
")",
"{",
"throw",
"new",
"WebApplicationException",
"(",
"serverError",
"(",
")",
".",
"entit... | This method runs a repository restore.
@param bodyStream the body stream
@return response
@throws IOException if IO exception occurred | [
"This",
"method",
"runs",
"a",
"repository",
"restore",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-api/src/main/java/org/fcrepo/http/api/repository/FedoraRepositoryRestore.java#L71-L104 | train |
fcrepo4/fcrepo4 | fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/domain/SinglePrefer.java | SinglePrefer.getReturn | public PreferTag getReturn() {
return preferTags().stream()
.filter(x -> x.getTag().equals("return"))
.findFirst().orElse(emptyTag());
} | java | public PreferTag getReturn() {
return preferTags().stream()
.filter(x -> x.getTag().equals("return"))
.findFirst().orElse(emptyTag());
} | [
"public",
"PreferTag",
"getReturn",
"(",
")",
"{",
"return",
"preferTags",
"(",
")",
".",
"stream",
"(",
")",
".",
"filter",
"(",
"x",
"->",
"x",
".",
"getTag",
"(",
")",
".",
"equals",
"(",
"\"return\"",
")",
")",
".",
"findFirst",
"(",
")",
".",
... | Get the return tag, or a blank default, if none exists.
@return return tag, or a blank default, if none exists | [
"Get",
"the",
"return",
"tag",
"or",
"a",
"blank",
"default",
"if",
"none",
"exists",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/domain/SinglePrefer.java#L72-L76 | train |
fcrepo4/fcrepo4 | fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/domain/PreferTag.java | PreferTag.addResponseHeaders | public void addResponseHeaders(final HttpServletResponse servletResponse) {
final String receivedParam = ofNullable(params.get("received")).orElse("");
final List<String> includes = asList(ofNullable(params.get("include")).orElse(" ").split(" "));
final List<String> omits = asList(ofNullable(pa... | java | public void addResponseHeaders(final HttpServletResponse servletResponse) {
final String receivedParam = ofNullable(params.get("received")).orElse("");
final List<String> includes = asList(ofNullable(params.get("include")).orElse(" ").split(" "));
final List<String> omits = asList(ofNullable(pa... | [
"public",
"void",
"addResponseHeaders",
"(",
"final",
"HttpServletResponse",
"servletResponse",
")",
"{",
"final",
"String",
"receivedParam",
"=",
"ofNullable",
"(",
"params",
".",
"get",
"(",
"\"received\"",
")",
")",
".",
"orElse",
"(",
"\"\"",
")",
";",
"fi... | Add appropriate response headers to indicate that the incoming preferences were acknowledged
@param servletResponse the servlet response | [
"Add",
"appropriate",
"response",
"headers",
"to",
"indicate",
"that",
"the",
"incoming",
"preferences",
"were",
"acknowledged"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/domain/PreferTag.java#L137-L173 | train |
fcrepo4/fcrepo4 | fcrepo-jms/src/main/java/org/fcrepo/jms/AbstractJMSPublisher.java | AbstractJMSPublisher.publishJCREvent | @Subscribe
public void publishJCREvent(final FedoraEvent fedoraEvent) throws JMSException {
LOGGER.debug("Received an event from the internal bus.");
final Message tm =
eventFactory.getMessage(fedoraEvent, jmsSession);
LOGGER.debug("Transformed the event to a JMS message.");
... | java | @Subscribe
public void publishJCREvent(final FedoraEvent fedoraEvent) throws JMSException {
LOGGER.debug("Received an event from the internal bus.");
final Message tm =
eventFactory.getMessage(fedoraEvent, jmsSession);
LOGGER.debug("Transformed the event to a JMS message.");
... | [
"@",
"Subscribe",
"public",
"void",
"publishJCREvent",
"(",
"final",
"FedoraEvent",
"fedoraEvent",
")",
"throws",
"JMSException",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Received an event from the internal bus.\"",
")",
";",
"final",
"Message",
"tm",
"=",
"eventFactory",... | When an EventBus mesage is received, map it to our JMS
message payload and push it onto the queue.
@param fedoraEvent the fedora event
@throws JMSException if JMS exception occurred | [
"When",
"an",
"EventBus",
"mesage",
"is",
"received",
"map",
"it",
"to",
"our",
"JMS",
"message",
"payload",
"and",
"push",
"it",
"onto",
"the",
"queue",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-jms/src/main/java/org/fcrepo/jms/AbstractJMSPublisher.java#L75-L84 | train |
fcrepo4/fcrepo4 | fcrepo-jms/src/main/java/org/fcrepo/jms/AbstractJMSPublisher.java | AbstractJMSPublisher.acquireConnections | @PostConstruct
public void acquireConnections() throws JMSException {
LOGGER.debug("Initializing: {}", this.getClass().getCanonicalName());
connection = connectionFactory.createConnection();
connection.start();
jmsSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
... | java | @PostConstruct
public void acquireConnections() throws JMSException {
LOGGER.debug("Initializing: {}", this.getClass().getCanonicalName());
connection = connectionFactory.createConnection();
connection.start();
jmsSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
... | [
"@",
"PostConstruct",
"public",
"void",
"acquireConnections",
"(",
")",
"throws",
"JMSException",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Initializing: {}\"",
",",
"this",
".",
"getClass",
"(",
")",
".",
"getCanonicalName",
"(",
")",
")",
";",
"connection",
"=",
... | Connect to JCR Repostory and JMS queue
@throws JMSException if JMS Exception occurred | [
"Connect",
"to",
"JCR",
"Repostory",
"and",
"JMS",
"queue"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-jms/src/main/java/org/fcrepo/jms/AbstractJMSPublisher.java#L91-L100 | train |
fcrepo4/fcrepo4 | fcrepo-jms/src/main/java/org/fcrepo/jms/AbstractJMSPublisher.java | AbstractJMSPublisher.releaseConnections | @PreDestroy
public void releaseConnections() throws JMSException {
LOGGER.debug("Tearing down: {}", this.getClass().getCanonicalName());
producer.close();
jmsSession.close();
connection.close();
eventBus.unregister(this);
} | java | @PreDestroy
public void releaseConnections() throws JMSException {
LOGGER.debug("Tearing down: {}", this.getClass().getCanonicalName());
producer.close();
jmsSession.close();
connection.close();
eventBus.unregister(this);
} | [
"@",
"PreDestroy",
"public",
"void",
"releaseConnections",
"(",
")",
"throws",
"JMSException",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Tearing down: {}\"",
",",
"this",
".",
"getClass",
"(",
")",
".",
"getCanonicalName",
"(",
")",
")",
";",
"producer",
".",
"cl... | Close external connections
@throws JMSException if JMS exception occurred | [
"Close",
"external",
"connections"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-jms/src/main/java/org/fcrepo/jms/AbstractJMSPublisher.java#L107-L115 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/services/RepositoryServiceImpl.java | RepositoryServiceImpl.getRepositorySize | @Override
public Long getRepositorySize() {
try {
LOGGER.debug("Calculating repository size from index");
final Repository repo = getJcrRepository(repository);
// Differentiating between the local getRepositorySize and
// ServiceHelpers
return Se... | java | @Override
public Long getRepositorySize() {
try {
LOGGER.debug("Calculating repository size from index");
final Repository repo = getJcrRepository(repository);
// Differentiating between the local getRepositorySize and
// ServiceHelpers
return Se... | [
"@",
"Override",
"public",
"Long",
"getRepositorySize",
"(",
")",
"{",
"try",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Calculating repository size from index\"",
")",
";",
"final",
"Repository",
"repo",
"=",
"getJcrRepository",
"(",
"repository",
")",
";",
"// Differe... | Calculate the total size of all the binary properties in the repository
@return size in bytes | [
"Calculate",
"the",
"total",
"size",
"of",
"all",
"the",
"binary",
"properties",
"in",
"the",
"repository"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/services/RepositoryServiceImpl.java#L63-L76 | train |
fcrepo4/fcrepo4 | fcrepo-http-api/src/main/java/org/fcrepo/http/api/FedoraBaseResource.java | FedoraBaseResource.getResourceFromPath | @VisibleForTesting
public FedoraResource getResourceFromPath(final String externalPath) {
final Resource resource = translator().toDomain(externalPath);
final FedoraResource fedoraResource = translator().convert(resource);
if (fedoraResource instanceof Tombstone) {
final String ... | java | @VisibleForTesting
public FedoraResource getResourceFromPath(final String externalPath) {
final Resource resource = translator().toDomain(externalPath);
final FedoraResource fedoraResource = translator().convert(resource);
if (fedoraResource instanceof Tombstone) {
final String ... | [
"@",
"VisibleForTesting",
"public",
"FedoraResource",
"getResourceFromPath",
"(",
"final",
"String",
"externalPath",
")",
"{",
"final",
"Resource",
"resource",
"=",
"translator",
"(",
")",
".",
"toDomain",
"(",
"externalPath",
")",
";",
"final",
"FedoraResource",
... | Get the FedoraResource for the resource at the external path
@param externalPath the external path
@return the fedora resource at the external path | [
"Get",
"the",
"FedoraResource",
"for",
"the",
"resource",
"at",
"the",
"external",
"path"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-api/src/main/java/org/fcrepo/http/api/FedoraBaseResource.java#L91-L102 | train |
fcrepo4/fcrepo4 | fcrepo-http-api/src/main/java/org/fcrepo/http/api/FedoraBaseResource.java | FedoraBaseResource.setUpJMSInfo | protected void setUpJMSInfo(final UriInfo uriInfo, final HttpHeaders headers) {
try {
String baseURL = getBaseUrlProperty(uriInfo);
if (baseURL.length() == 0) {
baseURL = uriInfo.getBaseUri().toString();
}
LOGGER.debug("setting baseURL = " + baseUR... | java | protected void setUpJMSInfo(final UriInfo uriInfo, final HttpHeaders headers) {
try {
String baseURL = getBaseUrlProperty(uriInfo);
if (baseURL.length() == 0) {
baseURL = uriInfo.getBaseUri().toString();
}
LOGGER.debug("setting baseURL = " + baseUR... | [
"protected",
"void",
"setUpJMSInfo",
"(",
"final",
"UriInfo",
"uriInfo",
",",
"final",
"HttpHeaders",
"headers",
")",
"{",
"try",
"{",
"String",
"baseURL",
"=",
"getBaseUrlProperty",
"(",
"uriInfo",
")",
";",
"if",
"(",
"baseURL",
".",
"length",
"(",
")",
... | Set the baseURL for JMS events.
@param uriInfo the uri info
@param headers HTTP headers | [
"Set",
"the",
"baseURL",
"for",
"JMS",
"events",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-api/src/main/java/org/fcrepo/http/api/FedoraBaseResource.java#L109-L123 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-api/src/main/java/org/fcrepo/kernel/api/rdf/DefaultRdfStream.java | DefaultRdfStream.fromModel | public static RdfStream fromModel(final Node node, final Model model) {
return new DefaultRdfStream(node,
stream(spliteratorUnknownSize(model.listStatements(), IMMUTABLE), false).map(Statement::asTriple));
} | java | public static RdfStream fromModel(final Node node, final Model model) {
return new DefaultRdfStream(node,
stream(spliteratorUnknownSize(model.listStatements(), IMMUTABLE), false).map(Statement::asTriple));
} | [
"public",
"static",
"RdfStream",
"fromModel",
"(",
"final",
"Node",
"node",
",",
"final",
"Model",
"model",
")",
"{",
"return",
"new",
"DefaultRdfStream",
"(",
"node",
",",
"stream",
"(",
"spliteratorUnknownSize",
"(",
"model",
".",
"listStatements",
"(",
")",... | Create an RdfStream from an existing Model.
@param node The subject node
@param model An input Model
@return a new RdfStream object | [
"Create",
"an",
"RdfStream",
"from",
"an",
"existing",
"Model",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-api/src/main/java/org/fcrepo/kernel/api/rdf/DefaultRdfStream.java#L73-L76 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/identifiers/NodeResourceConverter.java | NodeResourceConverter.nodeToResource | public static Converter<Node, Resource> nodeToResource(final Converter<Resource, FedoraResource> c) {
return nodeConverter.andThen(c.reverse());
} | java | public static Converter<Node, Resource> nodeToResource(final Converter<Resource, FedoraResource> c) {
return nodeConverter.andThen(c.reverse());
} | [
"public",
"static",
"Converter",
"<",
"Node",
",",
"Resource",
">",
"nodeToResource",
"(",
"final",
"Converter",
"<",
"Resource",
",",
"FedoraResource",
">",
"c",
")",
"{",
"return",
"nodeConverter",
".",
"andThen",
"(",
"c",
".",
"reverse",
"(",
")",
")",... | Get a converter that can transform a Node to a Resource
@param c the given node
@return the converter that can transform a node to resource | [
"Get",
"a",
"converter",
"that",
"can",
"transform",
"a",
"Node",
"to",
"a",
"Resource"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/identifiers/NodeResourceConverter.java#L46-L48 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-api/src/main/java/org/fcrepo/kernel/api/utils/AutoReloadingConfiguration.java | AutoReloadingConfiguration.monitorForChanges | private void monitorForChanges() {
if (monitorRunning) {
return;
}
final Path path;
try {
path = Paths.get(configPath);
} catch (final Exception e) {
LOGGER.warn("Cannot monitor configuration {}, disabling monitoring; {}", configPath, e.getMes... | java | private void monitorForChanges() {
if (monitorRunning) {
return;
}
final Path path;
try {
path = Paths.get(configPath);
} catch (final Exception e) {
LOGGER.warn("Cannot monitor configuration {}, disabling monitoring; {}", configPath, e.getMes... | [
"private",
"void",
"monitorForChanges",
"(",
")",
"{",
"if",
"(",
"monitorRunning",
")",
"{",
"return",
";",
"}",
"final",
"Path",
"path",
";",
"try",
"{",
"path",
"=",
"Paths",
".",
"get",
"(",
"configPath",
")",
";",
"}",
"catch",
"(",
"final",
"Ex... | Starts up monitoring of the configuration for changes. | [
"Starts",
"up",
"monitoring",
"of",
"the",
"configuration",
"for",
"changes",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-api/src/main/java/org/fcrepo/kernel/api/utils/AutoReloadingConfiguration.java#L85-L165 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-api/src/main/java/org/fcrepo/kernel/api/utils/AutoReloadingConfiguration.java | AutoReloadingConfiguration.setConfigPath | public void setConfigPath(final String configPath) {
// Resolve classpath references without spring's help
if (configPath != null && configPath.startsWith("classpath:")) {
final String relativePath = configPath.substring(10);
this.configPath = this.getClass().getResource(relative... | java | public void setConfigPath(final String configPath) {
// Resolve classpath references without spring's help
if (configPath != null && configPath.startsWith("classpath:")) {
final String relativePath = configPath.substring(10);
this.configPath = this.getClass().getResource(relative... | [
"public",
"void",
"setConfigPath",
"(",
"final",
"String",
"configPath",
")",
"{",
"// Resolve classpath references without spring's help",
"if",
"(",
"configPath",
"!=",
"null",
"&&",
"configPath",
".",
"startsWith",
"(",
"\"classpath:\"",
")",
")",
"{",
"final",
"... | Set the file path for the configuration
@param configPath file path for configuration | [
"Set",
"the",
"file",
"path",
"for",
"the",
"configuration"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-api/src/main/java/org/fcrepo/kernel/api/utils/AutoReloadingConfiguration.java#L172-L180 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-api/src/main/java/org/fcrepo/kernel/api/services/functions/ConfigurableHierarchicalSupplier.java | ConfigurableHierarchicalSupplier.get | @Override
public String get() {
final String s = randomUUID().toString();
final String id;
if (count > 0 && length > 0) {
final StringJoiner joiner = new StringJoiner("/", "", "/" + s);
IntStream.rangeClosed(0, count - 1)
.forEach(x -> joiner.add(s.subs... | java | @Override
public String get() {
final String s = randomUUID().toString();
final String id;
if (count > 0 && length > 0) {
final StringJoiner joiner = new StringJoiner("/", "", "/" + s);
IntStream.rangeClosed(0, count - 1)
.forEach(x -> joiner.add(s.subs... | [
"@",
"Override",
"public",
"String",
"get",
"(",
")",
"{",
"final",
"String",
"s",
"=",
"randomUUID",
"(",
")",
".",
"toString",
"(",
")",
";",
"final",
"String",
"id",
";",
"if",
"(",
"count",
">",
"0",
"&&",
"length",
">",
"0",
")",
"{",
"final... | Mint a unique identifier as a UUID
@return uuid | [
"Mint",
"a",
"unique",
"identifier",
"as",
"a",
"UUID"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-api/src/main/java/org/fcrepo/kernel/api/services/functions/ConfigurableHierarchicalSupplier.java#L66-L82 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/services/NodeServiceImpl.java | NodeServiceImpl.find | @Override
public FedoraResource find(final FedoraSession session, final String path) {
final Session jcrSession = getJcrSession(session);
try {
return new FedoraResourceImpl(jcrSession.getNode(path));
} catch (final RepositoryException e) {
throw new RepositoryRuntime... | java | @Override
public FedoraResource find(final FedoraSession session, final String path) {
final Session jcrSession = getJcrSession(session);
try {
return new FedoraResourceImpl(jcrSession.getNode(path));
} catch (final RepositoryException e) {
throw new RepositoryRuntime... | [
"@",
"Override",
"public",
"FedoraResource",
"find",
"(",
"final",
"FedoraSession",
"session",
",",
"final",
"String",
"path",
")",
"{",
"final",
"Session",
"jcrSession",
"=",
"getJcrSession",
"(",
"session",
")",
";",
"try",
"{",
"return",
"new",
"FedoraResou... | Retrieve an existing Fedora resource at the given path
@param session a JCR session
@param path a JCR path
@return Fedora resource at the given path | [
"Retrieve",
"an",
"existing",
"Fedora",
"resource",
"at",
"the",
"given",
"path"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/services/NodeServiceImpl.java#L75-L83 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/services/NodeServiceImpl.java | NodeServiceImpl.copyObject | @Override
public void copyObject(final FedoraSession session, final String source, final String destination) {
final Session jcrSession = getJcrSession(session);
try {
jcrSession.getWorkspace().copy(source, destination);
touchLdpMembershipResource(getJcrNode(find(session, des... | java | @Override
public void copyObject(final FedoraSession session, final String source, final String destination) {
final Session jcrSession = getJcrSession(session);
try {
jcrSession.getWorkspace().copy(source, destination);
touchLdpMembershipResource(getJcrNode(find(session, des... | [
"@",
"Override",
"public",
"void",
"copyObject",
"(",
"final",
"FedoraSession",
"session",
",",
"final",
"String",
"source",
",",
"final",
"String",
"destination",
")",
"{",
"final",
"Session",
"jcrSession",
"=",
"getJcrSession",
"(",
"session",
")",
";",
"try... | Copy an existing object from the source path to the destination path
@param session a JCR session
@param source the source path
@param destination the destination path | [
"Copy",
"an",
"existing",
"object",
"from",
"the",
"source",
"path",
"to",
"the",
"destination",
"path"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/services/NodeServiceImpl.java#L92-L101 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/services/NodeServiceImpl.java | NodeServiceImpl.moveObject | @Override
public void moveObject(final FedoraSession session, final String source, final String destination) {
final Session jcrSession = getJcrSession(session);
try {
final FedoraResource srcResource = find(session, source);
final Node sourceNode = getJcrNode(srcResource);
... | java | @Override
public void moveObject(final FedoraSession session, final String source, final String destination) {
final Session jcrSession = getJcrSession(session);
try {
final FedoraResource srcResource = find(session, source);
final Node sourceNode = getJcrNode(srcResource);
... | [
"@",
"Override",
"public",
"void",
"moveObject",
"(",
"final",
"FedoraSession",
"session",
",",
"final",
"String",
"source",
",",
"final",
"String",
"destination",
")",
"{",
"final",
"Session",
"jcrSession",
"=",
"getJcrSession",
"(",
"session",
")",
";",
"try... | Move an existing object from the source path to the destination path
@param session the session
@param source the source path
@param destination the destination path | [
"Move",
"an",
"existing",
"object",
"from",
"the",
"source",
"path",
"to",
"the",
"destination",
"path"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/services/NodeServiceImpl.java#L110-L131 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/InternalFedoraBinary.java | InternalFedoraBinary.getBinaryContent | private javax.jcr.Binary getBinaryContent() {
try {
return getProperty(JCR_DATA).getBinary();
} catch (final PathNotFoundException e) {
throw new PathNotFoundRuntimeException(e);
} catch (final RepositoryException e) {
throw new RepositoryRuntimeException(e);
... | java | private javax.jcr.Binary getBinaryContent() {
try {
return getProperty(JCR_DATA).getBinary();
} catch (final PathNotFoundException e) {
throw new PathNotFoundRuntimeException(e);
} catch (final RepositoryException e) {
throw new RepositoryRuntimeException(e);
... | [
"private",
"javax",
".",
"jcr",
".",
"Binary",
"getBinaryContent",
"(",
")",
"{",
"try",
"{",
"return",
"getProperty",
"(",
"JCR_DATA",
")",
".",
"getBinary",
"(",
")",
";",
"}",
"catch",
"(",
"final",
"PathNotFoundException",
"e",
")",
"{",
"throw",
"ne... | Retrieve the JCR Binary object
@return a JCR-wrapped Binary object | [
"Retrieve",
"the",
"JCR",
"Binary",
"object"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/InternalFedoraBinary.java#L93-L101 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/InternalFedoraBinary.java | InternalFedoraBinary.verifyChecksums | private void verifyChecksums(final Collection<URI> checksums, final Property dataProperty)
throws InvalidChecksumException {
final Map<URI, URI> checksumErrors = new HashMap<>();
// Loop through provided checksums validating against computed values
checksums.forEach(checksum -> {
... | java | private void verifyChecksums(final Collection<URI> checksums, final Property dataProperty)
throws InvalidChecksumException {
final Map<URI, URI> checksumErrors = new HashMap<>();
// Loop through provided checksums validating against computed values
checksums.forEach(checksum -> {
... | [
"private",
"void",
"verifyChecksums",
"(",
"final",
"Collection",
"<",
"URI",
">",
"checksums",
",",
"final",
"Property",
"dataProperty",
")",
"throws",
"InvalidChecksumException",
"{",
"final",
"Map",
"<",
"URI",
",",
"URI",
">",
"checksumErrors",
"=",
"new",
... | This method ensures that the arg checksums are valid against the binary associated with the arg dataProperty.
If one or more of the checksums are invalid, an InvalidChecksumException is thrown.
@param checksums that the user provided
@param dataProperty containing the binary against which the checksums will be verifie... | [
"This",
"method",
"ensures",
"that",
"the",
"arg",
"checksums",
"are",
"valid",
"against",
"the",
"binary",
"associated",
"with",
"the",
"arg",
"dataProperty",
".",
"If",
"one",
"or",
"more",
"of",
"the",
"checksums",
"are",
"invalid",
"an",
"InvalidChecksumEx... | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/InternalFedoraBinary.java#L200-L243 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/InternalFedoraBinary.java | InternalFedoraBinary.decorateContentNode | private static void decorateContentNode(final Node dsNode, final Node descNode, final Collection<URI> checksums)
throws RepositoryException {
if (dsNode == null) {
LOGGER.warn("{} node appears to be null!", JCR_CONTENT);
return;
}
if (dsNode.hasProperty(JCR_DATA... | java | private static void decorateContentNode(final Node dsNode, final Node descNode, final Collection<URI> checksums)
throws RepositoryException {
if (dsNode == null) {
LOGGER.warn("{} node appears to be null!", JCR_CONTENT);
return;
}
if (dsNode.hasProperty(JCR_DATA... | [
"private",
"static",
"void",
"decorateContentNode",
"(",
"final",
"Node",
"dsNode",
",",
"final",
"Node",
"descNode",
",",
"final",
"Collection",
"<",
"URI",
">",
"checksums",
")",
"throws",
"RepositoryException",
"{",
"if",
"(",
"dsNode",
"==",
"null",
")",
... | Add necessary information to node
@param dsNode The target binary node to add information to
@param descNode The description node associated with the binary node
@param checksums The checksum information
@throws RepositoryException on error | [
"Add",
"necessary",
"information",
"to",
"node"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/InternalFedoraBinary.java#L288-L313 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/rdf/impl/LdpContainerRdfContext.java | LdpContainerRdfContext.memberRelations | private Stream<Triple> memberRelations(final FedoraResource container) throws RepositoryException {
final org.apache.jena.graph.Node memberRelation;
if (container.hasProperty(LDP_HAS_MEMBER_RELATION)) {
final Property property = getJcrNode(container).getProperty(LDP_HAS_MEMBER_RELATION);
... | java | private Stream<Triple> memberRelations(final FedoraResource container) throws RepositoryException {
final org.apache.jena.graph.Node memberRelation;
if (container.hasProperty(LDP_HAS_MEMBER_RELATION)) {
final Property property = getJcrNode(container).getProperty(LDP_HAS_MEMBER_RELATION);
... | [
"private",
"Stream",
"<",
"Triple",
">",
"memberRelations",
"(",
"final",
"FedoraResource",
"container",
")",
"throws",
"RepositoryException",
"{",
"final",
"org",
".",
"apache",
".",
"jena",
".",
"graph",
".",
"Node",
"memberRelation",
";",
"if",
"(",
"contai... | Get the member relations assert on the subject by the given node
@param container with relations
@return Stream of triples
@throws RepositoryException on error | [
"Get",
"the",
"member",
"relations",
"assert",
"on",
"the",
"subject",
"by",
"the",
"given",
"node"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/rdf/impl/LdpContainerRdfContext.java#L95-L147 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/FedoraResourceImpl.java | FedoraResourceImpl.nodeToGoodChildren | @SuppressWarnings("unchecked")
private Stream<FedoraResource> nodeToGoodChildren(final Node input) throws RepositoryException {
return iteratorToStream(input.getNodes()).filter(nastyChildren.negate())
.flatMap(uncheck((final Node child) -> child.isNodeType(FEDORA_PAIRTREE) ? nodeToGoodChildren(c... | java | @SuppressWarnings("unchecked")
private Stream<FedoraResource> nodeToGoodChildren(final Node input) throws RepositoryException {
return iteratorToStream(input.getNodes()).filter(nastyChildren.negate())
.flatMap(uncheck((final Node child) -> child.isNodeType(FEDORA_PAIRTREE) ? nodeToGoodChildren(c... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"Stream",
"<",
"FedoraResource",
">",
"nodeToGoodChildren",
"(",
"final",
"Node",
"input",
")",
"throws",
"RepositoryException",
"{",
"return",
"iteratorToStream",
"(",
"input",
".",
"getNodes",
"(",
"... | Get the "good" children for a node by skipping all pairtree nodes in the way.
@param input Node containing children
@return Stream of good children
@throws RepositoryException on error | [
"Get",
"the",
"good",
"children",
"for",
"a",
"node",
"by",
"skipping",
"all",
"pairtree",
"nodes",
"in",
"the",
"way",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/FedoraResourceImpl.java#L404-L409 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/FedoraResourceImpl.java | FedoraResourceImpl.getAllChildren | private static Stream<FedoraResource> getAllChildren(final FedoraResource resource) {
return concat(of(resource), resource.getChildren().flatMap(FedoraResourceImpl::getAllChildren));
} | java | private static Stream<FedoraResource> getAllChildren(final FedoraResource resource) {
return concat(of(resource), resource.getChildren().flatMap(FedoraResourceImpl::getAllChildren));
} | [
"private",
"static",
"Stream",
"<",
"FedoraResource",
">",
"getAllChildren",
"(",
"final",
"FedoraResource",
"resource",
")",
"{",
"return",
"concat",
"(",
"of",
"(",
"resource",
")",
",",
"resource",
".",
"getChildren",
"(",
")",
".",
"flatMap",
"(",
"Fedor... | Get all children recursively, and flatten into a single Stream. | [
"Get",
"all",
"children",
"recursively",
"and",
"flatten",
"into",
"a",
"single",
"Stream",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/FedoraResourceImpl.java#L414-L416 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/FedoraResourceImpl.java | FedoraResourceImpl.touch | @VisibleForTesting
public void touch(final boolean includeMembershipResource, final Calendar createdDate, final String createdUser,
final Calendar modifiedDate, final String modifyingUser) throws RepositoryException {
FedoraTypesUtils.touch(getNode(), createdDate, createdUser, modified... | java | @VisibleForTesting
public void touch(final boolean includeMembershipResource, final Calendar createdDate, final String createdUser,
final Calendar modifiedDate, final String modifyingUser) throws RepositoryException {
FedoraTypesUtils.touch(getNode(), createdDate, createdUser, modified... | [
"@",
"VisibleForTesting",
"public",
"void",
"touch",
"(",
"final",
"boolean",
"includeMembershipResource",
",",
"final",
"Calendar",
"createdDate",
",",
"final",
"String",
"createdUser",
",",
"final",
"Calendar",
"modifiedDate",
",",
"final",
"String",
"modifyingUser"... | Touches a resource to ensure that the implicitly updated properties are updated if
not explicitly set.
@param includeMembershipResource true if this touch should propagate through to
ldp membership resources
@param createdDate the date to which the created date should be set or null to leave it unchanged
@param created... | [
"Touches",
"a",
"resource",
"to",
"ensure",
"that",
"the",
"implicitly",
"updated",
"properties",
"are",
"updated",
"if",
"not",
"explicitly",
"set",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/FedoraResourceImpl.java#L1106-L1116 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/FedoraResourceImpl.java | FedoraResourceImpl.convertMementoReferences | protected static Function<Triple, Triple> convertMementoReferences(
final IdentifierConverter<Resource, FedoraResource> translator,
final IdentifierConverter<Resource, FedoraResource> internalTranslator) {
return t -> {
final String subjectURI = t.getSubject().getURI();
... | java | protected static Function<Triple, Triple> convertMementoReferences(
final IdentifierConverter<Resource, FedoraResource> translator,
final IdentifierConverter<Resource, FedoraResource> internalTranslator) {
return t -> {
final String subjectURI = t.getSubject().getURI();
... | [
"protected",
"static",
"Function",
"<",
"Triple",
",",
"Triple",
">",
"convertMementoReferences",
"(",
"final",
"IdentifierConverter",
"<",
"Resource",
",",
"FedoraResource",
">",
"translator",
",",
"final",
"IdentifierConverter",
"<",
"Resource",
",",
"FedoraResource... | Returns a function that converts the subject to the original URI and the object of a triple from an
undereferenceable internal identifier back to it's original external resource path.
If the object is not an internal identifier, the object is returned.
@param translator a converter to get the external resource identif... | [
"Returns",
"a",
"function",
"that",
"converts",
"the",
"subject",
"to",
"the",
"original",
"URI",
"and",
"the",
"object",
"of",
"a",
"triple",
"from",
"an",
"undereferenceable",
"internal",
"identifier",
"back",
"to",
"it",
"s",
"original",
"external",
"resour... | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/FedoraResourceImpl.java#L1175-L1212 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/FedoraResourceImpl.java | FedoraResourceImpl.dateTimeDifference | private static long dateTimeDifference(final Temporal d1, final Temporal d2) {
return ChronoUnit.SECONDS.between(d1, d2);
} | java | private static long dateTimeDifference(final Temporal d1, final Temporal d2) {
return ChronoUnit.SECONDS.between(d1, d2);
} | [
"private",
"static",
"long",
"dateTimeDifference",
"(",
"final",
"Temporal",
"d1",
",",
"final",
"Temporal",
"d2",
")",
"{",
"return",
"ChronoUnit",
".",
"SECONDS",
".",
"between",
"(",
"d1",
",",
"d2",
")",
";",
"}"
] | Calculate the difference between two datetime to the unit.
@param d1 first datetime
@param d2 second datetime
@return the difference | [
"Calculate",
"the",
"difference",
"between",
"two",
"datetime",
"to",
"the",
"unit",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/FedoraResourceImpl.java#L1339-L1341 | train |
fcrepo4/fcrepo4 | fcrepo-http-api/src/main/java/org/fcrepo/http/api/ExternalContentPathValidator.java | ExternalContentPathValidator.validate | public void validate(final String extPath) throws ExternalMessageBodyException {
if (allowedList == null || allowedList.size() == 0) {
throw new ExternalMessageBodyException("External content is disallowed by the server");
}
if (isEmpty(extPath)) {
throw new ExternalMess... | java | public void validate(final String extPath) throws ExternalMessageBodyException {
if (allowedList == null || allowedList.size() == 0) {
throw new ExternalMessageBodyException("External content is disallowed by the server");
}
if (isEmpty(extPath)) {
throw new ExternalMess... | [
"public",
"void",
"validate",
"(",
"final",
"String",
"extPath",
")",
"throws",
"ExternalMessageBodyException",
"{",
"if",
"(",
"allowedList",
"==",
"null",
"||",
"allowedList",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"ExternalMessageBodyEx... | Validates that an external path is valid. The path must be an HTTP or file URI within the allow list of paths,
be absolute, and contain no relative modifier.
@param extPath external binary path to validate
@throws ExternalMessageBodyException thrown if the path is invalid. | [
"Validates",
"that",
"an",
"external",
"path",
"is",
"valid",
".",
"The",
"path",
"must",
"be",
"an",
"HTTP",
"or",
"file",
"URI",
"within",
"the",
"allow",
"list",
"of",
"paths",
"be",
"absolute",
"and",
"contain",
"no",
"relative",
"modifier",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-api/src/main/java/org/fcrepo/http/api/ExternalContentPathValidator.java#L70-L118 | train |
fcrepo4/fcrepo4 | fcrepo-http-api/src/main/java/org/fcrepo/http/api/ExternalContentPathValidator.java | ExternalContentPathValidator.loadConfiguration | @Override
protected synchronized void loadConfiguration() throws IOException {
LOGGER.info("Loading list of allowed external content locations from {}", configPath);
try (final Stream<String> stream = Files.lines(Paths.get(configPath))) {
allowedList = stream.map(line -> normalizePath(li... | java | @Override
protected synchronized void loadConfiguration() throws IOException {
LOGGER.info("Loading list of allowed external content locations from {}", configPath);
try (final Stream<String> stream = Files.lines(Paths.get(configPath))) {
allowedList = stream.map(line -> normalizePath(li... | [
"@",
"Override",
"protected",
"synchronized",
"void",
"loadConfiguration",
"(",
")",
"throws",
"IOException",
"{",
"LOGGER",
".",
"info",
"(",
"\"Loading list of allowed external content locations from {}\"",
",",
"configPath",
")",
";",
"try",
"(",
"final",
"Stream",
... | Loads the allowed list.
@throws IOException thrown if the allowed list configuration file cannot be read. | [
"Loads",
"the",
"allowed",
"list",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-api/src/main/java/org/fcrepo/http/api/ExternalContentPathValidator.java#L133-L141 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/NamespaceTools.java | NamespaceTools.validatePath | public static void validatePath(final Session session, final String path) {
final NamespaceRegistry namespaceRegistry = getNamespaceRegistry(session);
final String[] pathSegments = path.replaceAll("^/+", "").replaceAll("/+$", "").split("/");
for (final String segment : pathSegments) {
... | java | public static void validatePath(final Session session, final String path) {
final NamespaceRegistry namespaceRegistry = getNamespaceRegistry(session);
final String[] pathSegments = path.replaceAll("^/+", "").replaceAll("/+$", "").split("/");
for (final String segment : pathSegments) {
... | [
"public",
"static",
"void",
"validatePath",
"(",
"final",
"Session",
"session",
",",
"final",
"String",
"path",
")",
"{",
"final",
"NamespaceRegistry",
"namespaceRegistry",
"=",
"getNamespaceRegistry",
"(",
"session",
")",
";",
"final",
"String",
"[",
"]",
"path... | Validate resource path for unregistered namespace prefixes
@param session the JCR session to use
@param path the absolute path to the object
@throws org.fcrepo.kernel.api.exception.FedoraInvalidNamespaceException on unregistered namespaces
@throws org.fcrepo.kernel.api.exception.RepositoryRuntimeException if repositor... | [
"Validate",
"resource",
"path",
"for",
"unregistered",
"namespace",
"prefixes"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/NamespaceTools.java#L80-L105 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/NamespaceTools.java | NamespaceTools.getNamespaces | public static Map<String, String> getNamespaces(final Session session) {
final NamespaceRegistry registry = getNamespaceRegistry(session);
final Map<String, String> namespaces = new HashMap<>();
try {
stream(registry.getPrefixes()).filter(internalPrefix.negate()).forEach(x -> {
... | java | public static Map<String, String> getNamespaces(final Session session) {
final NamespaceRegistry registry = getNamespaceRegistry(session);
final Map<String, String> namespaces = new HashMap<>();
try {
stream(registry.getPrefixes()).filter(internalPrefix.negate()).forEach(x -> {
... | [
"public",
"static",
"Map",
"<",
"String",
",",
"String",
">",
"getNamespaces",
"(",
"final",
"Session",
"session",
")",
"{",
"final",
"NamespaceRegistry",
"registry",
"=",
"getNamespaceRegistry",
"(",
"session",
")",
";",
"final",
"Map",
"<",
"String",
",",
... | Retrieve the namespaces as a Map
@param session the JCR session to use
@return a mapping of the prefix to URI | [
"Retrieve",
"the",
"namespaces",
"as",
"a",
"Map"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/NamespaceTools.java#L113-L129 | train |
fcrepo4/fcrepo4 | fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/RdfStreamStreamingOutput.java | RdfStreamStreamingOutput.filterNamespacesToPresent | private static Map<String, String> filterNamespacesToPresent(final Model model,
final Map<String, String> nsPrefixes) {
final Map<String, String> resultNses = new HashMap<>();
final Set<Entry<String, String>> nsSet = nsPrefixes.entrySet();
final NsIterator nsIt = model.listNameSpaces... | java | private static Map<String, String> filterNamespacesToPresent(final Model model,
final Map<String, String> nsPrefixes) {
final Map<String, String> resultNses = new HashMap<>();
final Set<Entry<String, String>> nsSet = nsPrefixes.entrySet();
final NsIterator nsIt = model.listNameSpaces... | [
"private",
"static",
"Map",
"<",
"String",
",",
"String",
">",
"filterNamespacesToPresent",
"(",
"final",
"Model",
"model",
",",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"nsPrefixes",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"String",
">",
... | Filters the map of namespace prefix mappings to just those containing namespace URIs present in the model
@param model model
@param nsPrefixes map of namespace to uris
@return nsPrefixes filtered to namespaces found in the model | [
"Filters",
"the",
"map",
"of",
"namespace",
"prefix",
"mappings",
"to",
"just",
"those",
"containing",
"namespace",
"URIs",
"present",
"in",
"the",
"model"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/RdfStreamStreamingOutput.java#L208-L226 | train |
fcrepo4/fcrepo4 | fcrepo-http-api/src/main/java/org/fcrepo/http/api/repository/FedoraRepositoryBackup.java | FedoraRepositoryBackup.runBackup | @POST
public Response runBackup(final InputStream bodyStream) throws IOException {
File backupDirectory;
if (null != bodyStream) {
final String body = IOUtils.toString(bodyStream).trim();
backupDirectory = new File(body.trim());
if (body.isEmpty()) {
... | java | @POST
public Response runBackup(final InputStream bodyStream) throws IOException {
File backupDirectory;
if (null != bodyStream) {
final String body = IOUtils.toString(bodyStream).trim();
backupDirectory = new File(body.trim());
if (body.isEmpty()) {
... | [
"@",
"POST",
"public",
"Response",
"runBackup",
"(",
"final",
"InputStream",
"bodyStream",
")",
"throws",
"IOException",
"{",
"File",
"backupDirectory",
";",
"if",
"(",
"null",
"!=",
"bodyStream",
")",
"{",
"final",
"String",
"body",
"=",
"IOUtils",
".",
"to... | This method runs a repository backup.
@param bodyStream the input body stream
@return path to the backup
@throws IOException if IO exception occurred | [
"This",
"method",
"runs",
"a",
"repository",
"backup",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-api/src/main/java/org/fcrepo/http/api/repository/FedoraRepositoryBackup.java#L72-L114 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-api/src/main/java/org/fcrepo/kernel/api/rdf/RdfNamespaceRegistry.java | RdfNamespaceRegistry.loadConfiguration | @Override
protected synchronized void loadConfiguration() throws IOException {
final ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
final TypeReference<HashMap<String, String>> typeRef = new TypeReference<HashMap<String, String>>() {};
namespaces = mapper.readValue(new File(confi... | java | @Override
protected synchronized void loadConfiguration() throws IOException {
final ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
final TypeReference<HashMap<String, String>> typeRef = new TypeReference<HashMap<String, String>>() {};
namespaces = mapper.readValue(new File(confi... | [
"@",
"Override",
"protected",
"synchronized",
"void",
"loadConfiguration",
"(",
")",
"throws",
"IOException",
"{",
"final",
"ObjectMapper",
"mapper",
"=",
"new",
"ObjectMapper",
"(",
"new",
"YAMLFactory",
"(",
")",
")",
";",
"final",
"TypeReference",
"<",
"HashM... | Load the namespace prefix to URI configuration file | [
"Load",
"the",
"namespace",
"prefix",
"to",
"URI",
"configuration",
"file"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-api/src/main/java/org/fcrepo/kernel/api/rdf/RdfNamespaceRegistry.java#L43-L48 | train |
fcrepo4/fcrepo4 | fcrepo-http-api/src/main/java/org/fcrepo/http/api/responses/StreamingBaseHtmlProvider.java | StreamingBaseHtmlProvider.getResourceFromSubject | private FedoraResource getResourceFromSubject(final String subjectUri) {
final UriTemplate uriTemplate =
new UriTemplate(uriInfo.getBaseUriBuilder().clone().path(FedoraLdp.class).toTemplate());
final Map<String, String> values = new HashMap<>();
uriTemplate.match(subjectUri, values);... | java | private FedoraResource getResourceFromSubject(final String subjectUri) {
final UriTemplate uriTemplate =
new UriTemplate(uriInfo.getBaseUriBuilder().clone().path(FedoraLdp.class).toTemplate());
final Map<String, String> values = new HashMap<>();
uriTemplate.match(subjectUri, values);... | [
"private",
"FedoraResource",
"getResourceFromSubject",
"(",
"final",
"String",
"subjectUri",
")",
"{",
"final",
"UriTemplate",
"uriTemplate",
"=",
"new",
"UriTemplate",
"(",
"uriInfo",
".",
"getBaseUriBuilder",
"(",
")",
".",
"clone",
"(",
")",
".",
"path",
"(",... | Get a FedoraResource for the subject of the graph, if it exists.
@param subjectUri the uri of the subject
@return FedoraResource if exists or null | [
"Get",
"a",
"FedoraResource",
"for",
"the",
"subject",
"of",
"the",
"graph",
"if",
"it",
"exists",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-api/src/main/java/org/fcrepo/http/api/responses/StreamingBaseHtmlProvider.java#L211-L230 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/spring/ModeShapeRepositoryFactoryBean.java | ModeShapeRepositoryFactoryBean.buildRepository | @PostConstruct
public void buildRepository() {
try {
LOGGER.info("Using repo config (classpath): {}", repositoryConfiguration.getURL());
getPropertiesLoader().loadSystemProperties();
final RepositoryConfiguration config =
RepositoryConfiguration.read(... | java | @PostConstruct
public void buildRepository() {
try {
LOGGER.info("Using repo config (classpath): {}", repositoryConfiguration.getURL());
getPropertiesLoader().loadSystemProperties();
final RepositoryConfiguration config =
RepositoryConfiguration.read(... | [
"@",
"PostConstruct",
"public",
"void",
"buildRepository",
"(",
")",
"{",
"try",
"{",
"LOGGER",
".",
"info",
"(",
"\"Using repo config (classpath): {}\"",
",",
"repositoryConfiguration",
".",
"getURL",
"(",
")",
")",
";",
"getPropertiesLoader",
"(",
")",
".",
"l... | Generate a JCR repository from the given configuration | [
"Generate",
"a",
"JCR",
"repository",
"from",
"the",
"given",
"configuration"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/spring/ModeShapeRepositoryFactoryBean.java#L68-L88 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/spring/ModeShapeRepositoryFactoryBean.java | ModeShapeRepositoryFactoryBean.stopRepository | @PreDestroy
public void stopRepository() throws InterruptedException {
LOGGER.info("Initiating shutdown of ModeShape");
final String repoName = repository.getName();
try {
final Future<Boolean> futureUndeployRepo = modeShapeEngine.undeploy(repoName);
if (futureUndeplo... | java | @PreDestroy
public void stopRepository() throws InterruptedException {
LOGGER.info("Initiating shutdown of ModeShape");
final String repoName = repository.getName();
try {
final Future<Boolean> futureUndeployRepo = modeShapeEngine.undeploy(repoName);
if (futureUndeplo... | [
"@",
"PreDestroy",
"public",
"void",
"stopRepository",
"(",
")",
"throws",
"InterruptedException",
"{",
"LOGGER",
".",
"info",
"(",
"\"Initiating shutdown of ModeShape\"",
")",
";",
"final",
"String",
"repoName",
"=",
"repository",
".",
"getName",
"(",
")",
";",
... | Attempts to undeploy the repository and shutdown the ModeShape engine on
context destroy.
@throws InterruptedException if interrupted exception occurred | [
"Attempts",
"to",
"undeploy",
"the",
"repository",
"and",
"shutdown",
"the",
"ModeShape",
"engine",
"on",
"context",
"destroy",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/spring/ModeShapeRepositoryFactoryBean.java#L96-L123 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/services/ServiceHelpers.java | ServiceHelpers.getNodePropertySize | private static Long getNodePropertySize(final Node node)
throws RepositoryException {
Long size = 0L;
for (final PropertyIterator i = node.getProperties(); i.hasNext();) {
final Property p = i.nextProperty();
if (p.isMultiple()) {
for (final Value v : p.ge... | java | private static Long getNodePropertySize(final Node node)
throws RepositoryException {
Long size = 0L;
for (final PropertyIterator i = node.getProperties(); i.hasNext();) {
final Property p = i.nextProperty();
if (p.isMultiple()) {
for (final Value v : p.ge... | [
"private",
"static",
"Long",
"getNodePropertySize",
"(",
"final",
"Node",
"node",
")",
"throws",
"RepositoryException",
"{",
"Long",
"size",
"=",
"0L",
";",
"for",
"(",
"final",
"PropertyIterator",
"i",
"=",
"node",
".",
"getProperties",
"(",
")",
";",
"i",
... | Get the total size of a Node's properties
@param node the node
@return size in bytes
@throws RepositoryException if repository exception occurred | [
"Get",
"the",
"total",
"size",
"of",
"a",
"Node",
"s",
"properties"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/services/ServiceHelpers.java#L62-L76 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/services/ServiceHelpers.java | ServiceHelpers.getContentSize | private static Long getContentSize(final Node ds) {
try {
long size = 0L;
if (ds.hasNode(JCR_CONTENT)) {
final Node contentNode = ds.getNode(JCR_CONTENT);
if (contentNode.hasProperty(JCR_DATA)) {
size =
ds.g... | java | private static Long getContentSize(final Node ds) {
try {
long size = 0L;
if (ds.hasNode(JCR_CONTENT)) {
final Node contentNode = ds.getNode(JCR_CONTENT);
if (contentNode.hasProperty(JCR_DATA)) {
size =
ds.g... | [
"private",
"static",
"Long",
"getContentSize",
"(",
"final",
"Node",
"ds",
")",
"{",
"try",
"{",
"long",
"size",
"=",
"0L",
";",
"if",
"(",
"ds",
".",
"hasNode",
"(",
"JCR_CONTENT",
")",
")",
"{",
"final",
"Node",
"contentNode",
"=",
"ds",
".",
"getN... | Get the size of the JCR content binary property
@param ds the given node
@return size of the binary content property | [
"Get",
"the",
"size",
"of",
"the",
"JCR",
"content",
"binary",
"property"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/services/ServiceHelpers.java#L123-L141 | train |
fcrepo4/fcrepo4 | fcrepo-http-api/src/main/java/org/fcrepo/http/api/FedoraTransactions.java | FedoraTransactions.createTransaction | @POST
public Response createTransaction(@PathParam("path") final String externalPath) throws URISyntaxException {
if (batchService.exists(session.getId(), getUserPrincipal())) {
LOGGER.debug("renewing transaction {}", session.getId());
batchService.refresh(session.getId(), getUserPr... | java | @POST
public Response createTransaction(@PathParam("path") final String externalPath) throws URISyntaxException {
if (batchService.exists(session.getId(), getUserPrincipal())) {
LOGGER.debug("renewing transaction {}", session.getId());
batchService.refresh(session.getId(), getUserPr... | [
"@",
"POST",
"public",
"Response",
"createTransaction",
"(",
"@",
"PathParam",
"(",
"\"path\"",
")",
"final",
"String",
"externalPath",
")",
"throws",
"URISyntaxException",
"{",
"if",
"(",
"batchService",
".",
"exists",
"(",
"session",
".",
"getId",
"(",
")",
... | Create a new transaction resource and add it to the registry
@param externalPath the external path
@return 201 with the transaction id and expiration date
@throws URISyntaxException if URI syntax exception occurred | [
"Create",
"a",
"new",
"transaction",
"resource",
"and",
"add",
"it",
"to",
"the",
"registry"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-api/src/main/java/org/fcrepo/http/api/FedoraTransactions.java#L62-L89 | train |
fcrepo4/fcrepo4 | fcrepo-http-api/src/main/java/org/fcrepo/http/api/FedoraTransactions.java | FedoraTransactions.commit | @POST
@Path("fcr:commit")
public Response commit(@PathParam("path") final String externalPath) {
LOGGER.info("Commit transaction '{}'", externalPath);
return finalizeTransaction(externalPath, getUserPrincipal(), true);
} | java | @POST
@Path("fcr:commit")
public Response commit(@PathParam("path") final String externalPath) {
LOGGER.info("Commit transaction '{}'", externalPath);
return finalizeTransaction(externalPath, getUserPrincipal(), true);
} | [
"@",
"POST",
"@",
"Path",
"(",
"\"fcr:commit\"",
")",
"public",
"Response",
"commit",
"(",
"@",
"PathParam",
"(",
"\"path\"",
")",
"final",
"String",
"externalPath",
")",
"{",
"LOGGER",
".",
"info",
"(",
"\"Commit transaction '{}'\"",
",",
"externalPath",
")",... | Commit a transaction resource
@param externalPath the external path
@return 204 | [
"Commit",
"a",
"transaction",
"resource"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-api/src/main/java/org/fcrepo/http/api/FedoraTransactions.java#L97-L102 | train |
fcrepo4/fcrepo4 | fcrepo-http-api/src/main/java/org/fcrepo/http/api/FedoraTransactions.java | FedoraTransactions.rollback | @POST
@Path("fcr:rollback")
public Response rollback(@PathParam("path") final String externalPath) {
LOGGER.info("Rollback transaction '{}'", externalPath);
return finalizeTransaction(externalPath, getUserPrincipal(), false);
} | java | @POST
@Path("fcr:rollback")
public Response rollback(@PathParam("path") final String externalPath) {
LOGGER.info("Rollback transaction '{}'", externalPath);
return finalizeTransaction(externalPath, getUserPrincipal(), false);
} | [
"@",
"POST",
"@",
"Path",
"(",
"\"fcr:rollback\"",
")",
"public",
"Response",
"rollback",
"(",
"@",
"PathParam",
"(",
"\"path\"",
")",
"final",
"String",
"externalPath",
")",
"{",
"LOGGER",
".",
"info",
"(",
"\"Rollback transaction '{}'\"",
",",
"externalPath",
... | Rollback a transaction
@param externalPath the external path
@return 204 | [
"Rollback",
"a",
"transaction"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-api/src/main/java/org/fcrepo/http/api/FedoraTransactions.java#L110-L116 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/FedoraSessionImpl.java | FedoraSessionImpl.getJcrSession | public static Session getJcrSession(final FedoraSession session) {
if (session instanceof FedoraSessionImpl) {
return ((FedoraSessionImpl)session).getJcrSession();
}
throw new ClassCastException("FedoraSession is not a " + FedoraSessionImpl.class.getCanonicalName());
} | java | public static Session getJcrSession(final FedoraSession session) {
if (session instanceof FedoraSessionImpl) {
return ((FedoraSessionImpl)session).getJcrSession();
}
throw new ClassCastException("FedoraSession is not a " + FedoraSessionImpl.class.getCanonicalName());
} | [
"public",
"static",
"Session",
"getJcrSession",
"(",
"final",
"FedoraSession",
"session",
")",
"{",
"if",
"(",
"session",
"instanceof",
"FedoraSessionImpl",
")",
"{",
"return",
"(",
"(",
"FedoraSessionImpl",
")",
"session",
")",
".",
"getJcrSession",
"(",
")",
... | Get the internal JCR session from an existing FedoraSession
@param session the FedoraSession
@return the JCR session | [
"Get",
"the",
"internal",
"JCR",
"session",
"from",
"an",
"existing",
"FedoraSession"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/FedoraSessionImpl.java#L166-L171 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-api/src/main/java/org/fcrepo/kernel/api/utils/SubjectMappingUtil.java | SubjectMappingUtil.mapSubject | public static Triple mapSubject(final Triple t, final String resourceUri, final String destinationUri) {
final Node destinationNode = createURI(destinationUri);
return mapSubject(t, resourceUri, destinationNode);
} | java | public static Triple mapSubject(final Triple t, final String resourceUri, final String destinationUri) {
final Node destinationNode = createURI(destinationUri);
return mapSubject(t, resourceUri, destinationNode);
} | [
"public",
"static",
"Triple",
"mapSubject",
"(",
"final",
"Triple",
"t",
",",
"final",
"String",
"resourceUri",
",",
"final",
"String",
"destinationUri",
")",
"{",
"final",
"Node",
"destinationNode",
"=",
"createURI",
"(",
"destinationUri",
")",
";",
"return",
... | Maps the subject of t from resourceUri to destinationUri to produce a new Triple.
If the triple does not have the subject resourceUri, then the triple is unchanged.
@param t triple to be remapped.
@param resourceUri resource subject uri to be remapped.
@param destinationUri subject uri for the resultant triple.
@retur... | [
"Maps",
"the",
"subject",
"of",
"t",
"from",
"resourceUri",
"to",
"destinationUri",
"to",
"produce",
"a",
"new",
"Triple",
".",
"If",
"the",
"triple",
"does",
"not",
"have",
"the",
"subject",
"resourceUri",
"then",
"the",
"triple",
"is",
"unchanged",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-api/src/main/java/org/fcrepo/kernel/api/utils/SubjectMappingUtil.java#L45-L48 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-api/src/main/java/org/fcrepo/kernel/api/utils/SubjectMappingUtil.java | SubjectMappingUtil.mapSubject | public static Triple mapSubject(final Triple t, final String resourceUri, final Node destinationNode) {
final Node tripleSubj = t.getSubject();
final String tripleSubjUri = tripleSubj.getURI();
final Node subject;
if (tripleSubjUri.equals(resourceUri)) {
subject = destination... | java | public static Triple mapSubject(final Triple t, final String resourceUri, final Node destinationNode) {
final Node tripleSubj = t.getSubject();
final String tripleSubjUri = tripleSubj.getURI();
final Node subject;
if (tripleSubjUri.equals(resourceUri)) {
subject = destination... | [
"public",
"static",
"Triple",
"mapSubject",
"(",
"final",
"Triple",
"t",
",",
"final",
"String",
"resourceUri",
",",
"final",
"Node",
"destinationNode",
")",
"{",
"final",
"Node",
"tripleSubj",
"=",
"t",
".",
"getSubject",
"(",
")",
";",
"final",
"String",
... | Maps the subject of t from resourceUri to destinationNode to produce a new Triple.
If the triple does not have the subject resourceUri, then the triple is unchanged.
@param t triple to be remapped.
@param resourceUri resource subject uri to be remapped.
@param destinationNode subject node for the resultant triple.
@re... | [
"Maps",
"the",
"subject",
"of",
"t",
"from",
"resourceUri",
"to",
"destinationNode",
"to",
"produce",
"a",
"new",
"Triple",
".",
"If",
"the",
"triple",
"does",
"not",
"have",
"the",
"subject",
"resourceUri",
"then",
"the",
"triple",
"is",
"unchanged",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-api/src/main/java/org/fcrepo/kernel/api/utils/SubjectMappingUtil.java#L59-L74 | train |
fcrepo4/fcrepo4 | fcrepo-event-serialization/src/main/java/org/fcrepo/event/serialization/TurtleSerializer.java | TurtleSerializer.serialize | @Override
public String serialize(final FedoraEvent evt) {
try {
final Model model = EventSerializer.toModel(evt);
final ByteArrayOutputStream out = new ByteArrayOutputStream();
model.write(out, "TTL");
return out.toString("UTF-8");
} catch (final Unsu... | java | @Override
public String serialize(final FedoraEvent evt) {
try {
final Model model = EventSerializer.toModel(evt);
final ByteArrayOutputStream out = new ByteArrayOutputStream();
model.write(out, "TTL");
return out.toString("UTF-8");
} catch (final Unsu... | [
"@",
"Override",
"public",
"String",
"serialize",
"(",
"final",
"FedoraEvent",
"evt",
")",
"{",
"try",
"{",
"final",
"Model",
"model",
"=",
"EventSerializer",
".",
"toModel",
"(",
"evt",
")",
";",
"final",
"ByteArrayOutputStream",
"out",
"=",
"new",
"ByteArr... | Serialize a FedoraEvent in RDF using Turtle syntax
@param evt the Fedora event
@return a string of RDF, using Turtle syntax | [
"Serialize",
"a",
"FedoraEvent",
"in",
"RDF",
"using",
"Turtle",
"syntax"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-event-serialization/src/main/java/org/fcrepo/event/serialization/TurtleSerializer.java#L39-L49 | train |
fcrepo4/fcrepo4 | fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/exceptionhandlers/ConstraintExceptionMapper.java | ConstraintExceptionMapper.buildConstraintLink | public static Link buildConstraintLink(final ConstraintViolationException e,
final ServletContext context,
final UriInfo uriInfo) {
String path = context.getContextPath();
if (path.equals("/")) {
path = ""... | java | public static Link buildConstraintLink(final ConstraintViolationException e,
final ServletContext context,
final UriInfo uriInfo) {
String path = context.getContextPath();
if (path.equals("/")) {
path = ""... | [
"public",
"static",
"Link",
"buildConstraintLink",
"(",
"final",
"ConstraintViolationException",
"e",
",",
"final",
"ServletContext",
"context",
",",
"final",
"UriInfo",
"uriInfo",
")",
"{",
"String",
"path",
"=",
"context",
".",
"getContextPath",
"(",
")",
";",
... | Creates a constrainedBy link header with the appropriate RDF URL for the exception.
@param e ConstraintViolationException Exception which implements the buildContraintUri method.
@param context ServletContext ServletContext that we're running in.
@param uriInfo UriInfo UriInfo from the ExceptionMapper.
@return Link A ... | [
"Creates",
"a",
"constrainedBy",
"link",
"header",
"with",
"the",
"appropriate",
"RDF",
"URL",
"for",
"the",
"exception",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/exceptionhandlers/ConstraintExceptionMapper.java#L51-L64 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/FedoraTypesUtils.java | FedoraTypesUtils.getPropertyType | public static Optional<Integer> getPropertyType(final Node node, final String propertyName)
throws RepositoryException {
LOGGER.debug("Getting type of property: {} from node: {}", propertyName, node);
return getDefinitionForPropertyName(node, propertyName).map(PropertyDefinition::getRequired... | java | public static Optional<Integer> getPropertyType(final Node node, final String propertyName)
throws RepositoryException {
LOGGER.debug("Getting type of property: {} from node: {}", propertyName, node);
return getDefinitionForPropertyName(node, propertyName).map(PropertyDefinition::getRequired... | [
"public",
"static",
"Optional",
"<",
"Integer",
">",
"getPropertyType",
"(",
"final",
"Node",
"node",
",",
"final",
"String",
"propertyName",
")",
"throws",
"RepositoryException",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Getting type of property: {} from node: {}\"",
",",... | Get the JCR property type ID for a given property name. If unsure, mark
it as UNDEFINED.
@param node the JCR node to add the property on
@param propertyName the property name
@return a PropertyType value
@throws RepositoryException if repository exception occurred | [
"Get",
"the",
"JCR",
"property",
"type",
"ID",
"for",
"a",
"given",
"property",
"name",
".",
"If",
"unsure",
"mark",
"it",
"as",
"UNDEFINED",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/FedoraTypesUtils.java#L258-L262 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/FedoraTypesUtils.java | FedoraTypesUtils.getReferencePropertyOriginalName | public static String getReferencePropertyOriginalName(final String refPropertyName) {
final int i = refPropertyName.lastIndexOf(REFERENCE_PROPERTY_SUFFIX);
return i < 0 ? refPropertyName : refPropertyName.substring(0, i);
} | java | public static String getReferencePropertyOriginalName(final String refPropertyName) {
final int i = refPropertyName.lastIndexOf(REFERENCE_PROPERTY_SUFFIX);
return i < 0 ? refPropertyName : refPropertyName.substring(0, i);
} | [
"public",
"static",
"String",
"getReferencePropertyOriginalName",
"(",
"final",
"String",
"refPropertyName",
")",
"{",
"final",
"int",
"i",
"=",
"refPropertyName",
".",
"lastIndexOf",
"(",
"REFERENCE_PROPERTY_SUFFIX",
")",
";",
"return",
"i",
"<",
"0",
"?",
"refPr... | Given an internal reference node property, get the original name
@param refPropertyName the reference node property name
@return original property name of the reference property | [
"Given",
"an",
"internal",
"reference",
"node",
"property",
"get",
"the",
"original",
"name"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/FedoraTypesUtils.java#L313-L316 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/FedoraTypesUtils.java | FedoraTypesUtils.isReferenceProperty | public static boolean isReferenceProperty(final Node node, final String propertyName) throws RepositoryException {
final Optional<PropertyDefinition> propertyDefinition = getDefinitionForPropertyName(node, propertyName);
return propertyDefinition.isPresent() &&
(propertyDefinition.get()... | java | public static boolean isReferenceProperty(final Node node, final String propertyName) throws RepositoryException {
final Optional<PropertyDefinition> propertyDefinition = getDefinitionForPropertyName(node, propertyName);
return propertyDefinition.isPresent() &&
(propertyDefinition.get()... | [
"public",
"static",
"boolean",
"isReferenceProperty",
"(",
"final",
"Node",
"node",
",",
"final",
"String",
"propertyName",
")",
"throws",
"RepositoryException",
"{",
"final",
"Optional",
"<",
"PropertyDefinition",
">",
"propertyDefinition",
"=",
"getDefinitionForProper... | Check if a property definition is a reference property
@param node the given node
@param propertyName the property name
@return whether a property definition is a reference property
@throws RepositoryException if repository exception occurred | [
"Check",
"if",
"a",
"property",
"definition",
"is",
"a",
"reference",
"property"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/FedoraTypesUtils.java#L325-L331 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/FedoraTypesUtils.java | FedoraTypesUtils.getClosestExistingAncestor | public static Node getClosestExistingAncestor(final Session session, final String path)
throws RepositoryException {
String potentialPath = path.startsWith("/") ? path : "/" + path;
while (!potentialPath.isEmpty()) {
if (session.nodeExists(potentialPath)) {
retur... | java | public static Node getClosestExistingAncestor(final Session session, final String path)
throws RepositoryException {
String potentialPath = path.startsWith("/") ? path : "/" + path;
while (!potentialPath.isEmpty()) {
if (session.nodeExists(potentialPath)) {
retur... | [
"public",
"static",
"Node",
"getClosestExistingAncestor",
"(",
"final",
"Session",
"session",
",",
"final",
"String",
"path",
")",
"throws",
"RepositoryException",
"{",
"String",
"potentialPath",
"=",
"path",
".",
"startsWith",
"(",
"\"/\"",
")",
"?",
"path",
":... | Get the closest ancestor that current exists
@param session the given session
@param path the given path
@return the closest ancestor that current exists
@throws RepositoryException if repository exception occurred | [
"Get",
"the",
"closest",
"ancestor",
"that",
"current",
"exists"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/FedoraTypesUtils.java#L342-L353 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/FedoraTypesUtils.java | FedoraTypesUtils.getJcrNode | public static Node getJcrNode(final FedoraResource resource) {
if (resource instanceof FedoraResourceImpl) {
return ((FedoraResourceImpl)resource).getNode();
}
throw new IllegalArgumentException("FedoraResource is of the wrong type");
} | java | public static Node getJcrNode(final FedoraResource resource) {
if (resource instanceof FedoraResourceImpl) {
return ((FedoraResourceImpl)resource).getNode();
}
throw new IllegalArgumentException("FedoraResource is of the wrong type");
} | [
"public",
"static",
"Node",
"getJcrNode",
"(",
"final",
"FedoraResource",
"resource",
")",
"{",
"if",
"(",
"resource",
"instanceof",
"FedoraResourceImpl",
")",
"{",
"return",
"(",
"(",
"FedoraResourceImpl",
")",
"resource",
")",
".",
"getNode",
"(",
")",
";",
... | Retrieve the underlying JCR Node from the FedoraResource
@param resource the Fedora resource
@return the JCR Node | [
"Retrieve",
"the",
"underlying",
"JCR",
"Node",
"from",
"the",
"FedoraResource"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/FedoraTypesUtils.java#L361-L366 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/FedoraTypesUtils.java | FedoraTypesUtils.resourceToProperty | public static Function<Resource, Optional<String>> resourceToProperty(final Session session) {
return resource -> {
try {
final NamespaceRegistry registry = getNamespaceRegistry(session);
return Optional.of(registry.getPrefix(resource.getNameSpace()) + ":" + resource.... | java | public static Function<Resource, Optional<String>> resourceToProperty(final Session session) {
return resource -> {
try {
final NamespaceRegistry registry = getNamespaceRegistry(session);
return Optional.of(registry.getPrefix(resource.getNameSpace()) + ":" + resource.... | [
"public",
"static",
"Function",
"<",
"Resource",
",",
"Optional",
"<",
"String",
">",
">",
"resourceToProperty",
"(",
"final",
"Session",
"session",
")",
"{",
"return",
"resource",
"->",
"{",
"try",
"{",
"final",
"NamespaceRegistry",
"registry",
"=",
"getNames... | Using a JCR session, return a function that maps an RDF Resource to a corresponding property name.
@param session The JCR session
@return a Function that maps a Resource to an Optional-wrapped String | [
"Using",
"a",
"JCR",
"session",
"return",
"a",
"function",
"that",
"maps",
"an",
"RDF",
"Resource",
"to",
"a",
"corresponding",
"property",
"name",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/FedoraTypesUtils.java#L388-L398 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/FedoraTypesUtils.java | FedoraTypesUtils.touch | private static void touch(final Node node, final Calendar modified, final String modifyingUser) {
touch(node, null, null, modified, modifyingUser);
} | java | private static void touch(final Node node, final Calendar modified, final String modifyingUser) {
touch(node, null, null, modified, modifyingUser);
} | [
"private",
"static",
"void",
"touch",
"(",
"final",
"Node",
"node",
",",
"final",
"Calendar",
"modified",
",",
"final",
"String",
"modifyingUser",
")",
"{",
"touch",
"(",
"node",
",",
"null",
",",
"null",
",",
"modified",
",",
"modifyingUser",
")",
";",
... | Updates the LAST_MODIFIED_DATE and LAST_MODIFIED_BY properties to the provided values.
@param node The JCR node
@param modified the modification date, or null if not explicitly set
@param modifyingUser the userID who modified this resource or null if not explicitly set | [
"Updates",
"the",
"LAST_MODIFIED_DATE",
"and",
"LAST_MODIFIED_BY",
"properties",
"to",
"the",
"provided",
"values",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/FedoraTypesUtils.java#L454-L456 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/FedoraTypesUtils.java | FedoraTypesUtils.touch | public static void touch(final Node node, final Calendar created, final String creatingUser,
final Calendar modified, final String modifyingUser) {
try {
if (created != null) {
node.setProperty(FEDORA_CREATED, created);
}
if (crea... | java | public static void touch(final Node node, final Calendar created, final String creatingUser,
final Calendar modified, final String modifyingUser) {
try {
if (created != null) {
node.setProperty(FEDORA_CREATED, created);
}
if (crea... | [
"public",
"static",
"void",
"touch",
"(",
"final",
"Node",
"node",
",",
"final",
"Calendar",
"created",
",",
"final",
"String",
"creatingUser",
",",
"final",
"Calendar",
"modified",
",",
"final",
"String",
"modifyingUser",
")",
"{",
"try",
"{",
"if",
"(",
... | Updates the LAST_MODIFIED_DATE, LAST_MODIFIED_BY, CREATED_DATE and CREATED_BY properties to the provided values.
@param node The JCR node
@param created the date the resource was created, or null if not explicitly set
@param creatingUser the userID of created this resource or null if not explicitly set
@param modified... | [
"Updates",
"the",
"LAST_MODIFIED_DATE",
"LAST_MODIFIED_BY",
"CREATED_DATE",
"and",
"CREATED_BY",
"properties",
"to",
"the",
"provided",
"values",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/FedoraTypesUtils.java#L468-L498 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/FedoraTypesUtils.java | FedoraTypesUtils.getContainingNode | public static Optional<Node> getContainingNode(final Node node) {
try {
if (node.getDepth() == 0) {
return empty();
}
// check ancestors recursively only either of the following two cases applies:
// 1. the PARENT is a FEDORA_PAIRTREE
... | java | public static Optional<Node> getContainingNode(final Node node) {
try {
if (node.getDepth() == 0) {
return empty();
}
// check ancestors recursively only either of the following two cases applies:
// 1. the PARENT is a FEDORA_PAIRTREE
... | [
"public",
"static",
"Optional",
"<",
"Node",
">",
"getContainingNode",
"(",
"final",
"Node",
"node",
")",
"{",
"try",
"{",
"if",
"(",
"node",
".",
"getDepth",
"(",
")",
"==",
"0",
")",
"{",
"return",
"empty",
"(",
")",
";",
"}",
"// check ancestors rec... | Get the JCR Node that corresponds to the containing node in the repository.
This may be the direct parent node, but it may also be a more distant ancestor.
@param node the JCR node
@return the containing node, if one is present | [
"Get",
"the",
"JCR",
"Node",
"that",
"corresponds",
"to",
"the",
"containing",
"node",
"in",
"the",
"repository",
".",
"This",
"may",
"be",
"the",
"direct",
"parent",
"node",
"but",
"it",
"may",
"also",
"be",
"a",
"more",
"distant",
"ancestor",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/FedoraTypesUtils.java#L507-L524 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/observer/FedoraEventImpl.java | FedoraEventImpl.valueOf | public static EventType valueOf(final Integer i) {
final EventType type = translation.get(i);
if (isNull(type)) {
throw new IllegalArgumentException("Invalid event type: " + i);
}
return type;
} | java | public static EventType valueOf(final Integer i) {
final EventType type = translation.get(i);
if (isNull(type)) {
throw new IllegalArgumentException("Invalid event type: " + i);
}
return type;
} | [
"public",
"static",
"EventType",
"valueOf",
"(",
"final",
"Integer",
"i",
")",
"{",
"final",
"EventType",
"type",
"=",
"translation",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"isNull",
"(",
"type",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentExcepti... | Get the Fedora event type for a JCR type
@param i the integer value of a JCR type
@return EventType | [
"Get",
"the",
"Fedora",
"event",
"type",
"for",
"a",
"JCR",
"type"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/observer/FedoraEventImpl.java#L235-L241 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/observer/FedoraEventImpl.java | FedoraEventImpl.from | public static FedoraEvent from(final Event event) {
requireNonNull(event);
try {
@SuppressWarnings("unchecked")
final Map<String, String> info = new HashMap<>(event.getInfo());
final String userdata = event.getUserData();
try {
if (userdat... | java | public static FedoraEvent from(final Event event) {
requireNonNull(event);
try {
@SuppressWarnings("unchecked")
final Map<String, String> info = new HashMap<>(event.getInfo());
final String userdata = event.getUserData();
try {
if (userdat... | [
"public",
"static",
"FedoraEvent",
"from",
"(",
"final",
"Event",
"event",
")",
"{",
"requireNonNull",
"(",
"event",
")",
";",
"try",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"info",
"=",
... | Convert a JCR Event to a FedoraEvent
@param event the JCR Event
@return a FedoraEvent | [
"Convert",
"a",
"JCR",
"Event",
"to",
"a",
"FedoraEvent"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/observer/FedoraEventImpl.java#L249-L285 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/observer/FedoraEventImpl.java | FedoraEventImpl.getResourceTypes | public static Stream<String> getResourceTypes(final Event event) {
if (event instanceof org.modeshape.jcr.api.observation.Event) {
try {
final org.modeshape.jcr.api.observation.Event modeEvent =
(org.modeshape.jcr.api.observation.Event) event;
... | java | public static Stream<String> getResourceTypes(final Event event) {
if (event instanceof org.modeshape.jcr.api.observation.Event) {
try {
final org.modeshape.jcr.api.observation.Event modeEvent =
(org.modeshape.jcr.api.observation.Event) event;
... | [
"public",
"static",
"Stream",
"<",
"String",
">",
"getResourceTypes",
"(",
"final",
"Event",
"event",
")",
"{",
"if",
"(",
"event",
"instanceof",
"org",
".",
"modeshape",
".",
"jcr",
".",
"api",
".",
"observation",
".",
"Event",
")",
"{",
"try",
"{",
"... | Get the RDF Types of the resource corresponding to this JCR Event
@param event the JCR event
@return the types recorded on the resource associated to this event | [
"Get",
"the",
"RDF",
"Types",
"of",
"the",
"resource",
"corresponding",
"to",
"this",
"JCR",
"Event"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/observer/FedoraEventImpl.java#L292-L308 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/services/ExternalContentServiceImpl.java | ExternalContentServiceImpl.retrieveExternalContent | @SuppressWarnings("resource")
@Override
public InputStream retrieveExternalContent(final URI sourceUri) throws IOException {
final HttpGet httpGet = new HttpGet(sourceUri);
final CloseableHttpClient client = getCloseableHttpClient();
final HttpResponse response = client.execute(httpGet);... | java | @SuppressWarnings("resource")
@Override
public InputStream retrieveExternalContent(final URI sourceUri) throws IOException {
final HttpGet httpGet = new HttpGet(sourceUri);
final CloseableHttpClient client = getCloseableHttpClient();
final HttpResponse response = client.execute(httpGet);... | [
"@",
"SuppressWarnings",
"(",
"\"resource\"",
")",
"@",
"Override",
"public",
"InputStream",
"retrieveExternalContent",
"(",
"final",
"URI",
"sourceUri",
")",
"throws",
"IOException",
"{",
"final",
"HttpGet",
"httpGet",
"=",
"new",
"HttpGet",
"(",
"sourceUri",
")"... | Retrieve the content at the URI using the global connection pool.
@param sourceUri the source uri
@return the content at the URI using the global connection pool
@throws IOException if IO exception occurred | [
"Retrieve",
"the",
"content",
"at",
"the",
"URI",
"using",
"the",
"global",
"connection",
"pool",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/services/ExternalContentServiceImpl.java#L50-L57 | train |
aalmiray/Json-lib | src/main/java/net/sf/json/JSONObject.java | JSONObject.toBean | public static Object toBean( JSONObject jsonObject ) {
if( jsonObject == null || jsonObject.isNullObject() ){
return null;
}
DynaBean dynaBean = null;
JsonConfig jsonConfig = new JsonConfig();
Map props = JSONUtils.getProperties( jsonObject );
dynaBean = JSONUtils.newDynaB... | java | public static Object toBean( JSONObject jsonObject ) {
if( jsonObject == null || jsonObject.isNullObject() ){
return null;
}
DynaBean dynaBean = null;
JsonConfig jsonConfig = new JsonConfig();
Map props = JSONUtils.getProperties( jsonObject );
dynaBean = JSONUtils.newDynaB... | [
"public",
"static",
"Object",
"toBean",
"(",
"JSONObject",
"jsonObject",
")",
"{",
"if",
"(",
"jsonObject",
"==",
"null",
"||",
"jsonObject",
".",
"isNullObject",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"DynaBean",
"dynaBean",
"=",
"null",
";",
"... | Creates a JSONDynaBean from a JSONObject. | [
"Creates",
"a",
"JSONDynaBean",
"from",
"a",
"JSONObject",
"."
] | 9e2b3376ee8f511a48aa7ac05f75a7414e02280f | https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/JSONObject.java#L168-L214 | train |
aalmiray/Json-lib | src/main/java/net/sf/json/util/JavaIdentifierTransformer.java | JavaIdentifierTransformer.shaveOffNonJavaIdentifierStartChars | protected final String shaveOffNonJavaIdentifierStartChars( String str ) {
String str2 = str;
// shave off first char if not valid
boolean ready = false;
while( !ready ){
if( !Character.isJavaIdentifierStart( str2.charAt( 0 ) ) ){
str2 = str2.substring( 1 );
if( ... | java | protected final String shaveOffNonJavaIdentifierStartChars( String str ) {
String str2 = str;
// shave off first char if not valid
boolean ready = false;
while( !ready ){
if( !Character.isJavaIdentifierStart( str2.charAt( 0 ) ) ){
str2 = str2.substring( 1 );
if( ... | [
"protected",
"final",
"String",
"shaveOffNonJavaIdentifierStartChars",
"(",
"String",
"str",
")",
"{",
"String",
"str2",
"=",
"str",
";",
"// shave off first char if not valid",
"boolean",
"ready",
"=",
"false",
";",
"while",
"(",
"!",
"ready",
")",
"{",
"if",
"... | Removes all non JavaIdentifier chars from the start of the string.
@throws JSONException if the resulting string has zero length. | [
"Removes",
"all",
"non",
"JavaIdentifier",
"chars",
"from",
"the",
"start",
"of",
"the",
"string",
"."
] | 9e2b3376ee8f511a48aa7ac05f75a7414e02280f | https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/util/JavaIdentifierTransformer.java#L57-L72 | train |
aalmiray/Json-lib | src/main/java/net/sf/json/xml/XMLSerializer.java | XMLSerializer.read | public JSON read( String xml ) {
JSON json = null;
try{
Document doc = new Builder().build( new StringReader( xml ) );
Element root = doc.getRootElement();
if( isNullObject( root ) ){
return JSONNull.getInstance();
}
String defaultType = getType( root... | java | public JSON read( String xml ) {
JSON json = null;
try{
Document doc = new Builder().build( new StringReader( xml ) );
Element root = doc.getRootElement();
if( isNullObject( root ) ){
return JSONNull.getInstance();
}
String defaultType = getType( root... | [
"public",
"JSON",
"read",
"(",
"String",
"xml",
")",
"{",
"JSON",
"json",
"=",
"null",
";",
"try",
"{",
"Document",
"doc",
"=",
"new",
"Builder",
"(",
")",
".",
"build",
"(",
"new",
"StringReader",
"(",
"xml",
")",
")",
";",
"Element",
"root",
"=",... | Creates a JSON value from a XML string.
@param xml A well-formed xml document in a String
@return a JSONNull, JSONObject or JSONArray
@throws JSONException if the conversion from XML to JSON can't be made for
I/O or format reasons. | [
"Creates",
"a",
"JSON",
"value",
"from",
"a",
"XML",
"string",
"."
] | 9e2b3376ee8f511a48aa7ac05f75a7414e02280f | https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/xml/XMLSerializer.java#L356-L384 | train |
aalmiray/Json-lib | src/main/java/net/sf/json/xml/XMLSerializer.java | XMLSerializer.readFromStream | public JSON readFromStream( InputStream stream ) {
try{
StringBuffer xml = new StringBuffer();
BufferedReader in = new BufferedReader( new InputStreamReader( stream ) );
String line = null;
while( (line = in.readLine()) != null ){
xml.append( line );
}
... | java | public JSON readFromStream( InputStream stream ) {
try{
StringBuffer xml = new StringBuffer();
BufferedReader in = new BufferedReader( new InputStreamReader( stream ) );
String line = null;
while( (line = in.readLine()) != null ){
xml.append( line );
}
... | [
"public",
"JSON",
"readFromStream",
"(",
"InputStream",
"stream",
")",
"{",
"try",
"{",
"StringBuffer",
"xml",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"BufferedReader",
"in",
"=",
"new",
"BufferedReader",
"(",
"new",
"InputStreamReader",
"(",
"stream",
")",... | Creates a JSON value from an input stream.
@param stream
@return a JSONNull, JSONObject or JSONArray
@throws JSONException if the conversion from XML to JSON can't be made for
I/O or format reasons. | [
"Creates",
"a",
"JSON",
"value",
"from",
"an",
"input",
"stream",
"."
] | 9e2b3376ee8f511a48aa7ac05f75a7414e02280f | https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/xml/XMLSerializer.java#L433-L445 | train |
aalmiray/Json-lib | src/main/java/net/sf/json/xml/XMLSerializer.java | XMLSerializer.canAutoExpand | private boolean canAutoExpand( JSONArray array ) {
for( int i = 0; i < array.size(); i++ ){
if( !(array.get( i ) instanceof JSONObject) ){
return false;
}
}
return true;
} | java | private boolean canAutoExpand( JSONArray array ) {
for( int i = 0; i < array.size(); i++ ){
if( !(array.get( i ) instanceof JSONObject) ){
return false;
}
}
return true;
} | [
"private",
"boolean",
"canAutoExpand",
"(",
"JSONArray",
"array",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"array",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"!",
"(",
"array",
".",
"get",
"(",
"i",
")",
"i... | Only perform auto expansion if all children are objects.
@param array The array to check
@return True if all children are objects, false otherwise. | [
"Only",
"perform",
"auto",
"expansion",
"if",
"all",
"children",
"are",
"objects",
"."
] | 9e2b3376ee8f511a48aa7ac05f75a7414e02280f | https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/xml/XMLSerializer.java#L1125-L1132 | train |
aalmiray/Json-lib | src/main/java/net/sf/json/util/JSONUtils.java | JSONUtils.getFunctionBody | public static String getFunctionBody( String function ) {
return RegexpUtils.getMatcher( FUNCTION_BODY_PATTERN, true ).getGroupIfMatches( function, 1 );
} | java | public static String getFunctionBody( String function ) {
return RegexpUtils.getMatcher( FUNCTION_BODY_PATTERN, true ).getGroupIfMatches( function, 1 );
} | [
"public",
"static",
"String",
"getFunctionBody",
"(",
"String",
"function",
")",
"{",
"return",
"RegexpUtils",
".",
"getMatcher",
"(",
"FUNCTION_BODY_PATTERN",
",",
"true",
")",
".",
"getGroupIfMatches",
"(",
"function",
",",
"1",
")",
";",
"}"
] | Returns the body of a function literal. | [
"Returns",
"the",
"body",
"of",
"a",
"function",
"literal",
"."
] | 9e2b3376ee8f511a48aa7ac05f75a7414e02280f | https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/util/JSONUtils.java#L124-L126 | train |
aalmiray/Json-lib | src/main/java/net/sf/json/util/JSONUtils.java | JSONUtils.getFunctionParams | public static String getFunctionParams( String function ) {
return RegexpUtils.getMatcher( FUNCTION_PARAMS_PATTERN, true ).getGroupIfMatches( function, 1 );
} | java | public static String getFunctionParams( String function ) {
return RegexpUtils.getMatcher( FUNCTION_PARAMS_PATTERN, true ).getGroupIfMatches( function, 1 );
} | [
"public",
"static",
"String",
"getFunctionParams",
"(",
"String",
"function",
")",
"{",
"return",
"RegexpUtils",
".",
"getMatcher",
"(",
"FUNCTION_PARAMS_PATTERN",
",",
"true",
")",
".",
"getGroupIfMatches",
"(",
"function",
",",
"1",
")",
";",
"}"
] | Returns the params of a function literal. | [
"Returns",
"the",
"params",
"of",
"a",
"function",
"literal",
"."
] | 9e2b3376ee8f511a48aa7ac05f75a7414e02280f | https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/util/JSONUtils.java#L131-L133 | train |
aalmiray/Json-lib | src/main/java/net/sf/json/util/JSONUtils.java | JSONUtils.getInnerComponentType | public static Class getInnerComponentType( Class type ) {
if( !type.isArray() ){
return type;
}
return getInnerComponentType( type.getComponentType() );
} | java | public static Class getInnerComponentType( Class type ) {
if( !type.isArray() ){
return type;
}
return getInnerComponentType( type.getComponentType() );
} | [
"public",
"static",
"Class",
"getInnerComponentType",
"(",
"Class",
"type",
")",
"{",
"if",
"(",
"!",
"type",
".",
"isArray",
"(",
")",
")",
"{",
"return",
"type",
";",
"}",
"return",
"getInnerComponentType",
"(",
"type",
".",
"getComponentType",
"(",
")",... | Returns the inner-most component type of an Array. | [
"Returns",
"the",
"inner",
"-",
"most",
"component",
"type",
"of",
"an",
"Array",
"."
] | 9e2b3376ee8f511a48aa7ac05f75a7414e02280f | https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/util/JSONUtils.java#L138-L143 | train |
aalmiray/Json-lib | src/main/java/net/sf/json/util/JSONUtils.java | JSONUtils.getProperties | public static Map getProperties( JSONObject jsonObject ) {
Map properties = new HashMap();
for( Iterator keys = jsonObject.keys(); keys.hasNext(); ){
String key = (String) keys.next();
/*
* String parsedKey = key; if( !JSONUtils.isJavaIdentifier( parsedKey ) ){
* parsed... | java | public static Map getProperties( JSONObject jsonObject ) {
Map properties = new HashMap();
for( Iterator keys = jsonObject.keys(); keys.hasNext(); ){
String key = (String) keys.next();
/*
* String parsedKey = key; if( !JSONUtils.isJavaIdentifier( parsedKey ) ){
* parsed... | [
"public",
"static",
"Map",
"getProperties",
"(",
"JSONObject",
"jsonObject",
")",
"{",
"Map",
"properties",
"=",
"new",
"HashMap",
"(",
")",
";",
"for",
"(",
"Iterator",
"keys",
"=",
"jsonObject",
".",
"keys",
"(",
")",
";",
"keys",
".",
"hasNext",
"(",
... | Creates a Map with all the properties of the JSONObject. | [
"Creates",
"a",
"Map",
"with",
"all",
"the",
"properties",
"of",
"the",
"JSONObject",
"."
] | 9e2b3376ee8f511a48aa7ac05f75a7414e02280f | https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/util/JSONUtils.java#L155-L166 | train |
aalmiray/Json-lib | src/main/java/net/sf/json/util/JSONUtils.java | JSONUtils.isArray | public static boolean isArray( Class clazz ) {
return clazz != null
&& (clazz.isArray() || Collection.class.isAssignableFrom( clazz ) || (JSONArray.class.isAssignableFrom( clazz )));
} | java | public static boolean isArray( Class clazz ) {
return clazz != null
&& (clazz.isArray() || Collection.class.isAssignableFrom( clazz ) || (JSONArray.class.isAssignableFrom( clazz )));
} | [
"public",
"static",
"boolean",
"isArray",
"(",
"Class",
"clazz",
")",
"{",
"return",
"clazz",
"!=",
"null",
"&&",
"(",
"clazz",
".",
"isArray",
"(",
")",
"||",
"Collection",
".",
"class",
".",
"isAssignableFrom",
"(",
"clazz",
")",
"||",
"(",
"JSONArray"... | Tests if a Class represents an array or Collection. | [
"Tests",
"if",
"a",
"Class",
"represents",
"an",
"array",
"or",
"Collection",
"."
] | 9e2b3376ee8f511a48aa7ac05f75a7414e02280f | https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/util/JSONUtils.java#L229-L232 | train |
aalmiray/Json-lib | src/main/java/net/sf/json/util/JSONUtils.java | JSONUtils.isArray | public static boolean isArray( Object obj ) {
if( (obj != null && obj.getClass()
.isArray()) || (obj instanceof Collection) || (obj instanceof JSONArray) ){
return true;
}
return false;
} | java | public static boolean isArray( Object obj ) {
if( (obj != null && obj.getClass()
.isArray()) || (obj instanceof Collection) || (obj instanceof JSONArray) ){
return true;
}
return false;
} | [
"public",
"static",
"boolean",
"isArray",
"(",
"Object",
"obj",
")",
"{",
"if",
"(",
"(",
"obj",
"!=",
"null",
"&&",
"obj",
".",
"getClass",
"(",
")",
".",
"isArray",
"(",
")",
")",
"||",
"(",
"obj",
"instanceof",
"Collection",
")",
"||",
"(",
"obj... | Tests if obj is an array or Collection. | [
"Tests",
"if",
"obj",
"is",
"an",
"array",
"or",
"Collection",
"."
] | 9e2b3376ee8f511a48aa7ac05f75a7414e02280f | https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/util/JSONUtils.java#L237-L243 | train |
aalmiray/Json-lib | src/main/java/net/sf/json/util/JSONUtils.java | JSONUtils.isBoolean | public static boolean isBoolean( Class clazz ) {
return clazz != null
&& (Boolean.TYPE.isAssignableFrom( clazz ) || Boolean.class.isAssignableFrom( clazz ));
} | java | public static boolean isBoolean( Class clazz ) {
return clazz != null
&& (Boolean.TYPE.isAssignableFrom( clazz ) || Boolean.class.isAssignableFrom( clazz ));
} | [
"public",
"static",
"boolean",
"isBoolean",
"(",
"Class",
"clazz",
")",
"{",
"return",
"clazz",
"!=",
"null",
"&&",
"(",
"Boolean",
".",
"TYPE",
".",
"isAssignableFrom",
"(",
"clazz",
")",
"||",
"Boolean",
".",
"class",
".",
"isAssignableFrom",
"(",
"clazz... | Tests if Class represents a Boolean or primitive boolean | [
"Tests",
"if",
"Class",
"represents",
"a",
"Boolean",
"or",
"primitive",
"boolean"
] | 9e2b3376ee8f511a48aa7ac05f75a7414e02280f | https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/util/JSONUtils.java#L248-L251 | train |
aalmiray/Json-lib | src/main/java/net/sf/json/util/JSONUtils.java | JSONUtils.isBoolean | public static boolean isBoolean( Object obj ) {
if( (obj instanceof Boolean) || (obj != null && obj.getClass() == Boolean.TYPE) ){
return true;
}
return false;
} | java | public static boolean isBoolean( Object obj ) {
if( (obj instanceof Boolean) || (obj != null && obj.getClass() == Boolean.TYPE) ){
return true;
}
return false;
} | [
"public",
"static",
"boolean",
"isBoolean",
"(",
"Object",
"obj",
")",
"{",
"if",
"(",
"(",
"obj",
"instanceof",
"Boolean",
")",
"||",
"(",
"obj",
"!=",
"null",
"&&",
"obj",
".",
"getClass",
"(",
")",
"==",
"Boolean",
".",
"TYPE",
")",
")",
"{",
"r... | Tests if obj is a Boolean or primitive boolean | [
"Tests",
"if",
"obj",
"is",
"a",
"Boolean",
"or",
"primitive",
"boolean"
] | 9e2b3376ee8f511a48aa7ac05f75a7414e02280f | https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/util/JSONUtils.java#L256-L261 | train |
aalmiray/Json-lib | src/main/java/net/sf/json/util/JSONUtils.java | JSONUtils.isJavaIdentifier | public static boolean isJavaIdentifier( String str ) {
if( str.length() == 0 || !Character.isJavaIdentifierStart( str.charAt( 0 ) ) ){
return false;
}
for( int i = 1; i < str.length(); i++ ){
if( !Character.isJavaIdentifierPart( str.charAt( i ) ) ){
return false;
... | java | public static boolean isJavaIdentifier( String str ) {
if( str.length() == 0 || !Character.isJavaIdentifierStart( str.charAt( 0 ) ) ){
return false;
}
for( int i = 1; i < str.length(); i++ ){
if( !Character.isJavaIdentifierPart( str.charAt( i ) ) ){
return false;
... | [
"public",
"static",
"boolean",
"isJavaIdentifier",
"(",
"String",
"str",
")",
"{",
"if",
"(",
"str",
".",
"length",
"(",
")",
"==",
"0",
"||",
"!",
"Character",
".",
"isJavaIdentifierStart",
"(",
"str",
".",
"charAt",
"(",
"0",
")",
")",
")",
"{",
"r... | Returns trus if str represents a valid Java identifier. | [
"Returns",
"trus",
"if",
"str",
"represents",
"a",
"valid",
"Java",
"identifier",
"."
] | 9e2b3376ee8f511a48aa7ac05f75a7414e02280f | https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/util/JSONUtils.java#L302-L312 | train |
aalmiray/Json-lib | src/main/java/net/sf/json/util/JSONUtils.java | JSONUtils.isNull | public static boolean isNull( Object obj ) {
if( obj instanceof JSONObject ){
return ((JSONObject) obj).isNullObject();
}
return JSONNull.getInstance()
.equals( obj );
} | java | public static boolean isNull( Object obj ) {
if( obj instanceof JSONObject ){
return ((JSONObject) obj).isNullObject();
}
return JSONNull.getInstance()
.equals( obj );
} | [
"public",
"static",
"boolean",
"isNull",
"(",
"Object",
"obj",
")",
"{",
"if",
"(",
"obj",
"instanceof",
"JSONObject",
")",
"{",
"return",
"(",
"(",
"JSONObject",
")",
"obj",
")",
".",
"isNullObject",
"(",
")",
";",
"}",
"return",
"JSONNull",
".",
"get... | Tests if the obj is a javaScript null. | [
"Tests",
"if",
"the",
"obj",
"is",
"a",
"javaScript",
"null",
"."
] | 9e2b3376ee8f511a48aa7ac05f75a7414e02280f | https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/util/JSONUtils.java#L317-L323 | train |
aalmiray/Json-lib | src/main/java/net/sf/json/util/JSONUtils.java | JSONUtils.isObject | public static boolean isObject( Object obj ) {
return !isNumber( obj ) && !isString( obj ) && !isBoolean( obj ) && !isArray( obj )
&& !isFunction( obj ) || isNull( obj );
} | java | public static boolean isObject( Object obj ) {
return !isNumber( obj ) && !isString( obj ) && !isBoolean( obj ) && !isArray( obj )
&& !isFunction( obj ) || isNull( obj );
} | [
"public",
"static",
"boolean",
"isObject",
"(",
"Object",
"obj",
")",
"{",
"return",
"!",
"isNumber",
"(",
"obj",
")",
"&&",
"!",
"isString",
"(",
"obj",
")",
"&&",
"!",
"isBoolean",
"(",
"obj",
")",
"&&",
"!",
"isArray",
"(",
"obj",
")",
"&&",
"!"... | Tests if obj is not a boolean, number, string or array. | [
"Tests",
"if",
"obj",
"is",
"not",
"a",
"boolean",
"number",
"string",
"or",
"array",
"."
] | 9e2b3376ee8f511a48aa7ac05f75a7414e02280f | https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/util/JSONUtils.java#L354-L357 | train |
aalmiray/Json-lib | src/main/java/net/sf/json/util/JSONUtils.java | JSONUtils.isString | public static boolean isString( Class clazz ) {
return clazz != null
&& (String.class.isAssignableFrom( clazz ) || (Character.TYPE.isAssignableFrom( clazz ) || Character.class.isAssignableFrom( clazz )));
} | java | public static boolean isString( Class clazz ) {
return clazz != null
&& (String.class.isAssignableFrom( clazz ) || (Character.TYPE.isAssignableFrom( clazz ) || Character.class.isAssignableFrom( clazz )));
} | [
"public",
"static",
"boolean",
"isString",
"(",
"Class",
"clazz",
")",
"{",
"return",
"clazz",
"!=",
"null",
"&&",
"(",
"String",
".",
"class",
".",
"isAssignableFrom",
"(",
"clazz",
")",
"||",
"(",
"Character",
".",
"TYPE",
".",
"isAssignableFrom",
"(",
... | Tests if Class represents a String or a char | [
"Tests",
"if",
"Class",
"represents",
"a",
"String",
"or",
"a",
"char"
] | 9e2b3376ee8f511a48aa7ac05f75a7414e02280f | https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/util/JSONUtils.java#L362-L365 | train |
aalmiray/Json-lib | src/main/java/net/sf/json/util/JSONUtils.java | JSONUtils.isString | public static boolean isString( Object obj ) {
if( (obj instanceof String)
|| (obj instanceof Character)
|| (obj != null && (obj.getClass() == Character.TYPE || String.class.isAssignableFrom( obj.getClass() ))) ){
return true;
}
return false;
} | java | public static boolean isString( Object obj ) {
if( (obj instanceof String)
|| (obj instanceof Character)
|| (obj != null && (obj.getClass() == Character.TYPE || String.class.isAssignableFrom( obj.getClass() ))) ){
return true;
}
return false;
} | [
"public",
"static",
"boolean",
"isString",
"(",
"Object",
"obj",
")",
"{",
"if",
"(",
"(",
"obj",
"instanceof",
"String",
")",
"||",
"(",
"obj",
"instanceof",
"Character",
")",
"||",
"(",
"obj",
"!=",
"null",
"&&",
"(",
"obj",
".",
"getClass",
"(",
"... | Tests if obj is a String or a char | [
"Tests",
"if",
"obj",
"is",
"a",
"String",
"or",
"a",
"char"
] | 9e2b3376ee8f511a48aa7ac05f75a7414e02280f | https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/util/JSONUtils.java#L370-L377 | train |
aalmiray/Json-lib | src/main/java/net/sf/json/util/JSONUtils.java | JSONUtils.newDynaBean | public static DynaBean newDynaBean( JSONObject jsonObject, JsonConfig jsonConfig ) {
Map props = getProperties( jsonObject );
for( Iterator entries = props.entrySet()
.iterator(); entries.hasNext(); ){
Map.Entry entry = (Map.Entry) entries.next();
String key = (String) entry.ge... | java | public static DynaBean newDynaBean( JSONObject jsonObject, JsonConfig jsonConfig ) {
Map props = getProperties( jsonObject );
for( Iterator entries = props.entrySet()
.iterator(); entries.hasNext(); ){
Map.Entry entry = (Map.Entry) entries.next();
String key = (String) entry.ge... | [
"public",
"static",
"DynaBean",
"newDynaBean",
"(",
"JSONObject",
"jsonObject",
",",
"JsonConfig",
"jsonConfig",
")",
"{",
"Map",
"props",
"=",
"getProperties",
"(",
"jsonObject",
")",
";",
"for",
"(",
"Iterator",
"entries",
"=",
"props",
".",
"entrySet",
"(",... | Creates a new MorphDynaBean from a JSONObject. The MorphDynaBean will have
all the properties of the original JSONObject with the most accurate type.
Values of properties are not copied. | [
"Creates",
"a",
"new",
"MorphDynaBean",
"from",
"a",
"JSONObject",
".",
"The",
"MorphDynaBean",
"will",
"have",
"all",
"the",
"properties",
"of",
"the",
"original",
"JSONObject",
"with",
"the",
"most",
"accurate",
"type",
".",
"Values",
"of",
"properties",
"ar... | 9e2b3376ee8f511a48aa7ac05f75a7414e02280f | https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/util/JSONUtils.java#L408-L430 | train |
aalmiray/Json-lib | src/main/java/net/sf/json/util/JSONUtils.java | JSONUtils.quoteCanonical | public static String quoteCanonical(String s) {
if (s == null || s.length() == 0) {
return "\"\"";
}
int len = s.length();
StringBuilder sb = new StringBuilder(len + 4);
sb.append('"');
for (int i = 0; i < len; i += 1) {
char c = s.charAt(i);
... | java | public static String quoteCanonical(String s) {
if (s == null || s.length() == 0) {
return "\"\"";
}
int len = s.length();
StringBuilder sb = new StringBuilder(len + 4);
sb.append('"');
for (int i = 0; i < len; i += 1) {
char c = s.charAt(i);
... | [
"public",
"static",
"String",
"quoteCanonical",
"(",
"String",
"s",
")",
"{",
"if",
"(",
"s",
"==",
"null",
"||",
"s",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"return",
"\"\\\"\\\"\"",
";",
"}",
"int",
"len",
"=",
"s",
".",
"length",
"(",
"... | Minimal escape form. | [
"Minimal",
"escape",
"form",
"."
] | 9e2b3376ee8f511a48aa7ac05f75a7414e02280f | https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/util/JSONUtils.java#L554-L583 | train |
aalmiray/Json-lib | src/main/java/net/sf/json/util/JSONUtils.java | JSONUtils.stripQuotes | public static String stripQuotes( String input ) {
if( input.length() < 2 ){
return input;
}else if( input.startsWith( SINGLE_QUOTE ) && input.endsWith( SINGLE_QUOTE ) ){
return input.substring( 1, input.length() - 1 );
}else if( input.startsWith( DOUBLE_QUOTE ) && input.endsWith( DO... | java | public static String stripQuotes( String input ) {
if( input.length() < 2 ){
return input;
}else if( input.startsWith( SINGLE_QUOTE ) && input.endsWith( SINGLE_QUOTE ) ){
return input.substring( 1, input.length() - 1 );
}else if( input.startsWith( DOUBLE_QUOTE ) && input.endsWith( DO... | [
"public",
"static",
"String",
"stripQuotes",
"(",
"String",
"input",
")",
"{",
"if",
"(",
"input",
".",
"length",
"(",
")",
"<",
"2",
")",
"{",
"return",
"input",
";",
"}",
"else",
"if",
"(",
"input",
".",
"startsWith",
"(",
"SINGLE_QUOTE",
")",
"&&"... | Strips any single-quotes or double-quotes from both sides of the string. | [
"Strips",
"any",
"single",
"-",
"quotes",
"or",
"double",
"-",
"quotes",
"from",
"both",
"sides",
"of",
"the",
"string",
"."
] | 9e2b3376ee8f511a48aa7ac05f75a7414e02280f | https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/util/JSONUtils.java#L588-L598 | train |
aalmiray/Json-lib | src/main/java/net/sf/json/util/JSONUtils.java | JSONUtils.hasQuotes | public static boolean hasQuotes( String input ) {
if( input == null || input.length() < 2 ){
return false;
}
return input.startsWith( SINGLE_QUOTE ) && input.endsWith( SINGLE_QUOTE ) ||
input.startsWith( DOUBLE_QUOTE ) && input.endsWith( DOUBLE_QUOTE );
} | java | public static boolean hasQuotes( String input ) {
if( input == null || input.length() < 2 ){
return false;
}
return input.startsWith( SINGLE_QUOTE ) && input.endsWith( SINGLE_QUOTE ) ||
input.startsWith( DOUBLE_QUOTE ) && input.endsWith( DOUBLE_QUOTE );
} | [
"public",
"static",
"boolean",
"hasQuotes",
"(",
"String",
"input",
")",
"{",
"if",
"(",
"input",
"==",
"null",
"||",
"input",
".",
"length",
"(",
")",
"<",
"2",
")",
"{",
"return",
"false",
";",
"}",
"return",
"input",
".",
"startsWith",
"(",
"SINGL... | Returns true if the input has single-quotes or double-quotes at both sides. | [
"Returns",
"true",
"if",
"the",
"input",
"has",
"single",
"-",
"quotes",
"or",
"double",
"-",
"quotes",
"at",
"both",
"sides",
"."
] | 9e2b3376ee8f511a48aa7ac05f75a7414e02280f | https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/util/JSONUtils.java#L603-L609 | train |
aalmiray/Json-lib | src/main/java/net/sf/json/util/JSONUtils.java | JSONUtils.isDouble | private static boolean isDouble( Number n ) {
if( n instanceof Double ){
return true;
}
try{
double d = Double.parseDouble( String.valueOf( n ) );
return !Double.isInfinite( d );
}catch( NumberFormatException e ){
return false;
}
} | java | private static boolean isDouble( Number n ) {
if( n instanceof Double ){
return true;
}
try{
double d = Double.parseDouble( String.valueOf( n ) );
return !Double.isInfinite( d );
}catch( NumberFormatException e ){
return false;
}
} | [
"private",
"static",
"boolean",
"isDouble",
"(",
"Number",
"n",
")",
"{",
"if",
"(",
"n",
"instanceof",
"Double",
")",
"{",
"return",
"true",
";",
"}",
"try",
"{",
"double",
"d",
"=",
"Double",
".",
"parseDouble",
"(",
"String",
".",
"valueOf",
"(",
... | Finds out if n represents a Double.
@return true if n is instanceOf Double or the literal value can be
evaluated as a Double. | [
"Finds",
"out",
"if",
"n",
"represents",
"a",
"Double",
"."
] | 9e2b3376ee8f511a48aa7ac05f75a7414e02280f | https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/util/JSONUtils.java#L801-L811 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.