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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
atomix/copycat | server/src/main/java/io/atomix/copycat/server/state/ServerSessionContext.java | ServerSessionContext.sendEvent | private void sendEvent(EventHolder event, Connection connection) {
PublishRequest request = PublishRequest.builder()
.withSession(id())
.withEventIndex(event.eventIndex)
.withPreviousIndex(Math.max(event.previousIndex, completeIndex))
.withEvents(event.events)
.build();
LOGGER.tra... | java | private void sendEvent(EventHolder event, Connection connection) {
PublishRequest request = PublishRequest.builder()
.withSession(id())
.withEventIndex(event.eventIndex)
.withPreviousIndex(Math.max(event.previousIndex, completeIndex))
.withEvents(event.events)
.build();
LOGGER.tra... | [
"private",
"void",
"sendEvent",
"(",
"EventHolder",
"event",
",",
"Connection",
"connection",
")",
"{",
"PublishRequest",
"request",
"=",
"PublishRequest",
".",
"builder",
"(",
")",
".",
"withSession",
"(",
"id",
"(",
")",
")",
".",
"withEventIndex",
"(",
"e... | Sends an event. | [
"Sends",
"an",
"event",
"."
] | c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10 | https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/state/ServerSessionContext.java#L515-L525 | train |
atomix/copycat | server/src/main/java/io/atomix/copycat/server/state/ServerSessionContext.java | ServerSessionContext.cleanState | private void cleanState(long index) {
// If the keep alive index is set, release the entry.
if (keepAliveIndex > 0) {
log.release(keepAliveIndex);
}
context.sessions().unregisterSession(id);
// If no references to session commands are open, release session-related entries.
if (references... | java | private void cleanState(long index) {
// If the keep alive index is set, release the entry.
if (keepAliveIndex > 0) {
log.release(keepAliveIndex);
}
context.sessions().unregisterSession(id);
// If no references to session commands are open, release session-related entries.
if (references... | [
"private",
"void",
"cleanState",
"(",
"long",
"index",
")",
"{",
"// If the keep alive index is set, release the entry.",
"if",
"(",
"keepAliveIndex",
">",
"0",
")",
"{",
"log",
".",
"release",
"(",
"keepAliveIndex",
")",
";",
"}",
"context",
".",
"sessions",
"(... | Cleans session entries on close. | [
"Cleans",
"session",
"entries",
"on",
"close",
"."
] | c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10 | https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/state/ServerSessionContext.java#L578-L595 | train |
atomix/copycat | server/src/main/java/io/atomix/copycat/server/storage/system/MetaStore.java | MetaStore.storeTerm | public synchronized MetaStore storeTerm(long term) {
LOGGER.trace("Store term {}", term);
metadataBuffer.writeLong(0, term).flush();
return this;
} | java | public synchronized MetaStore storeTerm(long term) {
LOGGER.trace("Store term {}", term);
metadataBuffer.writeLong(0, term).flush();
return this;
} | [
"public",
"synchronized",
"MetaStore",
"storeTerm",
"(",
"long",
"term",
")",
"{",
"LOGGER",
".",
"trace",
"(",
"\"Store term {}\"",
",",
"term",
")",
";",
"metadataBuffer",
".",
"writeLong",
"(",
"0",
",",
"term",
")",
".",
"flush",
"(",
")",
";",
"retu... | Stores the current server term.
@param term The current server term.
@return The metastore. | [
"Stores",
"the",
"current",
"server",
"term",
"."
] | c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10 | https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/system/MetaStore.java#L131-L135 | train |
atomix/copycat | server/src/main/java/io/atomix/copycat/server/state/ServerSessionManager.java | ServerSessionManager.registerConnection | ServerSessionManager registerConnection(String client, Connection connection) {
ServerSessionContext session = clients.get(client);
if (session != null) {
session.setConnection(connection);
}
connections.put(client, connection);
return this;
} | java | ServerSessionManager registerConnection(String client, Connection connection) {
ServerSessionContext session = clients.get(client);
if (session != null) {
session.setConnection(connection);
}
connections.put(client, connection);
return this;
} | [
"ServerSessionManager",
"registerConnection",
"(",
"String",
"client",
",",
"Connection",
"connection",
")",
"{",
"ServerSessionContext",
"session",
"=",
"clients",
".",
"get",
"(",
"client",
")",
";",
"if",
"(",
"session",
"!=",
"null",
")",
"{",
"session",
"... | Registers a connection. | [
"Registers",
"a",
"connection",
"."
] | c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10 | https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/state/ServerSessionManager.java#L66-L73 | train |
atomix/copycat | server/src/main/java/io/atomix/copycat/server/state/ServerSessionManager.java | ServerSessionManager.unregisterConnection | ServerSessionManager unregisterConnection(Connection connection) {
Iterator<Map.Entry<String, Connection>> iterator = connections.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<String, Connection> entry = iterator.next();
if (entry.getValue().equals(connection)) {
ServerSessio... | java | ServerSessionManager unregisterConnection(Connection connection) {
Iterator<Map.Entry<String, Connection>> iterator = connections.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<String, Connection> entry = iterator.next();
if (entry.getValue().equals(connection)) {
ServerSessio... | [
"ServerSessionManager",
"unregisterConnection",
"(",
"Connection",
"connection",
")",
"{",
"Iterator",
"<",
"Map",
".",
"Entry",
"<",
"String",
",",
"Connection",
">",
">",
"iterator",
"=",
"connections",
".",
"entrySet",
"(",
")",
".",
"iterator",
"(",
")",
... | Unregisters a connection. | [
"Unregisters",
"a",
"connection",
"."
] | c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10 | https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/state/ServerSessionManager.java#L78-L91 | train |
atomix/copycat | server/src/main/java/io/atomix/copycat/server/state/ServerSessionManager.java | ServerSessionManager.unregisterSession | ServerSessionContext unregisterSession(long sessionId) {
ServerSessionContext session = sessions.remove(sessionId);
if (session != null) {
clients.remove(session.client(), session);
connections.remove(session.client(), session.getConnection());
}
return session;
} | java | ServerSessionContext unregisterSession(long sessionId) {
ServerSessionContext session = sessions.remove(sessionId);
if (session != null) {
clients.remove(session.client(), session);
connections.remove(session.client(), session.getConnection());
}
return session;
} | [
"ServerSessionContext",
"unregisterSession",
"(",
"long",
"sessionId",
")",
"{",
"ServerSessionContext",
"session",
"=",
"sessions",
".",
"remove",
"(",
"sessionId",
")",
";",
"if",
"(",
"session",
"!=",
"null",
")",
"{",
"clients",
".",
"remove",
"(",
"sessio... | Unregisters a session. | [
"Unregisters",
"a",
"session",
"."
] | c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10 | https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/state/ServerSessionManager.java#L110-L117 | train |
atomix/copycat | server/src/main/java/io/atomix/copycat/server/state/LeaderAppender.java | LeaderAppender.updateHeartbeatTime | private void updateHeartbeatTime(MemberState member, Throwable error) {
if (heartbeatFuture == null) {
return;
}
if (error != null && member.getHeartbeatStartTime() == heartbeatTime) {
int votingMemberSize = context.getClusterState().getActiveMemberStates().size() + (context.getCluster().member... | java | private void updateHeartbeatTime(MemberState member, Throwable error) {
if (heartbeatFuture == null) {
return;
}
if (error != null && member.getHeartbeatStartTime() == heartbeatTime) {
int votingMemberSize = context.getClusterState().getActiveMemberStates().size() + (context.getCluster().member... | [
"private",
"void",
"updateHeartbeatTime",
"(",
"MemberState",
"member",
",",
"Throwable",
"error",
")",
"{",
"if",
"(",
"heartbeatFuture",
"==",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"error",
"!=",
"null",
"&&",
"member",
".",
"getHeartbeatStartTi... | Sets a commit time or fails the commit if a quorum of successful responses cannot be achieved. | [
"Sets",
"a",
"commit",
"time",
"or",
"fails",
"the",
"commit",
"if",
"a",
"quorum",
"of",
"successful",
"responses",
"cannot",
"be",
"achieved",
"."
] | c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10 | https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/state/LeaderAppender.java#L243-L269 | train |
atomix/copycat | server/src/main/java/io/atomix/copycat/server/state/LeaderAppender.java | LeaderAppender.updateGlobalIndex | private void updateGlobalIndex() {
context.checkThread();
// The global index may have increased even if the commit index didn't. Update the global index.
// The global index is calculated by the minimum matchIndex for *all* servers in the cluster, including
// passive members. This is critical since p... | java | private void updateGlobalIndex() {
context.checkThread();
// The global index may have increased even if the commit index didn't. Update the global index.
// The global index is calculated by the minimum matchIndex for *all* servers in the cluster, including
// passive members. This is critical since p... | [
"private",
"void",
"updateGlobalIndex",
"(",
")",
"{",
"context",
".",
"checkThread",
"(",
")",
";",
"// The global index may have increased even if the commit index didn't. Update the global index.",
"// The global index is calculated by the minimum matchIndex for *all* servers in the clu... | Updates the global index. | [
"Updates",
"the",
"global",
"index",
"."
] | c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10 | https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/state/LeaderAppender.java#L291-L306 | train |
atomix/copycat | server/src/main/java/io/atomix/copycat/server/storage/SegmentManager.java | SegmentManager.replaceSegments | public synchronized void replaceSegments(Collection<Segment> segments, Segment segment) {
// Update the segment descriptor and lock the segment.
segment.descriptor().update(System.currentTimeMillis());
segment.descriptor().lock();
// Iterate through old segments and remove them from the segments list.
... | java | public synchronized void replaceSegments(Collection<Segment> segments, Segment segment) {
// Update the segment descriptor and lock the segment.
segment.descriptor().update(System.currentTimeMillis());
segment.descriptor().lock();
// Iterate through old segments and remove them from the segments list.
... | [
"public",
"synchronized",
"void",
"replaceSegments",
"(",
"Collection",
"<",
"Segment",
">",
"segments",
",",
"Segment",
"segment",
")",
"{",
"// Update the segment descriptor and lock the segment.",
"segment",
".",
"descriptor",
"(",
")",
".",
"update",
"(",
"System"... | Inserts a segment.
@param segment The segment to insert.
@throws IllegalStateException if the segment is unknown | [
"Inserts",
"a",
"segment",
"."
] | c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10 | https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/SegmentManager.java#L264-L281 | train |
atomix/copycat | server/src/main/java/io/atomix/copycat/server/storage/SegmentManager.java | SegmentManager.createIndex | private OffsetIndex createIndex(SegmentDescriptor descriptor) {
return new DelegatingOffsetIndex(HeapBuffer.allocate(Math.min(DEFAULT_BUFFER_SIZE, descriptor.maxEntries()), OffsetIndex.size(descriptor.maxEntries())));
} | java | private OffsetIndex createIndex(SegmentDescriptor descriptor) {
return new DelegatingOffsetIndex(HeapBuffer.allocate(Math.min(DEFAULT_BUFFER_SIZE, descriptor.maxEntries()), OffsetIndex.size(descriptor.maxEntries())));
} | [
"private",
"OffsetIndex",
"createIndex",
"(",
"SegmentDescriptor",
"descriptor",
")",
"{",
"return",
"new",
"DelegatingOffsetIndex",
"(",
"HeapBuffer",
".",
"allocate",
"(",
"Math",
".",
"min",
"(",
"DEFAULT_BUFFER_SIZE",
",",
"descriptor",
".",
"maxEntries",
"(",
... | Creates an in memory segment index. | [
"Creates",
"an",
"in",
"memory",
"segment",
"index",
"."
] | c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10 | https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/SegmentManager.java#L406-L408 | train |
atomix/copycat | server/src/main/java/io/atomix/copycat/server/storage/Log.java | Log.currentSegment | private Segment currentSegment() {
Segment segment = segments.currentSegment();
if (segment.isFull()) {
segments.currentSegment().flush();
segment = segments.nextSegment();
}
return segment;
} | java | private Segment currentSegment() {
Segment segment = segments.currentSegment();
if (segment.isFull()) {
segments.currentSegment().flush();
segment = segments.nextSegment();
}
return segment;
} | [
"private",
"Segment",
"currentSegment",
"(",
")",
"{",
"Segment",
"segment",
"=",
"segments",
".",
"currentSegment",
"(",
")",
";",
"if",
"(",
"segment",
".",
"isFull",
"(",
")",
")",
"{",
"segments",
".",
"currentSegment",
"(",
")",
".",
"flush",
"(",
... | Checks whether we need to roll over to a new segment. | [
"Checks",
"whether",
"we",
"need",
"to",
"roll",
"over",
"to",
"a",
"new",
"segment",
"."
] | c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10 | https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/Log.java#L253-L260 | train |
atomix/copycat | server/src/main/java/io/atomix/copycat/server/storage/Log.java | Log.append | public long append(Entry entry) {
Assert.notNull(entry, "entry");
assertIsOpen();
// Append the entry to the appropriate segment.
long index = currentSegment().append(entry);
entryBuffer.append(entry);
return index;
} | java | public long append(Entry entry) {
Assert.notNull(entry, "entry");
assertIsOpen();
// Append the entry to the appropriate segment.
long index = currentSegment().append(entry);
entryBuffer.append(entry);
return index;
} | [
"public",
"long",
"append",
"(",
"Entry",
"entry",
")",
"{",
"Assert",
".",
"notNull",
"(",
"entry",
",",
"\"entry\"",
")",
";",
"assertIsOpen",
"(",
")",
";",
"// Append the entry to the appropriate segment.",
"long",
"index",
"=",
"currentSegment",
"(",
")",
... | Appends an entry to the log.
@param entry The entry to append.
@return The appended entry index.
@throws IllegalStateException If the log is not open
@throws NullPointerException If {@code entry} is {@code null}
@throws IndexOutOfBoundsException If the entry's index does not match the expected next log index. | [
"Appends",
"an",
"entry",
"to",
"the",
"log",
"."
] | c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10 | https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/Log.java#L289-L297 | train |
atomix/copycat | server/src/main/java/io/atomix/copycat/server/storage/Log.java | Log.contains | public boolean contains(long index) {
if (!validIndex(index))
return false;
Segment segment = segments.segment(index);
return segment != null && segment.contains(index);
} | java | public boolean contains(long index) {
if (!validIndex(index))
return false;
Segment segment = segments.segment(index);
return segment != null && segment.contains(index);
} | [
"public",
"boolean",
"contains",
"(",
"long",
"index",
")",
"{",
"if",
"(",
"!",
"validIndex",
"(",
"index",
")",
")",
"return",
"false",
";",
"Segment",
"segment",
"=",
"segments",
".",
"segment",
"(",
"index",
")",
";",
"return",
"segment",
"!=",
"nu... | Returns a boolean value indicating whether the log contains a live entry at the given index.
@param index The index to check.
@return Indicates whether the log contains a live entry at the given index.
@throws IllegalStateException If the log is not open. | [
"Returns",
"a",
"boolean",
"value",
"indicating",
"whether",
"the",
"log",
"contains",
"a",
"live",
"entry",
"at",
"the",
"given",
"index",
"."
] | c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10 | https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/Log.java#L427-L433 | train |
atomix/copycat | server/src/main/java/io/atomix/copycat/server/storage/Log.java | Log.release | public Log release(long index) {
assertIsOpen();
assertValidIndex(index);
Segment segment = segments.segment(index);
Assert.index(segment != null, "invalid index: " + index);
segment.release(index);
return this;
} | java | public Log release(long index) {
assertIsOpen();
assertValidIndex(index);
Segment segment = segments.segment(index);
Assert.index(segment != null, "invalid index: " + index);
segment.release(index);
return this;
} | [
"public",
"Log",
"release",
"(",
"long",
"index",
")",
"{",
"assertIsOpen",
"(",
")",
";",
"assertValidIndex",
"(",
"index",
")",
";",
"Segment",
"segment",
"=",
"segments",
".",
"segment",
"(",
"index",
")",
";",
"Assert",
".",
"index",
"(",
"segment",
... | Releases the entry at the given index.
@param index The index of the entry to release.
@return The log.
@throws IllegalStateException If the log is not open.
@throws IndexOutOfBoundsException If the given index is not within the bounds of the log. | [
"Releases",
"the",
"entry",
"at",
"the",
"given",
"index",
"."
] | c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10 | https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/Log.java#L443-L451 | train |
atomix/copycat | server/src/main/java/io/atomix/copycat/server/storage/Log.java | Log.commit | public Log commit(long index) {
assertIsOpen();
if (index > 0) {
assertValidIndex(index);
segments.commitIndex(index);
if (storage.flushOnCommit()) {
segments.currentSegment().flush();
}
}
return this;
} | java | public Log commit(long index) {
assertIsOpen();
if (index > 0) {
assertValidIndex(index);
segments.commitIndex(index);
if (storage.flushOnCommit()) {
segments.currentSegment().flush();
}
}
return this;
} | [
"public",
"Log",
"commit",
"(",
"long",
"index",
")",
"{",
"assertIsOpen",
"(",
")",
";",
"if",
"(",
"index",
">",
"0",
")",
"{",
"assertValidIndex",
"(",
"index",
")",
";",
"segments",
".",
"commitIndex",
"(",
"index",
")",
";",
"if",
"(",
"storage"... | Commits entries up to the given index to the log.
@param index The index up to which to commit entries.
@return The log.
@throws IllegalStateException If the log is not open. | [
"Commits",
"entries",
"up",
"to",
"the",
"given",
"index",
"to",
"the",
"log",
"."
] | c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10 | https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/Log.java#L460-L470 | train |
atomix/copycat | server/src/main/java/io/atomix/copycat/server/storage/Log.java | Log.truncate | public Log truncate(long index) {
assertIsOpen();
if (index > 0)
assertValidIndex(index);
Assert.index(index >= segments.commitIndex(), "cannot truncate committed entries");
if (lastIndex() == index)
return this;
for (Segment segment : segments.reverseSegments()) {
if (segment.va... | java | public Log truncate(long index) {
assertIsOpen();
if (index > 0)
assertValidIndex(index);
Assert.index(index >= segments.commitIndex(), "cannot truncate committed entries");
if (lastIndex() == index)
return this;
for (Segment segment : segments.reverseSegments()) {
if (segment.va... | [
"public",
"Log",
"truncate",
"(",
"long",
"index",
")",
"{",
"assertIsOpen",
"(",
")",
";",
"if",
"(",
"index",
">",
"0",
")",
"assertValidIndex",
"(",
"index",
")",
";",
"Assert",
".",
"index",
"(",
"index",
">=",
"segments",
".",
"commitIndex",
"(",
... | Truncates the log up to the given index.
@param index The index at which to truncate the log.
@return The updated log.
@throws IllegalStateException If the log is not open.
@throws IndexOutOfBoundsException If the given index is not within the bounds of the log. | [
"Truncates",
"the",
"log",
"up",
"to",
"the",
"given",
"index",
"."
] | c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10 | https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/Log.java#L511-L530 | train |
atomix/copycat | server/src/main/java/io/atomix/copycat/server/storage/Log.java | Log.close | @Override
public void close() {
assertIsOpen();
flush();
compactor.close();
segments.close();
open = false;
} | java | @Override
public void close() {
assertIsOpen();
flush();
compactor.close();
segments.close();
open = false;
} | [
"@",
"Override",
"public",
"void",
"close",
"(",
")",
"{",
"assertIsOpen",
"(",
")",
";",
"flush",
"(",
")",
";",
"compactor",
".",
"close",
"(",
")",
";",
"segments",
".",
"close",
"(",
")",
";",
"open",
"=",
"false",
";",
"}"
] | Closes the log.
@throws IllegalStateException If the log is not open. | [
"Closes",
"the",
"log",
"."
] | c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10 | https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/Log.java#L547-L554 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/BasicCacheEntry.java | BasicCacheEntry.checkFixity | @Override
public Collection<FixityResult> checkFixity(final String algorithm) {
try (FixityInputStream fixityInputStream = new FixityInputStream(
this.getInputStream(), MessageDigest.getInstance(algorithm))) {
// actually calculate the digest by consuming the stream
... | java | @Override
public Collection<FixityResult> checkFixity(final String algorithm) {
try (FixityInputStream fixityInputStream = new FixityInputStream(
this.getInputStream(), MessageDigest.getInstance(algorithm))) {
// actually calculate the digest by consuming the stream
... | [
"@",
"Override",
"public",
"Collection",
"<",
"FixityResult",
">",
"checkFixity",
"(",
"final",
"String",
"algorithm",
")",
"{",
"try",
"(",
"FixityInputStream",
"fixityInputStream",
"=",
"new",
"FixityInputStream",
"(",
"this",
".",
"getInputStream",
"(",
")",
... | Calculate the fixity of a CacheEntry by piping it through
a simple fixity-calculating InputStream
@param algorithm the digest algorithm to be used
@return the fixity of this cache entry | [
"Calculate",
"the",
"fixity",
"of",
"a",
"CacheEntry",
"by",
"piping",
"it",
"through",
"a",
"simple",
"fixity",
"-",
"calculating",
"InputStream"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/BasicCacheEntry.java#L63-L88 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/BasicCacheEntry.java | BasicCacheEntry.checkFixity | @Override
public Collection<URI> checkFixity(final Collection<String> algorithms) throws UnsupportedAlgorithmException {
try (InputStream binaryStream = this.getInputStream()) {
final Map<String, DigestInputStream> digestInputStreams = new HashMap<>();
InputStream digestStream = bi... | java | @Override
public Collection<URI> checkFixity(final Collection<String> algorithms) throws UnsupportedAlgorithmException {
try (InputStream binaryStream = this.getInputStream()) {
final Map<String, DigestInputStream> digestInputStreams = new HashMap<>();
InputStream digestStream = bi... | [
"@",
"Override",
"public",
"Collection",
"<",
"URI",
">",
"checkFixity",
"(",
"final",
"Collection",
"<",
"String",
">",
"algorithms",
")",
"throws",
"UnsupportedAlgorithmException",
"{",
"try",
"(",
"InputStream",
"binaryStream",
"=",
"this",
".",
"getInputStream... | Calculate fixity with list of digest algorithms of a CacheEntry by piping it through
a simple fixity-calculating InputStream
@param algorithms the digest algorithms to be used
@return the checksums for the digest algorithms
@throws UnsupportedAlgorithmException exception | [
"Calculate",
"fixity",
"with",
"list",
"of",
"digest",
"algorithms",
"of",
"a",
"CacheEntry",
"by",
"piping",
"it",
"through",
"a",
"simple",
"fixity",
"-",
"calculating",
"InputStream"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/BasicCacheEntry.java#L98-L125 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/JcrPropertyStatementListener.java | JcrPropertyStatementListener.addedStatement | @Override
public void addedStatement(final Statement input) {
if (Operation.ADD == statements.get(input)) {
return;
}
try {
final Resource subject = input.getSubject();
validateSubject(subject);
LOGGER.debug(">> adding statement {}", input);
... | java | @Override
public void addedStatement(final Statement input) {
if (Operation.ADD == statements.get(input)) {
return;
}
try {
final Resource subject = input.getSubject();
validateSubject(subject);
LOGGER.debug(">> adding statement {}", input);
... | [
"@",
"Override",
"public",
"void",
"addedStatement",
"(",
"final",
"Statement",
"input",
")",
"{",
"if",
"(",
"Operation",
".",
"ADD",
"==",
"statements",
".",
"get",
"(",
"input",
")",
")",
"{",
"return",
";",
"}",
"try",
"{",
"final",
"Resource",
"su... | When a statement is added to the graph, serialize it to a JCR property
@param input the input statement | [
"When",
"a",
"statement",
"is",
"added",
"to",
"the",
"graph",
"serialize",
"it",
"to",
"a",
"JCR",
"property"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/JcrPropertyStatementListener.java#L115-L152 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/JcrPropertyStatementListener.java | JcrPropertyStatementListener.removedStatement | @Override
public void removedStatement(final Statement s) {
if (Operation.REMOVE == statements.get(s)) {
return;
}
try {
// if it's not about the right kind of node, ignore it.
final Resource subject = s.getSubject();
validateSubject(subject);
... | java | @Override
public void removedStatement(final Statement s) {
if (Operation.REMOVE == statements.get(s)) {
return;
}
try {
// if it's not about the right kind of node, ignore it.
final Resource subject = s.getSubject();
validateSubject(subject);
... | [
"@",
"Override",
"public",
"void",
"removedStatement",
"(",
"final",
"Statement",
"s",
")",
"{",
"if",
"(",
"Operation",
".",
"REMOVE",
"==",
"statements",
".",
"get",
"(",
"s",
")",
")",
"{",
"return",
";",
"}",
"try",
"{",
"// if it's not about the right... | When a statement is removed, remove it from the JCR properties
@param s the given statement | [
"When",
"a",
"statement",
"is",
"removed",
"remove",
"it",
"from",
"the",
"JCR",
"properties"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/JcrPropertyStatementListener.java#L159-L194 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/JcrPropertyStatementListener.java | JcrPropertyStatementListener.validateSubject | private void validateSubject(final Resource subject) {
final String subjectURI = subject.getURI();
// blank nodes are okay
if (!subject.isAnon()) {
// hash URIs with the same base as the topic are okay
final int hashIndex = subjectURI.lastIndexOf("#");
if (!(h... | java | private void validateSubject(final Resource subject) {
final String subjectURI = subject.getURI();
// blank nodes are okay
if (!subject.isAnon()) {
// hash URIs with the same base as the topic are okay
final int hashIndex = subjectURI.lastIndexOf("#");
if (!(h... | [
"private",
"void",
"validateSubject",
"(",
"final",
"Resource",
"subject",
")",
"{",
"final",
"String",
"subjectURI",
"=",
"subject",
".",
"getURI",
"(",
")",
";",
"// blank nodes are okay",
"if",
"(",
"!",
"subject",
".",
"isAnon",
"(",
")",
")",
"{",
"//... | If it's not the right kind of node, throw an appropriate unchecked exception.
@param subject to validate | [
"If",
"it",
"s",
"not",
"the",
"right",
"kind",
"of",
"node",
"throw",
"an",
"appropriate",
"unchecked",
"exception",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/JcrPropertyStatementListener.java#L201-L222 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/JcrPropertyStatementListener.java | JcrPropertyStatementListener.assertNoExceptions | public void assertNoExceptions() {
if (!exceptions.isEmpty()) {
throw new MalformedRdfException(exceptions.stream().map(Exception::getMessage).collect(joining("\n")));
}
} | java | public void assertNoExceptions() {
if (!exceptions.isEmpty()) {
throw new MalformedRdfException(exceptions.stream().map(Exception::getMessage).collect(joining("\n")));
}
} | [
"public",
"void",
"assertNoExceptions",
"(",
")",
"{",
"if",
"(",
"!",
"exceptions",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"MalformedRdfException",
"(",
"exceptions",
".",
"stream",
"(",
")",
".",
"map",
"(",
"Exception",
"::",
"getMessage",
... | Assert that no exceptions were thrown while this listener was processing change | [
"Assert",
"that",
"no",
"exceptions",
"were",
"thrown",
"while",
"this",
"listener",
"was",
"processing",
"change"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/JcrPropertyStatementListener.java#L227-L231 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/AbstractFedoraBinary.java | AbstractFedoraBinary.delete | @Override
public void delete() {
final FedoraResource description = getDescription();
if (description != null) {
description.delete();
}
super.delete();
} | java | @Override
public void delete() {
final FedoraResource description = getDescription();
if (description != null) {
description.delete();
}
super.delete();
} | [
"@",
"Override",
"public",
"void",
"delete",
"(",
")",
"{",
"final",
"FedoraResource",
"description",
"=",
"getDescription",
"(",
")",
";",
"if",
"(",
"description",
"!=",
"null",
")",
"{",
"description",
".",
"delete",
"(",
")",
";",
"}",
"super",
".",
... | When deleting the binary, we also need to clean up the description document. | [
"When",
"deleting",
"the",
"binary",
"we",
"also",
"need",
"to",
"clean",
"up",
"the",
"description",
"document",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/AbstractFedoraBinary.java#L282-L291 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/AbstractFedoraBinary.java | AbstractFedoraBinary.hasDescriptionProperty | protected boolean hasDescriptionProperty(final String relPath) {
try {
final Node descNode = getDescriptionNodeOrNull();
if (descNode == null) {
return false;
}
return descNode.hasProperty(relPath);
} catch (final RepositoryException e) {
... | java | protected boolean hasDescriptionProperty(final String relPath) {
try {
final Node descNode = getDescriptionNodeOrNull();
if (descNode == null) {
return false;
}
return descNode.hasProperty(relPath);
} catch (final RepositoryException e) {
... | [
"protected",
"boolean",
"hasDescriptionProperty",
"(",
"final",
"String",
"relPath",
")",
"{",
"try",
"{",
"final",
"Node",
"descNode",
"=",
"getDescriptionNodeOrNull",
"(",
")",
";",
"if",
"(",
"descNode",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}"... | Check of the property exists on the description of this binary.
@param relPath - path to the property
@return true if property exists. | [
"Check",
"of",
"the",
"property",
"exists",
"on",
"the",
"description",
"of",
"this",
"binary",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/AbstractFedoraBinary.java#L299-L310 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/AbstractFedoraBinary.java | AbstractFedoraBinary.getDescriptionProperty | private Property getDescriptionProperty(final String relPath) {
try {
return getDescriptionNode().getProperty(relPath);
} catch (final RepositoryException e) {
throw new RepositoryRuntimeException(e);
}
} | java | private Property getDescriptionProperty(final String relPath) {
try {
return getDescriptionNode().getProperty(relPath);
} catch (final RepositoryException e) {
throw new RepositoryRuntimeException(e);
}
} | [
"private",
"Property",
"getDescriptionProperty",
"(",
"final",
"String",
"relPath",
")",
"{",
"try",
"{",
"return",
"getDescriptionNode",
"(",
")",
".",
"getProperty",
"(",
"relPath",
")",
";",
"}",
"catch",
"(",
"final",
"RepositoryException",
"e",
")",
"{",
... | Return the description property for this binary.
@param relPath - path to the property
@return Property object | [
"Return",
"the",
"description",
"property",
"for",
"this",
"binary",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/AbstractFedoraBinary.java#L318-L324 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/AbstractFedoraBinary.java | AbstractFedoraBinary.setContentSize | protected void setContentSize(final long size) {
try {
getDescriptionNode().setProperty(CONTENT_SIZE, size);
} catch (final RepositoryException e) {
throw new RepositoryRuntimeException(e);
}
} | java | protected void setContentSize(final long size) {
try {
getDescriptionNode().setProperty(CONTENT_SIZE, size);
} catch (final RepositoryException e) {
throw new RepositoryRuntimeException(e);
}
} | [
"protected",
"void",
"setContentSize",
"(",
"final",
"long",
"size",
")",
"{",
"try",
"{",
"getDescriptionNode",
"(",
")",
".",
"setProperty",
"(",
"CONTENT_SIZE",
",",
"size",
")",
";",
"}",
"catch",
"(",
"final",
"RepositoryException",
"e",
")",
"{",
"th... | Set the content size
@param size the new value of the content size. | [
"Set",
"the",
"content",
"size"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/AbstractFedoraBinary.java#L331-L337 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/FedoraSessionUserUtil.java | FedoraSessionUserUtil.getUserURI | public static URI getUserURI(final String sessionUserId) {
// user id could be in format <anonymous>, remove < at the beginning and the > at the end in this case.
final String userId = (sessionUserId == null ? "anonymous" : sessionUserId).replaceAll("^<|>$", "");
try {
final URI uri ... | java | public static URI getUserURI(final String sessionUserId) {
// user id could be in format <anonymous>, remove < at the beginning and the > at the end in this case.
final String userId = (sessionUserId == null ? "anonymous" : sessionUserId).replaceAll("^<|>$", "");
try {
final URI uri ... | [
"public",
"static",
"URI",
"getUserURI",
"(",
"final",
"String",
"sessionUserId",
")",
"{",
"// user id could be in format <anonymous>, remove < at the beginning and the > at the end in this case.",
"final",
"String",
"userId",
"=",
"(",
"sessionUserId",
"==",
"null",
"?",
"\... | Returns the user agent based on the session user id.
@param sessionUserId the acting user's id for this session
@return the uri of the user agent | [
"Returns",
"the",
"user",
"agent",
"based",
"on",
"the",
"session",
"user",
"id",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/FedoraSessionUserUtil.java#L50-L64 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/FedoraSessionUserUtil.java | FedoraSessionUserUtil.buildDefaultURI | private static URI buildDefaultURI(final String userId) {
// Construct the default URI for the user ID that is not a URI.
String userAgentBaseUri = System.getProperty(USER_AGENT_BASE_URI_PROPERTY);
if (isNullOrEmpty(userAgentBaseUri)) {
// use the default local user agent base uri
... | java | private static URI buildDefaultURI(final String userId) {
// Construct the default URI for the user ID that is not a URI.
String userAgentBaseUri = System.getProperty(USER_AGENT_BASE_URI_PROPERTY);
if (isNullOrEmpty(userAgentBaseUri)) {
// use the default local user agent base uri
... | [
"private",
"static",
"URI",
"buildDefaultURI",
"(",
"final",
"String",
"userId",
")",
"{",
"// Construct the default URI for the user ID that is not a URI.",
"String",
"userAgentBaseUri",
"=",
"System",
".",
"getProperty",
"(",
"USER_AGENT_BASE_URI_PROPERTY",
")",
";",
"if"... | Build default URI with the configured base uri for agent
@param userId of which a URI will be created
@return URI | [
"Build",
"default",
"URI",
"with",
"the",
"configured",
"base",
"uri",
"for",
"agent"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/FedoraSessionUserUtil.java#L71-L83 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/rdf/JcrRdfTools.java | JcrRdfTools.getJcrNamespaceForRDFNamespace | public static String getJcrNamespaceForRDFNamespace(
final String rdfNamespaceUri) {
if (rdfNamespacesToJcrNamespaces.containsKey(rdfNamespaceUri)) {
return rdfNamespacesToJcrNamespaces.get(rdfNamespaceUri);
}
return rdfNamespaceUri;
} | java | public static String getJcrNamespaceForRDFNamespace(
final String rdfNamespaceUri) {
if (rdfNamespacesToJcrNamespaces.containsKey(rdfNamespaceUri)) {
return rdfNamespacesToJcrNamespaces.get(rdfNamespaceUri);
}
return rdfNamespaceUri;
} | [
"public",
"static",
"String",
"getJcrNamespaceForRDFNamespace",
"(",
"final",
"String",
"rdfNamespaceUri",
")",
"{",
"if",
"(",
"rdfNamespacesToJcrNamespaces",
".",
"containsKey",
"(",
"rdfNamespaceUri",
")",
")",
"{",
"return",
"rdfNamespacesToJcrNamespaces",
".",
"get... | Convert a Fedora RDF Namespace into its JCR equivalent
@param rdfNamespaceUri a namespace from an RDF document
@return the JCR namespace, or the RDF namespace if no matching JCR
namespace is found | [
"Convert",
"a",
"Fedora",
"RDF",
"Namespace",
"into",
"its",
"JCR",
"equivalent"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/rdf/JcrRdfTools.java#L143-L149 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/rdf/JcrRdfTools.java | JcrRdfTools.getRDFNamespaceForJcrNamespace | public static String getRDFNamespaceForJcrNamespace(
final String jcrNamespaceUri) {
if (jcrNamespacesToRDFNamespaces.containsKey(jcrNamespaceUri)) {
return jcrNamespacesToRDFNamespaces.get(jcrNamespaceUri);
}
return jcrNamespaceUri;
} | java | public static String getRDFNamespaceForJcrNamespace(
final String jcrNamespaceUri) {
if (jcrNamespacesToRDFNamespaces.containsKey(jcrNamespaceUri)) {
return jcrNamespacesToRDFNamespaces.get(jcrNamespaceUri);
}
return jcrNamespaceUri;
} | [
"public",
"static",
"String",
"getRDFNamespaceForJcrNamespace",
"(",
"final",
"String",
"jcrNamespaceUri",
")",
"{",
"if",
"(",
"jcrNamespacesToRDFNamespaces",
".",
"containsKey",
"(",
"jcrNamespaceUri",
")",
")",
"{",
"return",
"jcrNamespacesToRDFNamespaces",
".",
"get... | Convert a JCR namespace into an RDF namespace fit for downstream
consumption.
@param jcrNamespaceUri a namespace from the JCR NamespaceRegistry
@return an RDF namespace for downstream consumption. | [
"Convert",
"a",
"JCR",
"namespace",
"into",
"an",
"RDF",
"namespace",
"fit",
"for",
"downstream",
"consumption",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/rdf/JcrRdfTools.java#L158-L164 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/rdf/JcrRdfTools.java | JcrRdfTools.createValue | public Value createValue(final Node node,
final RDFNode data,
final String propertyName) throws RepositoryException {
final ValueFactory valueFactory = node.getSession().getValueFactory();
return createValue(valueFactory, data, getPropertyType(no... | java | public Value createValue(final Node node,
final RDFNode data,
final String propertyName) throws RepositoryException {
final ValueFactory valueFactory = node.getSession().getValueFactory();
return createValue(valueFactory, data, getPropertyType(no... | [
"public",
"Value",
"createValue",
"(",
"final",
"Node",
"node",
",",
"final",
"RDFNode",
"data",
",",
"final",
"String",
"propertyName",
")",
"throws",
"RepositoryException",
"{",
"final",
"ValueFactory",
"valueFactory",
"=",
"node",
".",
"getSession",
"(",
")",... | Create a JCR value from an RDFNode for a given JCR property
@param node the JCR node we want a property for
@param data an RDF Node (possibly with a DataType)
@param propertyName name of the property to populate (used to use the right type for the value)
@return the JCR value from an RDFNode for a given JCR property
@t... | [
"Create",
"a",
"JCR",
"value",
"from",
"an",
"RDFNode",
"for",
"a",
"given",
"JCR",
"property"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/rdf/JcrRdfTools.java#L174-L179 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/rdf/JcrRdfTools.java | JcrRdfTools.createValue | public Value createValue(final ValueFactory valueFactory, final RDFNode data, final int type)
throws RepositoryException {
assert (valueFactory != null);
if (type == UNDEFINED || type == STRING) {
return valueConverter.reverse().convert(data);
} else if (type == REFERENCE |... | java | public Value createValue(final ValueFactory valueFactory, final RDFNode data, final int type)
throws RepositoryException {
assert (valueFactory != null);
if (type == UNDEFINED || type == STRING) {
return valueConverter.reverse().convert(data);
} else if (type == REFERENCE |... | [
"public",
"Value",
"createValue",
"(",
"final",
"ValueFactory",
"valueFactory",
",",
"final",
"RDFNode",
"data",
",",
"final",
"int",
"type",
")",
"throws",
"RepositoryException",
"{",
"assert",
"(",
"valueFactory",
"!=",
"null",
")",
";",
"if",
"(",
"type",
... | Create a JCR value from an RDF node with the given JCR type
@param valueFactory the given value factory
@param data the rdf node data
@param type the given JCR type
@return created value
@throws RepositoryException if repository exception occurred | [
"Create",
"a",
"JCR",
"value",
"from",
"an",
"RDF",
"node",
"with",
"the",
"given",
"JCR",
"type"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/rdf/JcrRdfTools.java#L189-L227 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/rdf/JcrRdfTools.java | JcrRdfTools.addMixin | public void addMixin(final FedoraResource resource,
final Resource mixinResource,
final Map<String,String> namespaces)
throws RepositoryException {
final Node node = getJcrNode(resource);
final Session session = node.getSession();
fi... | java | public void addMixin(final FedoraResource resource,
final Resource mixinResource,
final Map<String,String> namespaces)
throws RepositoryException {
final Node node = getJcrNode(resource);
final Session session = node.getSession();
fi... | [
"public",
"void",
"addMixin",
"(",
"final",
"FedoraResource",
"resource",
",",
"final",
"Resource",
"mixinResource",
",",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"namespaces",
")",
"throws",
"RepositoryException",
"{",
"final",
"Node",
"node",
"=",
... | Add a mixin to a node
@param resource the fedora resource
@param mixinResource the mixin resource
@param namespaces the namespace
@throws RepositoryException if repository exception occurred | [
"Add",
"a",
"mixin",
"to",
"a",
"node"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/rdf/JcrRdfTools.java#L236-L267 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/rdf/JcrRdfTools.java | JcrRdfTools.removeMixin | public void removeMixin(final FedoraResource resource,
final Resource mixinResource,
final Map<String, String> nsPrefixMap) throws RepositoryException {
final Node node = getJcrNode(resource);
final String mixinName = getPropertyNameFromPredicate(... | java | public void removeMixin(final FedoraResource resource,
final Resource mixinResource,
final Map<String, String> nsPrefixMap) throws RepositoryException {
final Node node = getJcrNode(resource);
final String mixinName = getPropertyNameFromPredicate(... | [
"public",
"void",
"removeMixin",
"(",
"final",
"FedoraResource",
"resource",
",",
"final",
"Resource",
"mixinResource",
",",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"nsPrefixMap",
")",
"throws",
"RepositoryException",
"{",
"final",
"Node",
"node",
"="... | Remove a mixin from a node
@param resource the resource
@param mixinResource the mixin resource
@param nsPrefixMap the prefix map
@throws RepositoryException if repository exception occurred | [
"Remove",
"a",
"mixin",
"from",
"a",
"node"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/rdf/JcrRdfTools.java#L348-L358 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/rdf/JcrRdfTools.java | JcrRdfTools.removeProperty | public void removeProperty(final FedoraResource resource,
final org.apache.jena.rdf.model.Property predicate,
final RDFNode objectNode,
final Map<String, String> nsPrefixMap) throws RepositoryException {
final Node nod... | java | public void removeProperty(final FedoraResource resource,
final org.apache.jena.rdf.model.Property predicate,
final RDFNode objectNode,
final Map<String, String> nsPrefixMap) throws RepositoryException {
final Node nod... | [
"public",
"void",
"removeProperty",
"(",
"final",
"FedoraResource",
"resource",
",",
"final",
"org",
".",
"apache",
".",
"jena",
".",
"rdf",
".",
"model",
".",
"Property",
"predicate",
",",
"final",
"RDFNode",
"objectNode",
",",
"final",
"Map",
"<",
"String"... | Remove a property from a node
@param resource the fedora resource
@param predicate the predicate
@param objectNode the object node
@param nsPrefixMap the prefix map
@throws RepositoryException if repository exception occurred | [
"Remove",
"a",
"property",
"from",
"a",
"node"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/rdf/JcrRdfTools.java#L368-L395 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/rdf/JcrRdfTools.java | JcrRdfTools.skolemize | public Statement skolemize(final IdentifierConverter<Resource, FedoraResource> idTranslator, final Statement t,
final String topic) throws RepositoryException {
Statement skolemized = t;
if (t.getSubject().isAnon()) {
skolemized = m.createStatement(getSkolemizedResource(idTrans... | java | public Statement skolemize(final IdentifierConverter<Resource, FedoraResource> idTranslator, final Statement t,
final String topic) throws RepositoryException {
Statement skolemized = t;
if (t.getSubject().isAnon()) {
skolemized = m.createStatement(getSkolemizedResource(idTrans... | [
"public",
"Statement",
"skolemize",
"(",
"final",
"IdentifierConverter",
"<",
"Resource",
",",
"FedoraResource",
">",
"idTranslator",
",",
"final",
"Statement",
"t",
",",
"final",
"String",
"topic",
")",
"throws",
"RepositoryException",
"{",
"Statement",
"skolemized... | Convert an external statement into a persistable statement by skolemizing
blank nodes, creating hash-uri subjects, etc
@param idTranslator the property of idTranslator
@param t the statement
@param topic the topic
@return the persistable statement
@throws RepositoryException if repository exception occurred | [
"Convert",
"an",
"external",
"statement",
"into",
"a",
"persistable",
"statement",
"by",
"skolemizing",
"blank",
"nodes",
"creating",
"hash",
"-",
"uri",
"subjects",
"etc"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/rdf/JcrRdfTools.java#L407-L430 | train |
fcrepo4/fcrepo4 | fcrepo-event-serialization/src/main/java/org/fcrepo/event/serialization/JsonLDEventMessage.java | JsonLDEventMessage.from | public static JsonLDEventMessage from(final FedoraEvent evt) {
final String baseUrl = evt.getInfo().get(BASE_URL);
// build objectId
final String objectId = convertToExternalPath(baseUrl + evt.getPath());
// build event types list
final List<String> types = evt.getTypes()
... | java | public static JsonLDEventMessage from(final FedoraEvent evt) {
final String baseUrl = evt.getInfo().get(BASE_URL);
// build objectId
final String objectId = convertToExternalPath(baseUrl + evt.getPath());
// build event types list
final List<String> types = evt.getTypes()
... | [
"public",
"static",
"JsonLDEventMessage",
"from",
"(",
"final",
"FedoraEvent",
"evt",
")",
"{",
"final",
"String",
"baseUrl",
"=",
"evt",
".",
"getInfo",
"(",
")",
".",
"get",
"(",
"BASE_URL",
")",
";",
"// build objectId",
"final",
"String",
"objectId",
"="... | Populate a JsonLDEventMessage from a FedoraEvent
@param evt The Fedora event
@return a JsonLDEventMessage | [
"Populate",
"a",
"JsonLDEventMessage",
"from",
"a",
"FedoraEvent"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-event-serialization/src/main/java/org/fcrepo/event/serialization/JsonLDEventMessage.java#L165-L205 | train |
fcrepo4/fcrepo4 | fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/domain/Range.java | Range.convert | public static Range convert(final String source) {
final Matcher matcher = rangePattern.matcher(source);
if (!matcher.matches()) {
return new Range();
}
final String from = matcher.group(1);
final String to = matcher.group(2);
final long start;
if... | java | public static Range convert(final String source) {
final Matcher matcher = rangePattern.matcher(source);
if (!matcher.matches()) {
return new Range();
}
final String from = matcher.group(1);
final String to = matcher.group(2);
final long start;
if... | [
"public",
"static",
"Range",
"convert",
"(",
"final",
"String",
"source",
")",
"{",
"final",
"Matcher",
"matcher",
"=",
"rangePattern",
".",
"matcher",
"(",
"source",
")",
";",
"if",
"(",
"!",
"matcher",
".",
"matches",
"(",
")",
")",
"{",
"return",
"n... | Convert an HTTP Range header to a Range object
@param source the source
@return range object | [
"Convert",
"an",
"HTTP",
"Range",
"header",
"to",
"a",
"Range",
"object"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/domain/Range.java#L105-L132 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/FedoraRepositoryImpl.java | FedoraRepositoryImpl.getJcrRepository | public static Repository getJcrRepository(final FedoraRepository repository) {
if (repository instanceof FedoraRepositoryImpl) {
return ((FedoraRepositoryImpl)repository).getJcrRepository();
}
throw new ClassCastException("FedoraRepository is not a " + FedoraRepositoryImpl.class.getC... | java | public static Repository getJcrRepository(final FedoraRepository repository) {
if (repository instanceof FedoraRepositoryImpl) {
return ((FedoraRepositoryImpl)repository).getJcrRepository();
}
throw new ClassCastException("FedoraRepository is not a " + FedoraRepositoryImpl.class.getC... | [
"public",
"static",
"Repository",
"getJcrRepository",
"(",
"final",
"FedoraRepository",
"repository",
")",
"{",
"if",
"(",
"repository",
"instanceof",
"FedoraRepositoryImpl",
")",
"{",
"return",
"(",
"(",
"FedoraRepositoryImpl",
")",
"repository",
")",
".",
"getJcrR... | Retrieve the internal JCR Repository from a FedoraRepository object
@param repository the FedoraRepository
@return the JCR Repository | [
"Retrieve",
"the",
"internal",
"JCR",
"Repository",
"from",
"a",
"FedoraRepository",
"object"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/FedoraRepositoryImpl.java#L82-L87 | train |
fcrepo4/fcrepo4 | fcrepo-http-api/src/main/java/org/fcrepo/http/api/ExternalContentHandler.java | ExternalContentHandler.fetchExternalContent | public InputStream fetchExternalContent() {
final URI uri = link.getUri();
final String scheme = uri.getScheme();
LOGGER.debug("scheme is {}", scheme);
if (scheme != null) {
try {
if (scheme.equals("file")) {
return new FileInputStream(uri... | java | public InputStream fetchExternalContent() {
final URI uri = link.getUri();
final String scheme = uri.getScheme();
LOGGER.debug("scheme is {}", scheme);
if (scheme != null) {
try {
if (scheme.equals("file")) {
return new FileInputStream(uri... | [
"public",
"InputStream",
"fetchExternalContent",
"(",
")",
"{",
"final",
"URI",
"uri",
"=",
"link",
".",
"getUri",
"(",
")",
";",
"final",
"String",
"scheme",
"=",
"uri",
".",
"getScheme",
"(",
")",
";",
"LOGGER",
".",
"debug",
"(",
"\"scheme is {}\"",
"... | Fetch the external content
@return InputStream containing the external content | [
"Fetch",
"the",
"external",
"content"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-api/src/main/java/org/fcrepo/http/api/ExternalContentHandler.java#L140-L157 | train |
fcrepo4/fcrepo4 | fcrepo-http-api/src/main/java/org/fcrepo/http/api/ExternalContentHandler.java | ExternalContentHandler.parseLinkHeader | private Link parseLinkHeader(final String link) throws ExternalMessageBodyException {
final Link realLink = Link.valueOf(link);
try {
final String handling = realLink.getParams().get(HANDLING);
if (handling == null || !handling.matches("(?i)" + PROXY + "|" + COPY + "|" + REDIREC... | java | private Link parseLinkHeader(final String link) throws ExternalMessageBodyException {
final Link realLink = Link.valueOf(link);
try {
final String handling = realLink.getParams().get(HANDLING);
if (handling == null || !handling.matches("(?i)" + PROXY + "|" + COPY + "|" + REDIREC... | [
"private",
"Link",
"parseLinkHeader",
"(",
"final",
"String",
"link",
")",
"throws",
"ExternalMessageBodyException",
"{",
"final",
"Link",
"realLink",
"=",
"Link",
".",
"valueOf",
"(",
"link",
")",
";",
"try",
"{",
"final",
"String",
"handling",
"=",
"realLink... | Validate that an external content link header is appropriately formatted
@param link to be validated
@return Link object if the header is formatted correctly, else null
@throws ExternalMessageBodyException on error | [
"Validate",
"that",
"an",
"external",
"content",
"link",
"header",
"is",
"appropriately",
"formatted"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-api/src/main/java/org/fcrepo/http/api/ExternalContentHandler.java#L165-L179 | train |
fcrepo4/fcrepo4 | fcrepo-http-api/src/main/java/org/fcrepo/http/api/ExternalContentHandler.java | ExternalContentHandler.findContentType | private MediaType findContentType(final String url) {
if (url == null) {
return null;
}
if (url.startsWith("file")) {
return APPLICATION_OCTET_STREAM_TYPE;
} else if (url.startsWith("http")) {
try (CloseableHttpClient httpClient = HttpClients.createDe... | java | private MediaType findContentType(final String url) {
if (url == null) {
return null;
}
if (url.startsWith("file")) {
return APPLICATION_OCTET_STREAM_TYPE;
} else if (url.startsWith("http")) {
try (CloseableHttpClient httpClient = HttpClients.createDe... | [
"private",
"MediaType",
"findContentType",
"(",
"final",
"String",
"url",
")",
"{",
"if",
"(",
"url",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"url",
".",
"startsWith",
"(",
"\"file\"",
")",
")",
"{",
"return",
"APPLICATION_OCTET_ST... | Find the content type for a remote resource
@param url of remote resource
@return the content type reported by remote system or "application/octet-stream" if not supplied | [
"Find",
"the",
"content",
"type",
"for",
"a",
"remote",
"resource"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-api/src/main/java/org/fcrepo/http/api/ExternalContentHandler.java#L186-L212 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/NodePropertiesTools.java | NodePropertiesTools.addReferencePlaceholders | public void addReferencePlaceholders(final IdentifierConverter<Resource,FedoraResource> idTranslator,
final Node node,
final String propertyName,
final Resource resource) throws RepositoryExcept... | java | public void addReferencePlaceholders(final IdentifierConverter<Resource,FedoraResource> idTranslator,
final Node node,
final String propertyName,
final Resource resource) throws RepositoryExcept... | [
"public",
"void",
"addReferencePlaceholders",
"(",
"final",
"IdentifierConverter",
"<",
"Resource",
",",
"FedoraResource",
">",
"idTranslator",
",",
"final",
"Node",
"node",
",",
"final",
"String",
"propertyName",
",",
"final",
"Resource",
"resource",
")",
"throws",... | Add a reference placeholder from one node to another in-domain resource
@param idTranslator the id translator
@param node the node
@param propertyName the property name
@param resource the resource
@throws RepositoryException if repository exception occurred | [
"Add",
"a",
"reference",
"placeholder",
"from",
"one",
"node",
"to",
"another",
"in",
"-",
"domain",
"resource"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/NodePropertiesTools.java#L141-L172 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/NodePropertiesTools.java | NodePropertiesTools.removeReferencePlaceholders | public void removeReferencePlaceholders(final IdentifierConverter<Resource,FedoraResource> idTranslator,
final Node node,
final String propertyName,
final Resource resource) throws Repo... | java | public void removeReferencePlaceholders(final IdentifierConverter<Resource,FedoraResource> idTranslator,
final Node node,
final String propertyName,
final Resource resource) throws Repo... | [
"public",
"void",
"removeReferencePlaceholders",
"(",
"final",
"IdentifierConverter",
"<",
"Resource",
",",
"FedoraResource",
">",
"idTranslator",
",",
"final",
"Node",
"node",
",",
"final",
"String",
"propertyName",
",",
"final",
"Resource",
"resource",
")",
"throw... | Remove a reference placeholder that links one node to another in-domain resource
@param idTranslator the id translator
@param node the node
@param propertyName the property name
@param resource the resource
@throws RepositoryException if repository exception occurred | [
"Remove",
"a",
"reference",
"placeholder",
"that",
"links",
"one",
"node",
"to",
"another",
"in",
"-",
"domain",
"resource"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/NodePropertiesTools.java#L182-L192 | train |
fcrepo4/fcrepo4 | fcrepo-http-api/src/main/java/org/fcrepo/http/api/ExternalContentHandlerFactory.java | ExternalContentHandlerFactory.createFromLinks | public ExternalContentHandler createFromLinks(final List<String> links) throws ExternalMessageBodyException {
if (links == null) {
return null;
}
final List<String> externalContentLinks = links.stream()
.filter(x -> x.contains(EXTERNAL_CONTENT.toString()))
... | java | public ExternalContentHandler createFromLinks(final List<String> links) throws ExternalMessageBodyException {
if (links == null) {
return null;
}
final List<String> externalContentLinks = links.stream()
.filter(x -> x.contains(EXTERNAL_CONTENT.toString()))
... | [
"public",
"ExternalContentHandler",
"createFromLinks",
"(",
"final",
"List",
"<",
"String",
">",
"links",
")",
"throws",
"ExternalMessageBodyException",
"{",
"if",
"(",
"links",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"final",
"List",
"<",
"String"... | Looks for ExternalContent link header and if it finds one it will return a new ExternalContentHandler object
based on the found Link header. If multiple external content headers were found or the URI provided in the
header is not a valid external content path, then an ExternalMessageBodyException will be thrown.
@para... | [
"Looks",
"for",
"ExternalContent",
"link",
"header",
"and",
"if",
"it",
"finds",
"one",
"it",
"will",
"return",
"a",
"new",
"ExternalContentHandler",
"object",
"based",
"on",
"the",
"found",
"Link",
"header",
".",
"If",
"multiple",
"external",
"content",
"head... | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-api/src/main/java/org/fcrepo/http/api/ExternalContentHandlerFactory.java#L50-L77 | train |
fcrepo4/fcrepo4 | fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/api/rdf/HttpResourceConverter.java | HttpResourceConverter.doBackwardPathOnly | private String doBackwardPathOnly(final FedoraResource resource) {
final String path = reverse.convert(resource.getPath());
if (path == null) {
throw new RepositoryRuntimeException("Unable to process reverse chain for resource " + resource);
}
return convertToExternalPath(p... | java | private String doBackwardPathOnly(final FedoraResource resource) {
final String path = reverse.convert(resource.getPath());
if (path == null) {
throw new RepositoryRuntimeException("Unable to process reverse chain for resource " + resource);
}
return convertToExternalPath(p... | [
"private",
"String",
"doBackwardPathOnly",
"(",
"final",
"FedoraResource",
"resource",
")",
"{",
"final",
"String",
"path",
"=",
"reverse",
".",
"convert",
"(",
"resource",
".",
"getPath",
"(",
")",
")",
";",
"if",
"(",
"path",
"==",
"null",
")",
"{",
"t... | Get only the resource path to this resource, before embedding it in a full URI
@param resource with desired path
@return path | [
"Get",
"only",
"the",
"resource",
"path",
"to",
"this",
"resource",
"before",
"embedding",
"it",
"in",
"a",
"full",
"URI"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/api/rdf/HttpResourceConverter.java#L285-L293 | train |
fcrepo4/fcrepo4 | fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/api/rdf/HttpResourceConverter.java | HttpResourceConverter.convertToExternalPath | public static String convertToExternalPath(final String path) {
String newPath = replaceOnce(path, "/" + CONTAINER_WEBAC_ACL, "/" + FCR_ACL);
newPath = replaceOnce(newPath, "/" + LDPCV_TIME_MAP, "/" + FCR_VERSIONS);
newPath = replaceOnce(newPath, "/" + FEDORA_DESCRIPTION, "/" + FCR_METADATA);... | java | public static String convertToExternalPath(final String path) {
String newPath = replaceOnce(path, "/" + CONTAINER_WEBAC_ACL, "/" + FCR_ACL);
newPath = replaceOnce(newPath, "/" + LDPCV_TIME_MAP, "/" + FCR_VERSIONS);
newPath = replaceOnce(newPath, "/" + FEDORA_DESCRIPTION, "/" + FCR_METADATA);... | [
"public",
"static",
"String",
"convertToExternalPath",
"(",
"final",
"String",
"path",
")",
"{",
"String",
"newPath",
"=",
"replaceOnce",
"(",
"path",
",",
"\"/\"",
"+",
"CONTAINER_WEBAC_ACL",
",",
"\"/\"",
"+",
"FCR_ACL",
")",
";",
"newPath",
"=",
"replaceOnc... | Converts internal path segments to their external formats.
@param path the internal path
@return the external path | [
"Converts",
"internal",
"path",
"segments",
"to",
"their",
"external",
"formats",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/api/rdf/HttpResourceConverter.java#L300-L308 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/observer/SimpleObserver.java | SimpleObserver.buildListener | @PostConstruct
public void buildListener() throws RepositoryException {
LOGGER.debug("Constructing an observer for JCR events...");
session = getJcrSession(repository.login());
session.getWorkspace().getObservationManager()
.addEventListener(this, EVENT_TYPES, "/", true, null... | java | @PostConstruct
public void buildListener() throws RepositoryException {
LOGGER.debug("Constructing an observer for JCR events...");
session = getJcrSession(repository.login());
session.getWorkspace().getObservationManager()
.addEventListener(this, EVENT_TYPES, "/", true, null... | [
"@",
"PostConstruct",
"public",
"void",
"buildListener",
"(",
")",
"throws",
"RepositoryException",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Constructing an observer for JCR events...\"",
")",
";",
"session",
"=",
"getJcrSession",
"(",
"repository",
".",
"login",
"(",
"... | Register this observer with the JCR event listeners
@throws RepositoryException if repository exception occurred | [
"Register",
"this",
"observer",
"with",
"the",
"JCR",
"event",
"listeners"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/observer/SimpleObserver.java#L183-L190 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/observer/SimpleObserver.java | SimpleObserver.stopListening | @PreDestroy
public void stopListening() throws RepositoryException {
try {
LOGGER.debug("Destroying an observer for JCR events...");
session.getWorkspace().getObservationManager().removeEventListener(this);
} finally {
session.logout();
}
} | java | @PreDestroy
public void stopListening() throws RepositoryException {
try {
LOGGER.debug("Destroying an observer for JCR events...");
session.getWorkspace().getObservationManager().removeEventListener(this);
} finally {
session.logout();
}
} | [
"@",
"PreDestroy",
"public",
"void",
"stopListening",
"(",
")",
"throws",
"RepositoryException",
"{",
"try",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Destroying an observer for JCR events...\"",
")",
";",
"session",
".",
"getWorkspace",
"(",
")",
".",
"getObservationMan... | logout of the session
@throws RepositoryException if repository exception occurred | [
"logout",
"of",
"the",
"session"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/observer/SimpleObserver.java#L197-L205 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/observer/SimpleObserver.java | SimpleObserver.onEvent | @Override
public void onEvent(final javax.jcr.observation.EventIterator events) {
Session lookupSession = null;
try {
lookupSession = getJcrSession(repository.login());
@SuppressWarnings("unchecked")
final Iterator<Event> filteredEvents = filter(events, eventFilt... | java | @Override
public void onEvent(final javax.jcr.observation.EventIterator events) {
Session lookupSession = null;
try {
lookupSession = getJcrSession(repository.login());
@SuppressWarnings("unchecked")
final Iterator<Event> filteredEvents = filter(events, eventFilt... | [
"@",
"Override",
"public",
"void",
"onEvent",
"(",
"final",
"javax",
".",
"jcr",
".",
"observation",
".",
"EventIterator",
"events",
")",
"{",
"Session",
"lookupSession",
"=",
"null",
";",
"try",
"{",
"lookupSession",
"=",
"getJcrSession",
"(",
"repository",
... | Filter JCR events and transform them into our own FedoraEvents.
@param events the JCR events | [
"Filter",
"JCR",
"events",
"and",
"transform",
"them",
"into",
"our",
"own",
"FedoraEvents",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/observer/SimpleObserver.java#L212-L229 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/services/BatchServiceImpl.java | BatchServiceImpl.removeExpired | @Override
@Scheduled(fixedRate = REAP_INTERVAL)
public void removeExpired() {
final Set<String> reapable = sessions.entrySet().stream()
.filter(e -> e.getValue().getExpires().isPresent())
.filter(e -> e.getValue().getExpires().get().isBefore(now()))
.map(M... | java | @Override
@Scheduled(fixedRate = REAP_INTERVAL)
public void removeExpired() {
final Set<String> reapable = sessions.entrySet().stream()
.filter(e -> e.getValue().getExpires().isPresent())
.filter(e -> e.getValue().getExpires().get().isBefore(now()))
.map(M... | [
"@",
"Override",
"@",
"Scheduled",
"(",
"fixedRate",
"=",
"REAP_INTERVAL",
")",
"public",
"void",
"removeExpired",
"(",
")",
"{",
"final",
"Set",
"<",
"String",
">",
"reapable",
"=",
"sessions",
".",
"entrySet",
"(",
")",
".",
"stream",
"(",
")",
".",
... | Every REAP_INTERVAL milliseconds, check for expired sessions. If the
tx is expired, roll it back and remove it from the registry. | [
"Every",
"REAP_INTERVAL",
"milliseconds",
"check",
"for",
"expired",
"sessions",
".",
"If",
"the",
"tx",
"is",
"expired",
"roll",
"it",
"back",
"and",
"remove",
"it",
"from",
"the",
"registry",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/services/BatchServiceImpl.java#L70-L88 | train |
fcrepo4/fcrepo4 | fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/api/HttpHeaderInjector.java | HttpHeaderInjector.addHttpHeaderToResponseStream | public void addHttpHeaderToResponseStream(final HttpServletResponse servletResponse,
final UriInfo uriInfo,
final FedoraResource resource) {
getUriAwareHttpHeaderFactories().forEach((bean, factory) -> {
LOGG... | java | public void addHttpHeaderToResponseStream(final HttpServletResponse servletResponse,
final UriInfo uriInfo,
final FedoraResource resource) {
getUriAwareHttpHeaderFactories().forEach((bean, factory) -> {
LOGG... | [
"public",
"void",
"addHttpHeaderToResponseStream",
"(",
"final",
"HttpServletResponse",
"servletResponse",
",",
"final",
"UriInfo",
"uriInfo",
",",
"final",
"FedoraResource",
"resource",
")",
"{",
"getUriAwareHttpHeaderFactories",
"(",
")",
".",
"forEach",
"(",
"(",
"... | Add additional Http Headers
@param servletResponse the response
@param uriInfo the URI context
@param resource the resource | [
"Add",
"additional",
"Http",
"Headers"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/api/HttpHeaderInjector.java#L66-L78 | train |
fcrepo4/fcrepo4 | fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/AbstractResource.java | AbstractResource.toPath | public static String toPath(final IdentifierConverter<Resource, FedoraResource> idTranslator,
final String originalPath) {
final Resource resource = idTranslator.toDomain(originalPath);
final String path = idTranslator.asString(resource);
return path.isEmpty() ... | java | public static String toPath(final IdentifierConverter<Resource, FedoraResource> idTranslator,
final String originalPath) {
final Resource resource = idTranslator.toDomain(originalPath);
final String path = idTranslator.asString(resource);
return path.isEmpty() ... | [
"public",
"static",
"String",
"toPath",
"(",
"final",
"IdentifierConverter",
"<",
"Resource",
",",
"FedoraResource",
">",
"idTranslator",
",",
"final",
"String",
"originalPath",
")",
"{",
"final",
"Resource",
"resource",
"=",
"idTranslator",
".",
"toDomain",
"(",
... | Convert a JAX-RS list of PathSegments to a JCR path
@param idTranslator the id translator
@param originalPath the original path
@return String jcr path | [
"Convert",
"a",
"JAX",
"-",
"RS",
"list",
"of",
"PathSegments",
"to",
"a",
"JCR",
"path"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/AbstractResource.java#L108-L116 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/impl/CacheEntryFactory.java | CacheEntryFactory.forProperty | public static CacheEntry forProperty(final Property property) throws RepositoryException {
// if it's an external binary, catch that here and treat it differently.
if (property.getName().endsWith(PROXY_FOR.getLocalName()) ||
property.getName().endsWith(REDIRECTS_TO.getLocalName())) {
... | java | public static CacheEntry forProperty(final Property property) throws RepositoryException {
// if it's an external binary, catch that here and treat it differently.
if (property.getName().endsWith(PROXY_FOR.getLocalName()) ||
property.getName().endsWith(REDIRECTS_TO.getLocalName())) {
... | [
"public",
"static",
"CacheEntry",
"forProperty",
"(",
"final",
"Property",
"property",
")",
"throws",
"RepositoryException",
"{",
"// if it's an external binary, catch that here and treat it differently.",
"if",
"(",
"property",
".",
"getName",
"(",
")",
".",
"endsWith",
... | Load a store-specific CacheEntry model
@param property the property
@return CacheEntry model for the property in the given repository
@throws RepositoryException if repository exception occurred | [
"Load",
"a",
"store",
"-",
"specific",
"CacheEntry",
"model"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/impl/CacheEntryFactory.java#L55-L70 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/services/VersionServiceImpl.java | VersionServiceImpl.remapResourceUris | private RdfStream remapResourceUris(final String resourceUri,
final String mementoUri,
final RdfStream rdfStream,
final IdentifierConverter<Resource, FedoraResource> idTranslator,
final Session jcrSession) {
final IdentifierConverter<Resource, FedoraResource> inte... | java | private RdfStream remapResourceUris(final String resourceUri,
final String mementoUri,
final RdfStream rdfStream,
final IdentifierConverter<Resource, FedoraResource> idTranslator,
final Session jcrSession) {
final IdentifierConverter<Resource, FedoraResource> inte... | [
"private",
"RdfStream",
"remapResourceUris",
"(",
"final",
"String",
"resourceUri",
",",
"final",
"String",
"mementoUri",
",",
"final",
"RdfStream",
"rdfStream",
",",
"final",
"IdentifierConverter",
"<",
"Resource",
",",
"FedoraResource",
">",
"idTranslator",
",",
"... | Remaps the subjects of triples in rdfStream from the original resource URL to the URL of the new memento, and
converts objects which reference resources to an internal identifier to prevent enforcement of referential
integrity constraints.
@param resourceUri uri of the original resource
@param mementoUri uri of the me... | [
"Remaps",
"the",
"subjects",
"of",
"triples",
"in",
"rdfStream",
"from",
"the",
"original",
"resource",
"URL",
"to",
"the",
"URL",
"of",
"the",
"new",
"memento",
"and",
"converts",
"objects",
"which",
"reference",
"resources",
"to",
"an",
"internal",
"identifi... | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/services/VersionServiceImpl.java#L213-L225 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/services/VersionServiceImpl.java | VersionServiceImpl.convertToInternalReference | private Triple convertToInternalReference(final Triple t,
final IdentifierConverter<Resource, FedoraResource> idTranslator,
final IdentifierConverter<Resource, FedoraResource> internalIdTranslator) {
if (t.getObject().isURI()) {
final Resource object = createResource(t.getObj... | java | private Triple convertToInternalReference(final Triple t,
final IdentifierConverter<Resource, FedoraResource> idTranslator,
final IdentifierConverter<Resource, FedoraResource> internalIdTranslator) {
if (t.getObject().isURI()) {
final Resource object = createResource(t.getObj... | [
"private",
"Triple",
"convertToInternalReference",
"(",
"final",
"Triple",
"t",
",",
"final",
"IdentifierConverter",
"<",
"Resource",
",",
"FedoraResource",
">",
"idTranslator",
",",
"final",
"IdentifierConverter",
"<",
"Resource",
",",
"FedoraResource",
">",
"interna... | Convert the referencing resource uri to un-dereferenceable internal identifier.
@param t the Triple to convert
@param idTranslator the Converter that convert the resource uri to a path
@param internalIdTranslator the Converter that convert a path to internal identifier
@return Triple a triple with referencing resource... | [
"Convert",
"the",
"referencing",
"resource",
"uri",
"to",
"un",
"-",
"dereferenceable",
"internal",
"identifier",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/services/VersionServiceImpl.java#L235-L251 | train |
fcrepo4/fcrepo4 | fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/session/SessionFactory.java | SessionFactory.getSession | public HttpSession getSession(final HttpServletRequest servletRequest) {
final HttpSession session;
final String txId = getEmbeddedId(servletRequest, Prefix.TX);
try {
if (txId == null) {
session = createSession(servletRequest);
} else {
s... | java | public HttpSession getSession(final HttpServletRequest servletRequest) {
final HttpSession session;
final String txId = getEmbeddedId(servletRequest, Prefix.TX);
try {
if (txId == null) {
session = createSession(servletRequest);
} else {
s... | [
"public",
"HttpSession",
"getSession",
"(",
"final",
"HttpServletRequest",
"servletRequest",
")",
"{",
"final",
"HttpSession",
"session",
";",
"final",
"String",
"txId",
"=",
"getEmbeddedId",
"(",
"servletRequest",
",",
"Prefix",
".",
"TX",
")",
";",
"try",
"{",... | Get a JCR session for the given HTTP servlet request with a
SecurityContext attached
@param servletRequest the servlet request
@return the Session
@throws RuntimeException if the transaction could not be found | [
"Get",
"a",
"JCR",
"session",
"for",
"the",
"given",
"HTTP",
"servlet",
"request",
"with",
"a",
"SecurityContext",
"attached"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/session/SessionFactory.java#L108-L124 | train |
fcrepo4/fcrepo4 | fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/session/SessionFactory.java | SessionFactory.createSession | protected HttpSession createSession(final HttpServletRequest servletRequest) {
LOGGER.debug("Returning an authenticated session in the default workspace");
return new HttpSession(repo.login(credentialsService.getCredentials(servletRequest)));
} | java | protected HttpSession createSession(final HttpServletRequest servletRequest) {
LOGGER.debug("Returning an authenticated session in the default workspace");
return new HttpSession(repo.login(credentialsService.getCredentials(servletRequest)));
} | [
"protected",
"HttpSession",
"createSession",
"(",
"final",
"HttpServletRequest",
"servletRequest",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Returning an authenticated session in the default workspace\"",
")",
";",
"return",
"new",
"HttpSession",
"(",
"repo",
".",
"login"... | Create a JCR session for the given HTTP servlet request with a
SecurityContext attached.
@param servletRequest the servlet request
@return a newly created JCR session | [
"Create",
"a",
"JCR",
"session",
"for",
"the",
"given",
"HTTP",
"servlet",
"request",
"with",
"a",
"SecurityContext",
"attached",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/session/SessionFactory.java#L133-L137 | train |
fcrepo4/fcrepo4 | fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/session/SessionFactory.java | SessionFactory.getSessionFromTransaction | protected HttpSession getSessionFromTransaction(final HttpServletRequest servletRequest, final String txId) {
final Principal userPrincipal = servletRequest.getUserPrincipal();
final String userName = userPrincipal == null ? null : userPrincipal.getName();
final FedoraSession session = batchSe... | java | protected HttpSession getSessionFromTransaction(final HttpServletRequest servletRequest, final String txId) {
final Principal userPrincipal = servletRequest.getUserPrincipal();
final String userName = userPrincipal == null ? null : userPrincipal.getName();
final FedoraSession session = batchSe... | [
"protected",
"HttpSession",
"getSessionFromTransaction",
"(",
"final",
"HttpServletRequest",
"servletRequest",
",",
"final",
"String",
"txId",
")",
"{",
"final",
"Principal",
"userPrincipal",
"=",
"servletRequest",
".",
"getUserPrincipal",
"(",
")",
";",
"final",
"Str... | Retrieve a JCR session from an active transaction
@param servletRequest the servlet request
@param txId the transaction id
@return a JCR session that is associated with the transaction | [
"Retrieve",
"a",
"JCR",
"session",
"from",
"an",
"active",
"transaction"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/session/SessionFactory.java#L146-L156 | train |
fcrepo4/fcrepo4 | fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/session/SessionFactory.java | SessionFactory.getEmbeddedId | protected String getEmbeddedId(
final HttpServletRequest servletRequest, final Prefix prefix) {
String requestPath = servletRequest.getPathInfo();
// http://stackoverflow.com/questions/18963562/grizzlys-request-getpathinfo-returns-always-null
if (requestPath == null && servletReques... | java | protected String getEmbeddedId(
final HttpServletRequest servletRequest, final Prefix prefix) {
String requestPath = servletRequest.getPathInfo();
// http://stackoverflow.com/questions/18963562/grizzlys-request-getpathinfo-returns-always-null
if (requestPath == null && servletReques... | [
"protected",
"String",
"getEmbeddedId",
"(",
"final",
"HttpServletRequest",
"servletRequest",
",",
"final",
"Prefix",
"prefix",
")",
"{",
"String",
"requestPath",
"=",
"servletRequest",
".",
"getPathInfo",
"(",
")",
";",
"// http://stackoverflow.com/questions/18963562/gri... | Extract the id embedded at the beginning of a request path
@param servletRequest the servlet request
@param prefix the prefix for the id
@return the found id or null | [
"Extract",
"the",
"id",
"embedded",
"at",
"the",
"beginning",
"of",
"a",
"request",
"path"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/session/SessionFactory.java#L165-L183 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-api/src/main/java/org/fcrepo/kernel/api/utils/GraphDifferencer.java | GraphDifferencer.common | public Stream<Triple> common() {
return stream(spliteratorUnknownSize(common.find(ANY, ANY, ANY), IMMUTABLE), false);
} | java | public Stream<Triple> common() {
return stream(spliteratorUnknownSize(common.find(ANY, ANY, ANY), IMMUTABLE), false);
} | [
"public",
"Stream",
"<",
"Triple",
">",
"common",
"(",
")",
"{",
"return",
"stream",
"(",
"spliteratorUnknownSize",
"(",
"common",
".",
"find",
"(",
"ANY",
",",
"ANY",
",",
"ANY",
")",
",",
"IMMUTABLE",
")",
",",
"false",
")",
";",
"}"
] | This method will return null until the source iterator is exhausted.
@return The elements that turned out to be common to the two inputs. | [
"This",
"method",
"will",
"return",
"null",
"until",
"the",
"source",
"iterator",
"is",
"exhausted",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-api/src/main/java/org/fcrepo/kernel/api/utils/GraphDifferencer.java#L97-L99 | train |
fcrepo4/fcrepo4 | fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/api/rdf/HttpTripleUtil.java | HttpTripleUtil.addHttpComponentModelsForResourceToStream | public RdfStream addHttpComponentModelsForResourceToStream(final RdfStream rdfStream,
final FedoraResource resource, final UriInfo uriInfo,
final IdentifierConverter<Resource,FedoraResource> idTranslator) {
LOGGER.debug("Adding additional HTTP context triples to stream");
return... | java | public RdfStream addHttpComponentModelsForResourceToStream(final RdfStream rdfStream,
final FedoraResource resource, final UriInfo uriInfo,
final IdentifierConverter<Resource,FedoraResource> idTranslator) {
LOGGER.debug("Adding additional HTTP context triples to stream");
return... | [
"public",
"RdfStream",
"addHttpComponentModelsForResourceToStream",
"(",
"final",
"RdfStream",
"rdfStream",
",",
"final",
"FedoraResource",
"resource",
",",
"final",
"UriInfo",
"uriInfo",
",",
"final",
"IdentifierConverter",
"<",
"Resource",
",",
"FedoraResource",
">",
... | Add additional models to the RDF dataset for the given resource
@param rdfStream the source stream we'll add named models to
@param resource the FedoraResourceImpl in question
@param uriInfo a JAX-RS UriInfo object to build URIs to resources
@param idTranslator the id translator
@return an RdfStream with the added tri... | [
"Add",
"additional",
"models",
"to",
"the",
"RDF",
"dataset",
"for",
"the",
"given",
"resource"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/api/rdf/HttpTripleUtil.java#L70-L81 | train |
fcrepo4/fcrepo4 | fcrepo-event-serialization/src/main/java/org/fcrepo/event/serialization/JsonLDSerializer.java | JsonLDSerializer.serialize | @Override
public String serialize(final FedoraEvent evt) {
try {
return MAPPER.writeValueAsString(from(evt));
} catch (final JsonProcessingException ex) {
LOGGER.error("Error processing JSON: {}", ex.getMessage());
return null;
}
} | java | @Override
public String serialize(final FedoraEvent evt) {
try {
return MAPPER.writeValueAsString(from(evt));
} catch (final JsonProcessingException ex) {
LOGGER.error("Error processing JSON: {}", ex.getMessage());
return null;
}
} | [
"@",
"Override",
"public",
"String",
"serialize",
"(",
"final",
"FedoraEvent",
"evt",
")",
"{",
"try",
"{",
"return",
"MAPPER",
".",
"writeValueAsString",
"(",
"from",
"(",
"evt",
")",
")",
";",
"}",
"catch",
"(",
"final",
"JsonProcessingException",
"ex",
... | Serialize a FedoraEvent into a JSON String
@param evt the Fedora event
@return a JSON string | [
"Serialize",
"a",
"FedoraEvent",
"into",
"a",
"JSON",
"String"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-event-serialization/src/main/java/org/fcrepo/event/serialization/JsonLDSerializer.java#L54-L62 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/rdf/converters/PropertyConverter.java | PropertyConverter.getPropertyNameFromPredicate | private static String getPropertyNameFromPredicate(final NamespaceRegistry namespaceRegistry,
final Resource predicate,
final Map<String, String> namespaceMapping)
throws RepositoryException {
... | java | private static String getPropertyNameFromPredicate(final NamespaceRegistry namespaceRegistry,
final Resource predicate,
final Map<String, String> namespaceMapping)
throws RepositoryException {
... | [
"private",
"static",
"String",
"getPropertyNameFromPredicate",
"(",
"final",
"NamespaceRegistry",
"namespaceRegistry",
",",
"final",
"Resource",
"predicate",
",",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"namespaceMapping",
")",
"throws",
"RepositoryException"... | Get the JCR property name for an RDF predicate
@param namespaceRegistry the namespace registry
@param predicate the predicate to map to a property name
@param namespaceMapping the namespace mapping
@return JCR property name for an RDF predicate
@throws RepositoryException if repository exception occurred | [
"Get",
"the",
"JCR",
"property",
"name",
"for",
"an",
"RDF",
"predicate"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/rdf/converters/PropertyConverter.java#L113-L164 | train |
fcrepo4/fcrepo4 | fcrepo-http-api/src/main/java/org/fcrepo/http/api/ContentExposingResource.java | ContentExposingResource.getContent | protected Response getContent(final String rangeValue,
final int limit,
final RdfStream rdfStream,
final FedoraResource resource) throws IOException {
final RdfNamespacedStream outputStream;
if (resou... | java | protected Response getContent(final String rangeValue,
final int limit,
final RdfStream rdfStream,
final FedoraResource resource) throws IOException {
final RdfNamespacedStream outputStream;
if (resou... | [
"protected",
"Response",
"getContent",
"(",
"final",
"String",
"rangeValue",
",",
"final",
"int",
"limit",
",",
"final",
"RdfStream",
"rdfStream",
",",
"final",
"FedoraResource",
"resource",
")",
"throws",
"IOException",
"{",
"final",
"RdfNamespacedStream",
"outputS... | This method returns an HTTP response with content body appropriate to the following arguments.
@param rangeValue starting and ending byte offsets, see {@link Range}
@param limit is the number of child resources returned in the response, -1 for all
@param rdfStream to which response RDF will be concatenated
@param reso... | [
"This",
"method",
"returns",
"an",
"HTTP",
"response",
"with",
"content",
"body",
"appropriate",
"to",
"the",
"following",
"arguments",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-api/src/main/java/org/fcrepo/http/api/ContentExposingResource.java#L263-L280 | train |
fcrepo4/fcrepo4 | fcrepo-http-api/src/main/java/org/fcrepo/http/api/ContentExposingResource.java | ContentExposingResource.getResourceTriples | private RdfStream getResourceTriples(final int limit, final FedoraResource resource) {
final PreferTag returnPreference;
if (prefer != null && prefer.hasReturn()) {
returnPreference = prefer.getReturn();
} else if (prefer != null && prefer.hasHandling()) {
returnPrefere... | java | private RdfStream getResourceTriples(final int limit, final FedoraResource resource) {
final PreferTag returnPreference;
if (prefer != null && prefer.hasReturn()) {
returnPreference = prefer.getReturn();
} else if (prefer != null && prefer.hasHandling()) {
returnPrefere... | [
"private",
"RdfStream",
"getResourceTriples",
"(",
"final",
"int",
"limit",
",",
"final",
"FedoraResource",
"resource",
")",
"{",
"final",
"PreferTag",
"returnPreference",
";",
"if",
"(",
"prefer",
"!=",
"null",
"&&",
"prefer",
".",
"hasReturn",
"(",
")",
")",... | This method returns a stream of RDF triples associated with this target resource
@param limit is the number of child resources returned in the response, -1 for all
@param resource the fedora resource
@return {@link RdfStream} | [
"This",
"method",
"returns",
"a",
"stream",
"of",
"RDF",
"triples",
"associated",
"with",
"this",
"target",
"resource"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-api/src/main/java/org/fcrepo/http/api/ContentExposingResource.java#L313-L385 | train |
fcrepo4/fcrepo4 | fcrepo-http-api/src/main/java/org/fcrepo/http/api/ContentExposingResource.java | ContentExposingResource.getBinaryContent | private Response getBinaryContent(final String rangeValue, final FedoraResource resource)
throws IOException {
final FedoraBinary binary = (FedoraBinary)resource;
final CacheControl cc = new CacheControl();
cc.setMaxAge(0);
cc.setMustRevalidate(true);
... | java | private Response getBinaryContent(final String rangeValue, final FedoraResource resource)
throws IOException {
final FedoraBinary binary = (FedoraBinary)resource;
final CacheControl cc = new CacheControl();
cc.setMaxAge(0);
cc.setMustRevalidate(true);
... | [
"private",
"Response",
"getBinaryContent",
"(",
"final",
"String",
"rangeValue",
",",
"final",
"FedoraResource",
"resource",
")",
"throws",
"IOException",
"{",
"final",
"FedoraBinary",
"binary",
"=",
"(",
"FedoraBinary",
")",
"resource",
";",
"final",
"CacheControl"... | Get the binary content of a datastream
@param rangeValue the range value
@param resource the fedora resource
@return Binary blob
@throws IOException if io exception occurred | [
"Get",
"the",
"binary",
"content",
"of",
"a",
"datastream"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-api/src/main/java/org/fcrepo/http/api/ContentExposingResource.java#L395-L450 | train |
fcrepo4/fcrepo4 | fcrepo-http-api/src/main/java/org/fcrepo/http/api/ContentExposingResource.java | ContentExposingResource.addAcceptPostHeader | private void addAcceptPostHeader() {
final String rdfTypes = TURTLE + "," + N3 + "," + N3_ALT2 + "," + RDF_XML + "," + NTRIPLES + "," + JSON_LD;
servletResponse.addHeader("Accept-Post", rdfTypes);
} | java | private void addAcceptPostHeader() {
final String rdfTypes = TURTLE + "," + N3 + "," + N3_ALT2 + "," + RDF_XML + "," + NTRIPLES + "," + JSON_LD;
servletResponse.addHeader("Accept-Post", rdfTypes);
} | [
"private",
"void",
"addAcceptPostHeader",
"(",
")",
"{",
"final",
"String",
"rdfTypes",
"=",
"TURTLE",
"+",
"\",\"",
"+",
"N3",
"+",
"\",\"",
"+",
"N3_ALT2",
"+",
"\",\"",
"+",
"RDF_XML",
"+",
"\",\"",
"+",
"NTRIPLES",
"+",
"\",\"",
"+",
"JSON_LD",
";",
... | Add the standard Accept-Post header, for reuse. | [
"Add",
"the",
"standard",
"Accept",
"-",
"Post",
"header",
"for",
"reuse",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-api/src/main/java/org/fcrepo/http/api/ContentExposingResource.java#L479-L482 | train |
fcrepo4/fcrepo4 | fcrepo-http-api/src/main/java/org/fcrepo/http/api/ContentExposingResource.java | ContentExposingResource.addLinkAndOptionsHttpHeaders | protected void addLinkAndOptionsHttpHeaders(final FedoraResource resource) {
// Add Link headers
addResourceLinkHeaders(resource);
addAcceptExternalHeader();
// Add Options headers
final String options;
if (resource.isMemento()) {
options = "GET,HEAD,OPTIONS,... | java | protected void addLinkAndOptionsHttpHeaders(final FedoraResource resource) {
// Add Link headers
addResourceLinkHeaders(resource);
addAcceptExternalHeader();
// Add Options headers
final String options;
if (resource.isMemento()) {
options = "GET,HEAD,OPTIONS,... | [
"protected",
"void",
"addLinkAndOptionsHttpHeaders",
"(",
"final",
"FedoraResource",
"resource",
")",
"{",
"// Add Link headers",
"addResourceLinkHeaders",
"(",
"resource",
")",
";",
"addAcceptExternalHeader",
"(",
")",
";",
"// Add Options headers",
"final",
"String",
"o... | Add Link and Option headers
@param resource the resource to generate headers for | [
"Add",
"Link",
"and",
"Option",
"headers"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-api/src/main/java/org/fcrepo/http/api/ContentExposingResource.java#L589-L616 | train |
fcrepo4/fcrepo4 | fcrepo-http-api/src/main/java/org/fcrepo/http/api/ContentExposingResource.java | ContentExposingResource.unpackLinks | protected List<String> unpackLinks(final List<String> rawLinks) {
if (rawLinks == null) {
return null;
}
return rawLinks.stream()
.flatMap(x -> Arrays.stream(x.split(",")))
.collect(Collectors.toList());
} | java | protected List<String> unpackLinks(final List<String> rawLinks) {
if (rawLinks == null) {
return null;
}
return rawLinks.stream()
.flatMap(x -> Arrays.stream(x.split(",")))
.collect(Collectors.toList());
} | [
"protected",
"List",
"<",
"String",
">",
"unpackLinks",
"(",
"final",
"List",
"<",
"String",
">",
"rawLinks",
")",
"{",
"if",
"(",
"rawLinks",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"rawLinks",
".",
"stream",
"(",
")",
".",
"fl... | Multi-value Link header values parsed by the javax.ws.rs.core are not split out by the framework Therefore we
must do this ourselves.
@param rawLinks the list of unprocessed links
@return List of strings containing one link value per string. | [
"Multi",
"-",
"value",
"Link",
"header",
"values",
"parsed",
"by",
"the",
"javax",
".",
"ws",
".",
"rs",
".",
"core",
"are",
"not",
"split",
"out",
"by",
"the",
"framework",
"Therefore",
"we",
"must",
"do",
"this",
"ourselves",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-api/src/main/java/org/fcrepo/http/api/ContentExposingResource.java#L647-L655 | train |
fcrepo4/fcrepo4 | fcrepo-http-api/src/main/java/org/fcrepo/http/api/ContentExposingResource.java | ContentExposingResource.addResourceHttpHeaders | protected void addResourceHttpHeaders(final FedoraResource resource) {
if (resource instanceof FedoraBinary) {
final FedoraBinary binary = (FedoraBinary)resource;
final Date createdDate = binary.getCreatedDate() != null ? Date.from(binary.getCreatedDate()) : null;
final Date ... | java | protected void addResourceHttpHeaders(final FedoraResource resource) {
if (resource instanceof FedoraBinary) {
final FedoraBinary binary = (FedoraBinary)resource;
final Date createdDate = binary.getCreatedDate() != null ? Date.from(binary.getCreatedDate()) : null;
final Date ... | [
"protected",
"void",
"addResourceHttpHeaders",
"(",
"final",
"FedoraResource",
"resource",
")",
"{",
"if",
"(",
"resource",
"instanceof",
"FedoraBinary",
")",
"{",
"final",
"FedoraBinary",
"binary",
"=",
"(",
"FedoraBinary",
")",
"resource",
";",
"final",
"Date",
... | Add any resource-specific headers to the response
@param resource the resource | [
"Add",
"any",
"resource",
"-",
"specific",
"headers",
"to",
"the",
"response"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-api/src/main/java/org/fcrepo/http/api/ContentExposingResource.java#L661-L709 | train |
fcrepo4/fcrepo4 | fcrepo-http-api/src/main/java/org/fcrepo/http/api/ContentExposingResource.java | ContentExposingResource.checkCacheControlHeaders | protected void checkCacheControlHeaders(final Request request,
final HttpServletResponse servletResponse,
final FedoraResource resource,
final HttpSession session) {
... | java | protected void checkCacheControlHeaders(final Request request,
final HttpServletResponse servletResponse,
final FedoraResource resource,
final HttpSession session) {
... | [
"protected",
"void",
"checkCacheControlHeaders",
"(",
"final",
"Request",
"request",
",",
"final",
"HttpServletResponse",
"servletResponse",
",",
"final",
"FedoraResource",
"resource",
",",
"final",
"HttpSession",
"session",
")",
"{",
"evaluateRequestPreconditions",
"(",
... | Evaluate the cache control headers for the request to see if it can be served from
the cache.
@param request the request
@param servletResponse the servlet response
@param resource the fedora resource
@param session the session | [
"Evaluate",
"the",
"cache",
"control",
"headers",
"for",
"the",
"request",
"to",
"see",
"if",
"it",
"can",
"be",
"served",
"from",
"the",
"cache",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-api/src/main/java/org/fcrepo/http/api/ContentExposingResource.java#L720-L726 | train |
fcrepo4/fcrepo4 | fcrepo-http-api/src/main/java/org/fcrepo/http/api/ContentExposingResource.java | ContentExposingResource.evaluateRequestPreconditions | protected void evaluateRequestPreconditions(final Request request,
final HttpServletResponse servletResponse,
final FedoraResource resource,
final HttpSess... | java | protected void evaluateRequestPreconditions(final Request request,
final HttpServletResponse servletResponse,
final FedoraResource resource,
final HttpSess... | [
"protected",
"void",
"evaluateRequestPreconditions",
"(",
"final",
"Request",
"request",
",",
"final",
"HttpServletResponse",
"servletResponse",
",",
"final",
"FedoraResource",
"resource",
",",
"final",
"HttpSession",
"session",
")",
"{",
"evaluateRequestPreconditions",
"... | Evaluate request preconditions to ensure the resource is the expected state
@param request the request
@param servletResponse the servlet response
@param resource the resource
@param session the session | [
"Evaluate",
"request",
"preconditions",
"to",
"ensure",
"the",
"resource",
"is",
"the",
"expected",
"state"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-api/src/main/java/org/fcrepo/http/api/ContentExposingResource.java#L788-L793 | train |
fcrepo4/fcrepo4 | fcrepo-http-api/src/main/java/org/fcrepo/http/api/ContentExposingResource.java | ContentExposingResource.acceptabePlainTextMediaType | private MediaType acceptabePlainTextMediaType() {
final List<MediaType> acceptable = headers.getAcceptableMediaTypes();
if (acceptable == null || acceptable.size() == 0) {
return TEXT_PLAIN_TYPE;
}
for (final MediaType type : acceptable) {
if (type.isWildcardType(... | java | private MediaType acceptabePlainTextMediaType() {
final List<MediaType> acceptable = headers.getAcceptableMediaTypes();
if (acceptable == null || acceptable.size() == 0) {
return TEXT_PLAIN_TYPE;
}
for (final MediaType type : acceptable) {
if (type.isWildcardType(... | [
"private",
"MediaType",
"acceptabePlainTextMediaType",
"(",
")",
"{",
"final",
"List",
"<",
"MediaType",
">",
"acceptable",
"=",
"headers",
".",
"getAcceptableMediaTypes",
"(",
")",
";",
"if",
"(",
"acceptable",
"==",
"null",
"||",
"acceptable",
".",
"size",
"... | Returns an acceptable plain text media type if possible, or null if not.
@return an acceptable plain-text media type, or null | [
"Returns",
"an",
"acceptable",
"plain",
"text",
"media",
"type",
"if",
"possible",
"or",
"null",
"if",
"not",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-api/src/main/java/org/fcrepo/http/api/ContentExposingResource.java#L856-L869 | train |
fcrepo4/fcrepo4 | fcrepo-http-api/src/main/java/org/fcrepo/http/api/ContentExposingResource.java | ContentExposingResource.createUpdateResponse | @SuppressWarnings("resource")
protected Response createUpdateResponse(final FedoraResource resource, final boolean created) {
addCacheControlHeaders(servletResponse, resource, session);
addResourceLinkHeaders(resource, created);
addExternalContentHeaders(resource);
addAclHeader(resou... | java | @SuppressWarnings("resource")
protected Response createUpdateResponse(final FedoraResource resource, final boolean created) {
addCacheControlHeaders(servletResponse, resource, session);
addResourceLinkHeaders(resource, created);
addExternalContentHeaders(resource);
addAclHeader(resou... | [
"@",
"SuppressWarnings",
"(",
"\"resource\"",
")",
"protected",
"Response",
"createUpdateResponse",
"(",
"final",
"FedoraResource",
"resource",
",",
"final",
"boolean",
"created",
")",
"{",
"addCacheControlHeaders",
"(",
"servletResponse",
",",
"resource",
",",
"sessi... | Create the appropriate response after a create or update request is processed. When a resource is created,
examine the Prefer and Accept headers to determine whether to include a representation. By default, the URI for
the created resource is return as plain text. If a minimal response is requested, then no body is ret... | [
"Create",
"the",
"appropriate",
"response",
"after",
"a",
"create",
"or",
"update",
"request",
"is",
"processed",
".",
"When",
"a",
"resource",
"is",
"created",
"examine",
"the",
"Prefer",
"and",
"Accept",
"headers",
"to",
"determine",
"whether",
"to",
"includ... | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-api/src/main/java/org/fcrepo/http/api/ContentExposingResource.java#L882-L914 | train |
fcrepo4/fcrepo4 | fcrepo-http-api/src/main/java/org/fcrepo/http/api/ContentExposingResource.java | ContentExposingResource.parseBodyAsModel | private Model parseBodyAsModel(final InputStream requestBodyStream,
final MediaType contentType, final FedoraResource resource) throws MalformedRdfException {
final Lang format = contentTypeToLang(contentType.toString());
final Model inputModel;
try {
inputModel = create... | java | private Model parseBodyAsModel(final InputStream requestBodyStream,
final MediaType contentType, final FedoraResource resource) throws MalformedRdfException {
final Lang format = contentTypeToLang(contentType.toString());
final Model inputModel;
try {
inputModel = create... | [
"private",
"Model",
"parseBodyAsModel",
"(",
"final",
"InputStream",
"requestBodyStream",
",",
"final",
"MediaType",
"contentType",
",",
"final",
"FedoraResource",
"resource",
")",
"throws",
"MalformedRdfException",
"{",
"final",
"Lang",
"format",
"=",
"contentTypeToLan... | Parse the request body as a Model.
@param requestBodyStream rdf request body
@param contentType content type of body
@param resource the fedora resource
@return Model containing triples from request body
@throws MalformedRdfException in case rdf json cannot be parsed | [
"Parse",
"the",
"request",
"body",
"as",
"a",
"Model",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-api/src/main/java/org/fcrepo/http/api/ContentExposingResource.java#L975-L993 | train |
fcrepo4/fcrepo4 | fcrepo-http-api/src/main/java/org/fcrepo/http/api/ContentExposingResource.java | ContentExposingResource.createDefaultAccessToStatement | private Statement createDefaultAccessToStatement(final String authSubject) {
final String currentResourcePath = authSubject.substring(0, authSubject.indexOf("/" + FCR_ACL));
return createStatement(
createResource(authSubject),
WEBAC_ACCESS_TO_PROPERTY,
... | java | private Statement createDefaultAccessToStatement(final String authSubject) {
final String currentResourcePath = authSubject.substring(0, authSubject.indexOf("/" + FCR_ACL));
return createStatement(
createResource(authSubject),
WEBAC_ACCESS_TO_PROPERTY,
... | [
"private",
"Statement",
"createDefaultAccessToStatement",
"(",
"final",
"String",
"authSubject",
")",
"{",
"final",
"String",
"currentResourcePath",
"=",
"authSubject",
".",
"substring",
"(",
"0",
",",
"authSubject",
".",
"indexOf",
"(",
"\"/\"",
"+",
"FCR_ACL",
"... | Returns a Statement with the resource containing the acl to be the accessTo target for the given auth subject.
@param authSubject - acl authorization subject uri string
@return acl statement | [
"Returns",
"a",
"Statement",
"with",
"the",
"resource",
"containing",
"the",
"acl",
"to",
"be",
"the",
"accessTo",
"target",
"for",
"the",
"given",
"auth",
"subject",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-api/src/main/java/org/fcrepo/http/api/ContentExposingResource.java#L1067-L1073 | train |
fcrepo4/fcrepo4 | fcrepo-http-api/src/main/java/org/fcrepo/http/api/ContentExposingResource.java | ContentExposingResource.checksumURI | protected static URI checksumURI( final String checksum ) {
if (!isBlank(checksum)) {
return URI.create(checksum);
}
return null;
} | java | protected static URI checksumURI( final String checksum ) {
if (!isBlank(checksum)) {
return URI.create(checksum);
}
return null;
} | [
"protected",
"static",
"URI",
"checksumURI",
"(",
"final",
"String",
"checksum",
")",
"{",
"if",
"(",
"!",
"isBlank",
"(",
"checksum",
")",
")",
"{",
"return",
"URI",
".",
"create",
"(",
"checksum",
")",
";",
"}",
"return",
"null",
";",
"}"
] | Create a checksum URI object. | [
"Create",
"a",
"checksum",
"URI",
"object",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-api/src/main/java/org/fcrepo/http/api/ContentExposingResource.java#L1101-L1106 | train |
fcrepo4/fcrepo4 | fcrepo-http-api/src/main/java/org/fcrepo/http/api/ContentExposingResource.java | ContentExposingResource.getChildrenLimit | protected int getChildrenLimit() {
final List<String> acceptHeaders = headers.getRequestHeader(ACCEPT);
if (acceptHeaders != null && acceptHeaders.size() > 0) {
final List<String> accept = Arrays.asList(acceptHeaders.get(0).split(","));
if (accept.contains(TEXT_HTML)) {
... | java | protected int getChildrenLimit() {
final List<String> acceptHeaders = headers.getRequestHeader(ACCEPT);
if (acceptHeaders != null && acceptHeaders.size() > 0) {
final List<String> accept = Arrays.asList(acceptHeaders.get(0).split(","));
if (accept.contains(TEXT_HTML)) {
... | [
"protected",
"int",
"getChildrenLimit",
"(",
")",
"{",
"final",
"List",
"<",
"String",
">",
"acceptHeaders",
"=",
"headers",
".",
"getRequestHeader",
"(",
"ACCEPT",
")",
";",
"if",
"(",
"acceptHeaders",
"!=",
"null",
"&&",
"acceptHeaders",
".",
"size",
"(",
... | Calculate the max number of children to display at once.
@return the limit of children to display. | [
"Calculate",
"the",
"max",
"number",
"of",
"children",
"to",
"display",
"at",
"once",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-api/src/main/java/org/fcrepo/http/api/ContentExposingResource.java#L1113-L1134 | train |
fcrepo4/fcrepo4 | fcrepo-http-api/src/main/java/org/fcrepo/http/api/ContentExposingResource.java | ContentExposingResource.parseDigestHeader | protected static Collection<String> parseDigestHeader(final String digest) throws UnsupportedAlgorithmException {
try {
final Map<String, String> digestPairs = RFC3230_SPLITTER.split(nullToEmpty(digest));
final boolean allSupportedAlgorithms = digestPairs.keySet().stream().allMatch(
... | java | protected static Collection<String> parseDigestHeader(final String digest) throws UnsupportedAlgorithmException {
try {
final Map<String, String> digestPairs = RFC3230_SPLITTER.split(nullToEmpty(digest));
final boolean allSupportedAlgorithms = digestPairs.keySet().stream().allMatch(
... | [
"protected",
"static",
"Collection",
"<",
"String",
">",
"parseDigestHeader",
"(",
"final",
"String",
"digest",
")",
"throws",
"UnsupportedAlgorithmException",
"{",
"try",
"{",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"digestPairs",
"=",
"RFC3230_SPLITTE... | Parse the RFC-3230 Digest response header value. Look for a sha1 checksum and return it as a urn, if missing or
malformed an empty string is returned.
@param digest The Digest header value
@return the sha1 checksum value
@throws UnsupportedAlgorithmException if an unsupported digest is used | [
"Parse",
"the",
"RFC",
"-",
"3230",
"Digest",
"response",
"header",
"value",
".",
"Look",
"for",
"a",
"sha1",
"checksum",
"and",
"return",
"it",
"as",
"a",
"urn",
"if",
"missing",
"or",
"malformed",
"an",
"empty",
"string",
"is",
"returned",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-api/src/main/java/org/fcrepo/http/api/ContentExposingResource.java#L1156-L1177 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/rdf/impl/RequiredPropertiesUtil.java | RequiredPropertiesUtil.assertRequiredContainerTriples | public static void assertRequiredContainerTriples(final Model model)
throws ConstraintViolationException {
assertContainsRequiredProperties(model, REQUIRED_PROPERTIES);
assertContainsRequiredTypes(model, CONTAINER_TYPES);
} | java | public static void assertRequiredContainerTriples(final Model model)
throws ConstraintViolationException {
assertContainsRequiredProperties(model, REQUIRED_PROPERTIES);
assertContainsRequiredTypes(model, CONTAINER_TYPES);
} | [
"public",
"static",
"void",
"assertRequiredContainerTriples",
"(",
"final",
"Model",
"model",
")",
"throws",
"ConstraintViolationException",
"{",
"assertContainsRequiredProperties",
"(",
"model",
",",
"REQUIRED_PROPERTIES",
")",
";",
"assertContainsRequiredTypes",
"(",
"mod... | Throws a ConstraintViolationException if the model does not contain all required server-managed triples for a
container.
@param model rdf to validate
@throws ConstraintViolationException if model does not contain all required server-managed triples for container | [
"Throws",
"a",
"ConstraintViolationException",
"if",
"the",
"model",
"does",
"not",
"contain",
"all",
"required",
"server",
"-",
"managed",
"triples",
"for",
"a",
"container",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/rdf/impl/RequiredPropertiesUtil.java#L66-L70 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/rdf/impl/RequiredPropertiesUtil.java | RequiredPropertiesUtil.assertRequiredDescriptionTriples | public static void assertRequiredDescriptionTriples(final Model model)
throws ConstraintViolationException {
assertContainsRequiredProperties(model, REQUIRED_PROPERTIES);
assertContainsRequiredTypes(model, BINARY_TYPES);
} | java | public static void assertRequiredDescriptionTriples(final Model model)
throws ConstraintViolationException {
assertContainsRequiredProperties(model, REQUIRED_PROPERTIES);
assertContainsRequiredTypes(model, BINARY_TYPES);
} | [
"public",
"static",
"void",
"assertRequiredDescriptionTriples",
"(",
"final",
"Model",
"model",
")",
"throws",
"ConstraintViolationException",
"{",
"assertContainsRequiredProperties",
"(",
"model",
",",
"REQUIRED_PROPERTIES",
")",
";",
"assertContainsRequiredTypes",
"(",
"m... | Throws a ConstraintViolationException if the model does not contain all required server-managed triples for a
binary description.
@param model rdf to validate
@throws ConstraintViolationException if model does not contain all required server-managed triples for binary
description | [
"Throws",
"a",
"ConstraintViolationException",
"if",
"the",
"model",
"does",
"not",
"contain",
"all",
"required",
"server",
"-",
"managed",
"triples",
"for",
"a",
"binary",
"description",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/rdf/impl/RequiredPropertiesUtil.java#L80-L84 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/services/BinaryServiceImpl.java | BinaryServiceImpl.find | @Override
public FedoraBinary find(final FedoraSession session, final String path) {
return cast(findNode(session, path));
} | java | @Override
public FedoraBinary find(final FedoraSession session, final String path) {
return cast(findNode(session, path));
} | [
"@",
"Override",
"public",
"FedoraBinary",
"find",
"(",
"final",
"FedoraSession",
"session",
",",
"final",
"String",
"path",
")",
"{",
"return",
"cast",
"(",
"findNode",
"(",
"session",
",",
"path",
")",
")",
";",
"}"
] | Retrieve a Datastream instance by pid and dsid
@param path jcr path to the datastream
@return datastream | [
"Retrieve",
"a",
"Datastream",
"instance",
"by",
"pid",
"and",
"dsid"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/services/BinaryServiceImpl.java#L127-L130 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/NonRdfSourceDescriptionImpl.java | NonRdfSourceDescriptionImpl.touch | @Override
public void touch(final boolean includeMembershipResource, final Calendar createdDate, final String createdUser,
final Calendar modifiedDate, final String modifyingUser) throws RepositoryException {
super.touch(includeMembershipResource, createdDate, createdUser, modifiedDate... | java | @Override
public void touch(final boolean includeMembershipResource, final Calendar createdDate, final String createdUser,
final Calendar modifiedDate, final String modifyingUser) throws RepositoryException {
super.touch(includeMembershipResource, createdDate, createdUser, modifiedDate... | [
"@",
"Override",
"public",
"void",
"touch",
"(",
"final",
"boolean",
"includeMembershipResource",
",",
"final",
"Calendar",
"createdDate",
",",
"final",
"String",
"createdUser",
",",
"final",
"Calendar",
"modifiedDate",
",",
"final",
"String",
"modifyingUser",
")",
... | Overrides the superclass to propagate updates to certain properties to the binary if explicitly set. | [
"Overrides",
"the",
"superclass",
"to",
"propagate",
"updates",
"to",
"certain",
"properties",
"to",
"the",
"binary",
"if",
"explicitly",
"set",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/NonRdfSourceDescriptionImpl.java#L125-L133 | train |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/services/AbstractService.java | AbstractService.exists | public boolean exists(final FedoraSession session, final String path) {
final Session jcrSession = getJcrSession(session);
try {
return jcrSession.nodeExists(path);
} catch (final RepositoryException e) {
throw new RepositoryRuntimeException(e);
}
} | java | public boolean exists(final FedoraSession session, final String path) {
final Session jcrSession = getJcrSession(session);
try {
return jcrSession.nodeExists(path);
} catch (final RepositoryException e) {
throw new RepositoryRuntimeException(e);
}
} | [
"public",
"boolean",
"exists",
"(",
"final",
"FedoraSession",
"session",
",",
"final",
"String",
"path",
")",
"{",
"final",
"Session",
"jcrSession",
"=",
"getJcrSession",
"(",
"session",
")",
";",
"try",
"{",
"return",
"jcrSession",
".",
"nodeExists",
"(",
"... | test node existence at path
@param session the session
@param path the path
@return whether T exists at the given path | [
"test",
"node",
"existence",
"at",
"path"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/services/AbstractService.java#L95-L102 | train |
fcrepo4/fcrepo4 | fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/ViewHelpers.java | ViewHelpers.getVersions | public Iterator<Node> getVersions(final Graph graph,
final Node subject) {
// Mementos should be ordered by date so use the getOrderedVersions.
return getOrderedVersions(graph, subject, CONTAINS.asResource());
} | java | public Iterator<Node> getVersions(final Graph graph,
final Node subject) {
// Mementos should be ordered by date so use the getOrderedVersions.
return getOrderedVersions(graph, subject, CONTAINS.asResource());
} | [
"public",
"Iterator",
"<",
"Node",
">",
"getVersions",
"(",
"final",
"Graph",
"graph",
",",
"final",
"Node",
"subject",
")",
"{",
"// Mementos should be ordered by date so use the getOrderedVersions.",
"return",
"getOrderedVersions",
"(",
"graph",
",",
"subject",
",",
... | Return an iterator of Triples for versions.
@param graph the graph
@param subject the subject
@return iterator | [
"Return",
"an",
"iterator",
"of",
"Triples",
"for",
"versions",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/ViewHelpers.java#L106-L110 | train |
fcrepo4/fcrepo4 | fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/ViewHelpers.java | ViewHelpers.getOrderedVersions | public Iterator<Node> getOrderedVersions(final Graph g, final Node subject, final Resource predicate) {
final List<Node> vs = listObjects(g, subject, predicate.asNode()).toList();
vs.sort(Comparator.comparing(v -> getVersionDate(g, v)));
return vs.iterator();
} | java | public Iterator<Node> getOrderedVersions(final Graph g, final Node subject, final Resource predicate) {
final List<Node> vs = listObjects(g, subject, predicate.asNode()).toList();
vs.sort(Comparator.comparing(v -> getVersionDate(g, v)));
return vs.iterator();
} | [
"public",
"Iterator",
"<",
"Node",
">",
"getOrderedVersions",
"(",
"final",
"Graph",
"g",
",",
"final",
"Node",
"subject",
",",
"final",
"Resource",
"predicate",
")",
"{",
"final",
"List",
"<",
"Node",
">",
"vs",
"=",
"listObjects",
"(",
"g",
",",
"subje... | Return an iterator of Triples for versions in order that
they were created.
@param g the graph
@param subject the subject
@param predicate the predicate
@return iterator | [
"Return",
"an",
"iterator",
"of",
"Triples",
"for",
"versions",
"in",
"order",
"that",
"they",
"were",
"created",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/ViewHelpers.java#L121-L125 | train |
fcrepo4/fcrepo4 | fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/ViewHelpers.java | ViewHelpers.getVersionLabel | public String getVersionLabel(final Graph graph, final Node subject) {
final Instant datetime = getVersionDate(graph, subject);
return MEMENTO_RFC_1123_FORMATTER.format(datetime);
} | java | public String getVersionLabel(final Graph graph, final Node subject) {
final Instant datetime = getVersionDate(graph, subject);
return MEMENTO_RFC_1123_FORMATTER.format(datetime);
} | [
"public",
"String",
"getVersionLabel",
"(",
"final",
"Graph",
"graph",
",",
"final",
"Node",
"subject",
")",
"{",
"final",
"Instant",
"datetime",
"=",
"getVersionDate",
"(",
"graph",
",",
"subject",
")",
";",
"return",
"MEMENTO_RFC_1123_FORMATTER",
".",
"format"... | Get the date time as the version label.
@param graph the graph
@param subject the subject
@return the datetime in RFC 1123 format. | [
"Get",
"the",
"date",
"time",
"as",
"the",
"version",
"label",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/ViewHelpers.java#L155-L158 | train |
fcrepo4/fcrepo4 | fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/ViewHelpers.java | ViewHelpers.getVersionDate | public Instant getVersionDate(final Graph graph, final Node subject) {
final String[] pathParts = subject.getURI().split("/");
return MEMENTO_LABEL_FORMATTER.parse(pathParts[pathParts.length - 1], Instant::from);
} | java | public Instant getVersionDate(final Graph graph, final Node subject) {
final String[] pathParts = subject.getURI().split("/");
return MEMENTO_LABEL_FORMATTER.parse(pathParts[pathParts.length - 1], Instant::from);
} | [
"public",
"Instant",
"getVersionDate",
"(",
"final",
"Graph",
"graph",
",",
"final",
"Node",
"subject",
")",
"{",
"final",
"String",
"[",
"]",
"pathParts",
"=",
"subject",
".",
"getURI",
"(",
")",
".",
"split",
"(",
"\"/\"",
")",
";",
"return",
"MEMENTO_... | Gets a modification date of a subject from the graph
@param graph the graph
@param subject the subject
@return the modification date if it exists | [
"Gets",
"a",
"modification",
"date",
"of",
"a",
"subject",
"from",
"the",
"graph"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/ViewHelpers.java#L167-L170 | train |
fcrepo4/fcrepo4 | fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/ViewHelpers.java | ViewHelpers.getObjectTitle | public String getObjectTitle(final Graph graph, final Node sub) {
if (sub == null) {
return "";
}
final Optional<String> title = TITLE_PROPERTIES.stream().map(Property::asNode).flatMap(p -> listObjects(
graph, sub, p).toList().stream()).filter(Node::isLiteral).map(Nod... | java | public String getObjectTitle(final Graph graph, final Node sub) {
if (sub == null) {
return "";
}
final Optional<String> title = TITLE_PROPERTIES.stream().map(Property::asNode).flatMap(p -> listObjects(
graph, sub, p).toList().stream()).filter(Node::isLiteral).map(Nod... | [
"public",
"String",
"getObjectTitle",
"(",
"final",
"Graph",
"graph",
",",
"final",
"Node",
"sub",
")",
"{",
"if",
"(",
"sub",
"==",
"null",
")",
"{",
"return",
"\"\"",
";",
"}",
"final",
"Optional",
"<",
"String",
">",
"title",
"=",
"TITLE_PROPERTIES",
... | Get the canonical title of a subject from the graph
@param graph the graph
@param sub the subject
@return canonical title of the subject in the graph | [
"Get",
"the",
"canonical",
"title",
"of",
"a",
"subject",
"from",
"the",
"graph"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/ViewHelpers.java#L184-L192 | train |
fcrepo4/fcrepo4 | fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/ViewHelpers.java | ViewHelpers.getObjectsAsString | public String getObjectsAsString(final Graph graph,
final Node subject, final Resource predicate, final boolean uriAsLink) {
LOGGER.trace("Getting Objects as String: s:{}, p:{}, g:{}", subject, predicate, graph);
final Iterator<Node> iterator = listObjects(graph, subject, predicate.asNode())... | java | public String getObjectsAsString(final Graph graph,
final Node subject, final Resource predicate, final boolean uriAsLink) {
LOGGER.trace("Getting Objects as String: s:{}, p:{}, g:{}", subject, predicate, graph);
final Iterator<Node> iterator = listObjects(graph, subject, predicate.asNode())... | [
"public",
"String",
"getObjectsAsString",
"(",
"final",
"Graph",
"graph",
",",
"final",
"Node",
"subject",
",",
"final",
"Resource",
"predicate",
",",
"final",
"boolean",
"uriAsLink",
")",
"{",
"LOGGER",
".",
"trace",
"(",
"\"Getting Objects as String: s:{}, p:{}, g... | Get the string version of the object that matches the given subject and
predicate
@param graph the graph
@param subject the subject
@param predicate the predicate
@param uriAsLink the boolean value of uri as link
@return string version of the object | [
"Get",
"the",
"string",
"version",
"of",
"the",
"object",
"that",
"matches",
"the",
"given",
"subject",
"and",
"predicate"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/ViewHelpers.java#L228-L241 | train |
fcrepo4/fcrepo4 | fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/ViewHelpers.java | ViewHelpers.getOriginalResource | public Node getOriginalResource(final Node subject) {
if (!subject.isURI()) {
return subject;
}
final String subjectUri = subject.getURI();
final int index = subjectUri.indexOf(FCR_VERSIONS);
if (index > 0) {
return NodeFactory.createURI(subjectUri.substr... | java | public Node getOriginalResource(final Node subject) {
if (!subject.isURI()) {
return subject;
}
final String subjectUri = subject.getURI();
final int index = subjectUri.indexOf(FCR_VERSIONS);
if (index > 0) {
return NodeFactory.createURI(subjectUri.substr... | [
"public",
"Node",
"getOriginalResource",
"(",
"final",
"Node",
"subject",
")",
"{",
"if",
"(",
"!",
"subject",
".",
"isURI",
"(",
")",
")",
"{",
"return",
"subject",
";",
"}",
"final",
"String",
"subjectUri",
"=",
"subject",
".",
"getURI",
"(",
")",
";... | Returns the original resource as a URI Node if
the subject represents a memento uri; otherwise it
returns the subject parameter.
@param subject the subject
@return a URI node of the original resource. | [
"Returns",
"the",
"original",
"resource",
"as",
"a",
"URI",
"Node",
"if",
"the",
"subject",
"represents",
"a",
"memento",
"uri",
";",
"otherwise",
"it",
"returns",
"the",
"subject",
"parameter",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/ViewHelpers.java#L250-L262 | train |
fcrepo4/fcrepo4 | fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/ViewHelpers.java | ViewHelpers.getNumChildren | public int getNumChildren(final Graph graph, final Node subject) {
LOGGER.trace("Getting number of children: s:{}, g:{}", subject, graph);
return (int) asStream(listObjects(graph, subject, CONTAINS.asNode())).count();
} | java | public int getNumChildren(final Graph graph, final Node subject) {
LOGGER.trace("Getting number of children: s:{}, g:{}", subject, graph);
return (int) asStream(listObjects(graph, subject, CONTAINS.asNode())).count();
} | [
"public",
"int",
"getNumChildren",
"(",
"final",
"Graph",
"graph",
",",
"final",
"Node",
"subject",
")",
"{",
"LOGGER",
".",
"trace",
"(",
"\"Getting number of children: s:{}, g:{}\"",
",",
"subject",
",",
"graph",
")",
";",
"return",
"(",
"int",
")",
"asStrea... | Get the number of child resources associated with the arg 'subject' as specified by the triple found in the arg
'graph' with the predicate RdfLexicon.HAS_CHILD_COUNT.
@param graph of triples
@param subject for which child resources is sought
@return number of child resources | [
"Get",
"the",
"number",
"of",
"child",
"resources",
"associated",
"with",
"the",
"arg",
"subject",
"as",
"specified",
"by",
"the",
"triple",
"found",
"in",
"the",
"arg",
"graph",
"with",
"the",
"predicate",
"RdfLexicon",
".",
"HAS_CHILD_COUNT",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/ViewHelpers.java#L282-L285 | train |
fcrepo4/fcrepo4 | fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/ViewHelpers.java | ViewHelpers.getNodeBreadcrumbs | public Map<String, String> getNodeBreadcrumbs(final UriInfo uriInfo,
final Node subject) {
final String topic = subject.getURI();
LOGGER.trace("Generating breadcrumbs for subject {}", subject);
final String baseUri = uriInfo.getBaseUri().toString();
if (!topic.startsWith(ba... | java | public Map<String, String> getNodeBreadcrumbs(final UriInfo uriInfo,
final Node subject) {
final String topic = subject.getURI();
LOGGER.trace("Generating breadcrumbs for subject {}", subject);
final String baseUri = uriInfo.getBaseUri().toString();
if (!topic.startsWith(ba... | [
"public",
"Map",
"<",
"String",
",",
"String",
">",
"getNodeBreadcrumbs",
"(",
"final",
"UriInfo",
"uriInfo",
",",
"final",
"Node",
"subject",
")",
"{",
"final",
"String",
"topic",
"=",
"subject",
".",
"getURI",
"(",
")",
";",
"LOGGER",
".",
"trace",
"("... | Generate url to local name breadcrumbs for a given node's tree
@param uriInfo the uri info
@param subject the subject
@return breadcrumbs | [
"Generate",
"url",
"to",
"local",
"name",
"breadcrumbs",
"for",
"a",
"given",
"node",
"s",
"tree"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/ViewHelpers.java#L294-L311 | train |
fcrepo4/fcrepo4 | fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/ViewHelpers.java | ViewHelpers.getSortedTriples | public List<Triple> getSortedTriples(final Model model, final Iterator<Triple> it) {
final List<Triple> triples = newArrayList(it);
triples.sort(new TripleOrdering(model));
return triples;
} | java | public List<Triple> getSortedTriples(final Model model, final Iterator<Triple> it) {
final List<Triple> triples = newArrayList(it);
triples.sort(new TripleOrdering(model));
return triples;
} | [
"public",
"List",
"<",
"Triple",
">",
"getSortedTriples",
"(",
"final",
"Model",
"model",
",",
"final",
"Iterator",
"<",
"Triple",
">",
"it",
")",
"{",
"final",
"List",
"<",
"Triple",
">",
"triples",
"=",
"newArrayList",
"(",
"it",
")",
";",
"triples",
... | Sort a Iterator of Triples alphabetically by its subject, predicate, and
object
@param model the model
@param it the iterator of triples
@return iterator of alphabetized triples | [
"Sort",
"a",
"Iterator",
"of",
"Triples",
"alphabetically",
"by",
"its",
"subject",
"predicate",
"and",
"object"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/ViewHelpers.java#L321-L325 | train |
fcrepo4/fcrepo4 | fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/ViewHelpers.java | ViewHelpers.getPrefixPreamble | public String getPrefixPreamble(final PrefixMapping mapping) {
return mapping.getNsPrefixMap().entrySet().stream()
.map(e -> "PREFIX " + e.getKey() + ": <" + e.getValue() + ">").collect(joining("\n", "", "\n\n"));
} | java | public String getPrefixPreamble(final PrefixMapping mapping) {
return mapping.getNsPrefixMap().entrySet().stream()
.map(e -> "PREFIX " + e.getKey() + ": <" + e.getValue() + ">").collect(joining("\n", "", "\n\n"));
} | [
"public",
"String",
"getPrefixPreamble",
"(",
"final",
"PrefixMapping",
"mapping",
")",
"{",
"return",
"mapping",
".",
"getNsPrefixMap",
"(",
")",
".",
"entrySet",
"(",
")",
".",
"stream",
"(",
")",
".",
"map",
"(",
"e",
"->",
"\"PREFIX \"",
"+",
"e",
".... | Get a prefix preamble appropriate for a SPARQL-UPDATE query from a prefix
mapping object
@param mapping the prefix mapping
@return prefix preamble | [
"Get",
"a",
"prefix",
"preamble",
"appropriate",
"for",
"a",
"SPARQL",
"-",
"UPDATE",
"query",
"from",
"a",
"prefix",
"mapping",
"object"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/ViewHelpers.java#L357-L360 | train |
fcrepo4/fcrepo4 | fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/ViewHelpers.java | ViewHelpers.isRdfResource | public boolean isRdfResource(final Graph graph,
final Node subject,
final String namespace,
final String resource) {
LOGGER.trace("Is RDF Resource? s:{}, ns:{}, r:{}, g:{}", subject, namespace, resource, graph);
... | java | public boolean isRdfResource(final Graph graph,
final Node subject,
final String namespace,
final String resource) {
LOGGER.trace("Is RDF Resource? s:{}, ns:{}, r:{}, g:{}", subject, namespace, resource, graph);
... | [
"public",
"boolean",
"isRdfResource",
"(",
"final",
"Graph",
"graph",
",",
"final",
"Node",
"subject",
",",
"final",
"String",
"namespace",
",",
"final",
"String",
"resource",
")",
"{",
"LOGGER",
".",
"trace",
"(",
"\"Is RDF Resource? s:{}, ns:{}, r:{}, g:{}\"",
"... | Determines whether the subject is kind of RDF resource
@param graph the graph
@param subject the subject
@param namespace the namespace
@param resource the resource
@return whether the subject is kind of RDF resource | [
"Determines",
"whether",
"the",
"subject",
"is",
"kind",
"of",
"RDF",
"resource"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/ViewHelpers.java#L370-L377 | train |
fcrepo4/fcrepo4 | fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/ViewHelpers.java | ViewHelpers.isRootResource | public boolean isRootResource(final Graph graph, final Node subject) {
final String rootRes = graph.getPrefixMapping().expandPrefix(FEDORA_REPOSITORY_ROOT);
final Node root = createResource(rootRes).asNode();
return graph.contains(subject, rdfType().asNode(), root);
} | java | public boolean isRootResource(final Graph graph, final Node subject) {
final String rootRes = graph.getPrefixMapping().expandPrefix(FEDORA_REPOSITORY_ROOT);
final Node root = createResource(rootRes).asNode();
return graph.contains(subject, rdfType().asNode(), root);
} | [
"public",
"boolean",
"isRootResource",
"(",
"final",
"Graph",
"graph",
",",
"final",
"Node",
"subject",
")",
"{",
"final",
"String",
"rootRes",
"=",
"graph",
".",
"getPrefixMapping",
"(",
")",
".",
"expandPrefix",
"(",
"FEDORA_REPOSITORY_ROOT",
")",
";",
"fina... | Is the subject the repository root resource.
@param graph The graph
@param subject The current subject
@return true if has rdf:type http://fedora.info/definitions/v4/repository#RepositoryRoot | [
"Is",
"the",
"subject",
"the",
"repository",
"root",
"resource",
"."
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/ViewHelpers.java#L386-L390 | train |
fcrepo4/fcrepo4 | fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/ViewHelpers.java | ViewHelpers.getContentNode | public static Node getContentNode(final Node subject) {
return subject == null ? null : NodeFactory.createURI(subject.getURI().replace("/" + FCR_METADATA, ""));
} | java | public static Node getContentNode(final Node subject) {
return subject == null ? null : NodeFactory.createURI(subject.getURI().replace("/" + FCR_METADATA, ""));
} | [
"public",
"static",
"Node",
"getContentNode",
"(",
"final",
"Node",
"subject",
")",
"{",
"return",
"subject",
"==",
"null",
"?",
"null",
":",
"NodeFactory",
".",
"createURI",
"(",
"subject",
".",
"getURI",
"(",
")",
".",
"replace",
"(",
"\"/\"",
"+",
"FC... | Get the content-bearing node for the given subject
@param subject the subject
@return content-bearing node for the given subject | [
"Get",
"the",
"content",
"-",
"bearing",
"node",
"for",
"the",
"given",
"subject"
] | 7489ad5bc8fb44e2442c93eceb7d97ac54553ab6 | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/ViewHelpers.java#L442-L444 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.