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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
bmwcarit/joynr | java/core/libjoynr/src/main/java/io/joynr/proxy/ProxyInvocationHandlerImpl.java | ProxyInvocationHandlerImpl.waitForConnectorFinished | public boolean waitForConnectorFinished() throws InterruptedException {
connectorStatusLock.lock();
try {
if (connectorStatus == ConnectorStatus.ConnectorSuccesful) {
return true;
}
return connectorSuccessfullyFinished.await(discoveryQos.getDiscoveryTimeoutMs(), TimeUnit.MILLISECONDS);
} finally {
connectorStatusLock.unlock();
}
} | java | public boolean waitForConnectorFinished() throws InterruptedException {
connectorStatusLock.lock();
try {
if (connectorStatus == ConnectorStatus.ConnectorSuccesful) {
return true;
}
return connectorSuccessfullyFinished.await(discoveryQos.getDiscoveryTimeoutMs(), TimeUnit.MILLISECONDS);
} finally {
connectorStatusLock.unlock();
}
} | [
"public",
"boolean",
"waitForConnectorFinished",
"(",
")",
"throws",
"InterruptedException",
"{",
"connectorStatusLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"connectorStatus",
"==",
"ConnectorStatus",
".",
"ConnectorSuccesful",
")",
"{",
"return",
"... | Checks the connector status before a method call is executed. Instantly returns True if the connector already
finished successfully , otherwise it will block up to the amount of milliseconds defined by the
arbitrationTimeout or until the ProxyInvocationHandler is notified about a successful connection.
@return True if the connector was finished successfully in time, False if the connector failed or could not be
finished in time.
@throws InterruptedException in case thread is interrupted | [
"Checks",
"the",
"connector",
"status",
"before",
"a",
"method",
"call",
"is",
"executed",
".",
"Instantly",
"returns",
"True",
"if",
"the",
"connector",
"already",
"finished",
"successfully",
"otherwise",
"it",
"will",
"block",
"up",
"to",
"the",
"amount",
"o... | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/core/libjoynr/src/main/java/io/joynr/proxy/ProxyInvocationHandlerImpl.java#L214-L227 | train |
bmwcarit/joynr | java/core/libjoynr/src/main/java/io/joynr/proxy/ProxyInvocationHandlerImpl.java | ProxyInvocationHandlerImpl.isConnectorReady | public boolean isConnectorReady() {
connectorStatusLock.lock();
try {
if (connectorStatus == ConnectorStatus.ConnectorSuccesful) {
return true;
}
return false;
} finally {
connectorStatusLock.unlock();
}
} | java | public boolean isConnectorReady() {
connectorStatusLock.lock();
try {
if (connectorStatus == ConnectorStatus.ConnectorSuccesful) {
return true;
}
return false;
} finally {
connectorStatusLock.unlock();
}
} | [
"public",
"boolean",
"isConnectorReady",
"(",
")",
"{",
"connectorStatusLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"connectorStatus",
"==",
"ConnectorStatus",
".",
"ConnectorSuccesful",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
... | Checks if the connector was set successfully. Returns immediately and does not block until the connector is
finished.
@return true if a connector was successfully set. | [
"Checks",
"if",
"the",
"connector",
"was",
"set",
"successfully",
".",
"Returns",
"immediately",
"and",
"does",
"not",
"block",
"until",
"the",
"connector",
"is",
"finished",
"."
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/core/libjoynr/src/main/java/io/joynr/proxy/ProxyInvocationHandlerImpl.java#L235-L247 | train |
bmwcarit/joynr | java/core/libjoynr/src/main/java/io/joynr/proxy/ProxyInvocationHandlerImpl.java | ProxyInvocationHandlerImpl.sendQueuedInvocations | private void sendQueuedInvocations() {
while (true) {
MethodInvocation<?> currentRPC = queuedRpcList.poll();
if (currentRPC == null) {
return;
}
try {
connector.executeAsyncMethod(currentRPC.getProxy(),
currentRPC.getMethod(),
currentRPC.getArgs(),
currentRPC.getFuture());
} catch (JoynrRuntimeException e) {
currentRPC.getFuture().onFailure(e);
} catch (Exception e) {
currentRPC.getFuture().onFailure(new JoynrRuntimeException(e));
}
}
} | java | private void sendQueuedInvocations() {
while (true) {
MethodInvocation<?> currentRPC = queuedRpcList.poll();
if (currentRPC == null) {
return;
}
try {
connector.executeAsyncMethod(currentRPC.getProxy(),
currentRPC.getMethod(),
currentRPC.getArgs(),
currentRPC.getFuture());
} catch (JoynrRuntimeException e) {
currentRPC.getFuture().onFailure(e);
} catch (Exception e) {
currentRPC.getFuture().onFailure(new JoynrRuntimeException(e));
}
}
} | [
"private",
"void",
"sendQueuedInvocations",
"(",
")",
"{",
"while",
"(",
"true",
")",
"{",
"MethodInvocation",
"<",
"?",
">",
"currentRPC",
"=",
"queuedRpcList",
".",
"poll",
"(",
")",
";",
"if",
"(",
"currentRPC",
"==",
"null",
")",
"{",
"return",
";",
... | Executes previously queued remote calls. This method is called when arbitration is completed. | [
"Executes",
"previously",
"queued",
"remote",
"calls",
".",
"This",
"method",
"is",
"called",
"when",
"arbitration",
"is",
"completed",
"."
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/core/libjoynr/src/main/java/io/joynr/proxy/ProxyInvocationHandlerImpl.java#L288-L308 | train |
bmwcarit/joynr | java/core/libjoynr/src/main/java/io/joynr/proxy/ProxyInvocationHandlerImpl.java | ProxyInvocationHandlerImpl.createConnector | @Override
public void createConnector(ArbitrationResult result) {
connector = connectorFactory.create(proxyParticipantId, result, qosSettings, statelessAsyncParticipantId);
connectorStatusLock.lock();
try {
connectorStatus = ConnectorStatus.ConnectorSuccesful;
connectorSuccessfullyFinished.signalAll();
if (connector != null) {
sendQueuedInvocations();
sendQueuedSubscriptionInvocations();
sendQueuedUnsubscribeInvocations();
sendQueuedStatelessAsyncInvocations();
}
} finally {
connectorStatusLock.unlock();
}
} | java | @Override
public void createConnector(ArbitrationResult result) {
connector = connectorFactory.create(proxyParticipantId, result, qosSettings, statelessAsyncParticipantId);
connectorStatusLock.lock();
try {
connectorStatus = ConnectorStatus.ConnectorSuccesful;
connectorSuccessfullyFinished.signalAll();
if (connector != null) {
sendQueuedInvocations();
sendQueuedSubscriptionInvocations();
sendQueuedUnsubscribeInvocations();
sendQueuedStatelessAsyncInvocations();
}
} finally {
connectorStatusLock.unlock();
}
} | [
"@",
"Override",
"public",
"void",
"createConnector",
"(",
"ArbitrationResult",
"result",
")",
"{",
"connector",
"=",
"connectorFactory",
".",
"create",
"(",
"proxyParticipantId",
",",
"result",
",",
"qosSettings",
",",
"statelessAsyncParticipantId",
")",
";",
"conn... | Sets the connector for this ProxyInvocationHandler after the DiscoveryAgent got notified about a successful
arbitration. Should be called from the DiscoveryAgent
@param result
from the previously invoked arbitration | [
"Sets",
"the",
"connector",
"for",
"this",
"ProxyInvocationHandler",
"after",
"the",
"DiscoveryAgent",
"got",
"notified",
"about",
"a",
"successful",
"arbitration",
".",
"Should",
"be",
"called",
"from",
"the",
"DiscoveryAgent"
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/core/libjoynr/src/main/java/io/joynr/proxy/ProxyInvocationHandlerImpl.java#L331-L348 | train |
bmwcarit/joynr | java/messaging/bounceproxy/single-bounceproxy/src/main/java/io/joynr/bounceproxy/service/TimeService.java | TimeService.getTime | @GET
@Produces({ MediaType.TEXT_PLAIN })
public String getTime() {
return String.valueOf(System.currentTimeMillis());
} | java | @GET
@Produces({ MediaType.TEXT_PLAIN })
public String getTime() {
return String.valueOf(System.currentTimeMillis());
} | [
"@",
"GET",
"@",
"Produces",
"(",
"{",
"MediaType",
".",
"TEXT_PLAIN",
"}",
")",
"public",
"String",
"getTime",
"(",
")",
"{",
"return",
"String",
".",
"valueOf",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
")",
";",
"}"
] | get server time in ms
@return the server time in ms | [
"get",
"server",
"time",
"in",
"ms"
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/messaging/bounceproxy/single-bounceproxy/src/main/java/io/joynr/bounceproxy/service/TimeService.java#L42-L46 | train |
bmwcarit/joynr | java/messaging/servlet-common/src/main/java/io/joynr/servlet/ServletUtil.java | ServletUtil.findFreePort | public static int findFreePort() throws IOException {
ServerSocket socket = null;
try {
socket = new ServerSocket(0);
return socket.getLocalPort();
} finally {
if (socket != null) {
socket.close();
}
}
} | java | public static int findFreePort() throws IOException {
ServerSocket socket = null;
try {
socket = new ServerSocket(0);
return socket.getLocalPort();
} finally {
if (socket != null) {
socket.close();
}
}
} | [
"public",
"static",
"int",
"findFreePort",
"(",
")",
"throws",
"IOException",
"{",
"ServerSocket",
"socket",
"=",
"null",
";",
"try",
"{",
"socket",
"=",
"new",
"ServerSocket",
"(",
"0",
")",
";",
"return",
"socket",
".",
"getLocalPort",
"(",
")",
";",
"... | Find a free port on the test system to be used by the servlet engine
@return the socket number
@throws IOException in case of I/O failure | [
"Find",
"a",
"free",
"port",
"on",
"the",
"test",
"system",
"to",
"be",
"used",
"by",
"the",
"servlet",
"engine"
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/messaging/servlet-common/src/main/java/io/joynr/servlet/ServletUtil.java#L56-L68 | train |
bmwcarit/joynr | java/messaging/bounceproxy-controller-service/src/main/java/io/joynr/messaging/service/MigrationServiceRestAdapter.java | MigrationServiceRestAdapter.migrateCluster | @DELETE
@Path("/clusters/{clusterid: ([A-Z,a-z,0-9,_,\\-]+)}")
public Response migrateCluster(@PathParam("clusterid") final String clusterId) {
// as this is a long running task, this has to be asynchronous
migrationService.startClusterMigration(clusterId);
return Response.status(202 /* Accepted */).build();
} | java | @DELETE
@Path("/clusters/{clusterid: ([A-Z,a-z,0-9,_,\\-]+)}")
public Response migrateCluster(@PathParam("clusterid") final String clusterId) {
// as this is a long running task, this has to be asynchronous
migrationService.startClusterMigration(clusterId);
return Response.status(202 /* Accepted */).build();
} | [
"@",
"DELETE",
"@",
"Path",
"(",
"\"/clusters/{clusterid: ([A-Z,a-z,0-9,_,\\\\-]+)}\"",
")",
"public",
"Response",
"migrateCluster",
"(",
"@",
"PathParam",
"(",
"\"clusterid\"",
")",
"final",
"String",
"clusterId",
")",
"{",
"// as this is a long running task, this has to b... | Migrates all bounce proxies of one cluster to a different cluster.
@param clusterId the identifier of the cluster to migrate
@return response with status 202 (accepted) | [
"Migrates",
"all",
"bounce",
"proxies",
"of",
"one",
"cluster",
"to",
"a",
"different",
"cluster",
"."
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/messaging/bounceproxy-controller-service/src/main/java/io/joynr/messaging/service/MigrationServiceRestAdapter.java#L47-L55 | train |
bmwcarit/joynr | java/messaging/bounceproxy/controlled-bounceproxy/src/main/java/io/joynr/messaging/bounceproxy/BounceProxyControllerUrl.java | BounceProxyControllerUrl.buildReportStartupUrl | public String buildReportStartupUrl(ControlledBounceProxyUrl controlledBounceProxyUrl) throws UnsupportedEncodingException {
String url4cc = URLEncoder.encode(controlledBounceProxyUrl.getOwnUrlForClusterControllers(), "UTF-8");
String url4bpc = URLEncoder.encode(controlledBounceProxyUrl.getOwnUrlForBounceProxyController(), "UTF-8");
return baseUrl + //
"?bpid=" + this.bounceProxyId + //
"&url4cc=" + url4cc + //
"&url4bpc=" + url4bpc;
} | java | public String buildReportStartupUrl(ControlledBounceProxyUrl controlledBounceProxyUrl) throws UnsupportedEncodingException {
String url4cc = URLEncoder.encode(controlledBounceProxyUrl.getOwnUrlForClusterControllers(), "UTF-8");
String url4bpc = URLEncoder.encode(controlledBounceProxyUrl.getOwnUrlForBounceProxyController(), "UTF-8");
return baseUrl + //
"?bpid=" + this.bounceProxyId + //
"&url4cc=" + url4cc + //
"&url4bpc=" + url4bpc;
} | [
"public",
"String",
"buildReportStartupUrl",
"(",
"ControlledBounceProxyUrl",
"controlledBounceProxyUrl",
")",
"throws",
"UnsupportedEncodingException",
"{",
"String",
"url4cc",
"=",
"URLEncoder",
".",
"encode",
"(",
"controlledBounceProxyUrl",
".",
"getOwnUrlForClusterControll... | Returns the URL including query parameters to report bounce proxy
startup.
@param controlledBounceProxyUrl
the URL of the bounce proxy
@return the url including encoded query parameters
@throws UnsupportedEncodingException
if urls passed as query parameters could not be encoded
correctly. | [
"Returns",
"the",
"URL",
"including",
"query",
"parameters",
"to",
"report",
"bounce",
"proxy",
"startup",
"."
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/messaging/bounceproxy/controlled-bounceproxy/src/main/java/io/joynr/messaging/bounceproxy/BounceProxyControllerUrl.java#L74-L82 | train |
bmwcarit/joynr | java/messaging/bounceproxy/single-bounceproxy/src/main/java/io/joynr/bounceproxy/service/MessagingWithoutContentTypeService.java | MessagingWithoutContentTypeService.postMessageWithoutContentType | @POST
@Consumes({ MediaType.APPLICATION_OCTET_STREAM })
public Response postMessageWithoutContentType(@PathParam("ccid") String ccid,
byte[] serializedMessage) throws IOException {
ImmutableMessage message;
try {
message = new ImmutableMessage(serializedMessage);
} catch (EncodingException | UnsuppportedVersionException e) {
log.error("Failed to deserialize SMRF message: {}", e.getMessage());
throw new WebApplicationException(e);
}
try {
String msgId = message.getId();
log.debug("******POST message {} to cluster controller: {}", msgId, ccid);
log.trace("******POST message {} to cluster controller: {} extended info: \r\n {}", ccid, message);
response.setCharacterEncoding("UTF-8");
// the location that can be queried to get the message
// status
// TODO REST URL for message status?
String path = longPollingDelegate.postMessage(ccid, serializedMessage);
URI location = ui.getBaseUriBuilder().path(path).build();
// return the message status location to the sender.
return Response.created(location).header("msgId", msgId).build();
} catch (WebApplicationException e) {
log.error("Invalid request from host {}", request.getRemoteHost());
throw e;
} catch (Exception e) {
log.error("POST message for cluster controller: error: {}", e.getMessage());
throw new WebApplicationException(e);
}
} | java | @POST
@Consumes({ MediaType.APPLICATION_OCTET_STREAM })
public Response postMessageWithoutContentType(@PathParam("ccid") String ccid,
byte[] serializedMessage) throws IOException {
ImmutableMessage message;
try {
message = new ImmutableMessage(serializedMessage);
} catch (EncodingException | UnsuppportedVersionException e) {
log.error("Failed to deserialize SMRF message: {}", e.getMessage());
throw new WebApplicationException(e);
}
try {
String msgId = message.getId();
log.debug("******POST message {} to cluster controller: {}", msgId, ccid);
log.trace("******POST message {} to cluster controller: {} extended info: \r\n {}", ccid, message);
response.setCharacterEncoding("UTF-8");
// the location that can be queried to get the message
// status
// TODO REST URL for message status?
String path = longPollingDelegate.postMessage(ccid, serializedMessage);
URI location = ui.getBaseUriBuilder().path(path).build();
// return the message status location to the sender.
return Response.created(location).header("msgId", msgId).build();
} catch (WebApplicationException e) {
log.error("Invalid request from host {}", request.getRemoteHost());
throw e;
} catch (Exception e) {
log.error("POST message for cluster controller: error: {}", e.getMessage());
throw new WebApplicationException(e);
}
} | [
"@",
"POST",
"@",
"Consumes",
"(",
"{",
"MediaType",
".",
"APPLICATION_OCTET_STREAM",
"}",
")",
"public",
"Response",
"postMessageWithoutContentType",
"(",
"@",
"PathParam",
"(",
"\"ccid\"",
")",
"String",
"ccid",
",",
"byte",
"[",
"]",
"serializedMessage",
")",... | Send a message to the given cluster controller like the above method
postMessage
@param ccid the channel id
@param serializedMessage a serialized SMRF message to be sent
@return response builder object with the URL that can be queried to get the message
@throws IOException on I/O error
@throws JsonParseException on parsing problems due to non-well formed content
@throws JsonMappingException on fatal problems with mapping of content | [
"Send",
"a",
"message",
"to",
"the",
"given",
"cluster",
"controller",
"like",
"the",
"above",
"method",
"postMessage"
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/messaging/bounceproxy/single-bounceproxy/src/main/java/io/joynr/bounceproxy/service/MessagingWithoutContentTypeService.java#L85-L121 | train |
bmwcarit/joynr | java/javaapi/src/main/java/io/joynr/pubsub/SubscriptionQos.java | SubscriptionQos.setValidityMs | public SubscriptionQos setValidityMs(final long validityMs) {
if (validityMs == -1) {
setExpiryDateMs(NO_EXPIRY_DATE);
} else {
long now = System.currentTimeMillis();
this.expiryDateMs = now + validityMs;
}
return this;
} | java | public SubscriptionQos setValidityMs(final long validityMs) {
if (validityMs == -1) {
setExpiryDateMs(NO_EXPIRY_DATE);
} else {
long now = System.currentTimeMillis();
this.expiryDateMs = now + validityMs;
}
return this;
} | [
"public",
"SubscriptionQos",
"setValidityMs",
"(",
"final",
"long",
"validityMs",
")",
"{",
"if",
"(",
"validityMs",
"==",
"-",
"1",
")",
"{",
"setExpiryDateMs",
"(",
"NO_EXPIRY_DATE",
")",
";",
"}",
"else",
"{",
"long",
"now",
"=",
"System",
".",
"current... | Set how long the subscription should run for, in milliseconds.
This is a helper method that allows setting the expiryDate using
a relative time.
@param validityMs
is the number of milliseconds until the subscription will expire
@return the subscriptionQos (fluent interface) | [
"Set",
"how",
"long",
"the",
"subscription",
"should",
"run",
"for",
"in",
"milliseconds",
".",
"This",
"is",
"a",
"helper",
"method",
"that",
"allows",
"setting",
"the",
"expiryDate",
"using",
"a",
"relative",
"time",
"."
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/javaapi/src/main/java/io/joynr/pubsub/SubscriptionQos.java#L94-L102 | train |
bmwcarit/joynr | java/messaging/bounceproxy/bounceproxy-common/src/main/java/io/joynr/messaging/bounceproxy/LongPollingMessagingDelegate.java | LongPollingMessagingDelegate.listChannels | public List<ChannelInformation> listChannels() {
LinkedList<ChannelInformation> entries = new LinkedList<ChannelInformation>();
Collection<Broadcaster> broadcasters = BroadcasterFactory.getDefault().lookupAll();
String name;
for (Broadcaster broadcaster : broadcasters) {
if (broadcaster instanceof BounceProxyBroadcaster) {
name = ((BounceProxyBroadcaster) broadcaster).getName();
} else {
name = broadcaster.getClass().getSimpleName();
}
Integer cachedSize = null;
entries.add(new ChannelInformation(name, broadcaster.getAtmosphereResources().size(), cachedSize));
}
return entries;
} | java | public List<ChannelInformation> listChannels() {
LinkedList<ChannelInformation> entries = new LinkedList<ChannelInformation>();
Collection<Broadcaster> broadcasters = BroadcasterFactory.getDefault().lookupAll();
String name;
for (Broadcaster broadcaster : broadcasters) {
if (broadcaster instanceof BounceProxyBroadcaster) {
name = ((BounceProxyBroadcaster) broadcaster).getName();
} else {
name = broadcaster.getClass().getSimpleName();
}
Integer cachedSize = null;
entries.add(new ChannelInformation(name, broadcaster.getAtmosphereResources().size(), cachedSize));
}
return entries;
} | [
"public",
"List",
"<",
"ChannelInformation",
">",
"listChannels",
"(",
")",
"{",
"LinkedList",
"<",
"ChannelInformation",
">",
"entries",
"=",
"new",
"LinkedList",
"<",
"ChannelInformation",
">",
"(",
")",
";",
"Collection",
"<",
"Broadcaster",
">",
"broadcaster... | Gets a list of all channel information.
@return list of all channel informations | [
"Gets",
"a",
"list",
"of",
"all",
"channel",
"information",
"."
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/messaging/bounceproxy/bounceproxy-common/src/main/java/io/joynr/messaging/bounceproxy/LongPollingMessagingDelegate.java#L66-L82 | train |
bmwcarit/joynr | java/messaging/bounceproxy/bounceproxy-common/src/main/java/io/joynr/messaging/bounceproxy/LongPollingMessagingDelegate.java | LongPollingMessagingDelegate.createChannel | public String createChannel(String ccid, String atmosphereTrackingId) {
throwExceptionIfTrackingIdnotSet(atmosphereTrackingId);
log.info("CREATE channel for cluster controller: {} trackingId: {} ", ccid, atmosphereTrackingId);
Broadcaster broadcaster = null;
// look for an existing broadcaster
BroadcasterFactory defaultBroadcasterFactory = BroadcasterFactory.getDefault();
if (defaultBroadcasterFactory == null) {
throw new JoynrHttpException(500, 10009, "broadcaster was null");
}
broadcaster = defaultBroadcasterFactory.lookup(Broadcaster.class, ccid, false);
// create a new one if none already exists
if (broadcaster == null) {
broadcaster = defaultBroadcasterFactory.get(BounceProxyBroadcaster.class, ccid);
}
// avoids error where previous long poll from browser got message
// destined for new long poll
// especially as seen in js, where every second refresh caused a fail
for (AtmosphereResource resource : broadcaster.getAtmosphereResources()) {
if (resource.uuid() != null && resource.uuid().equals(atmosphereTrackingId)) {
resource.resume();
}
}
UUIDBroadcasterCache broadcasterCache = (UUIDBroadcasterCache) broadcaster.getBroadcasterConfig()
.getBroadcasterCache();
broadcasterCache.activeClients().put(atmosphereTrackingId, System.currentTimeMillis());
// BroadcasterCacheInspector is not implemented corrected in Atmosphere
// 1.1.0RC4
// broadcasterCache.inspector(new MessageExpirationInspector());
return "/channels/" + ccid + "/";
} | java | public String createChannel(String ccid, String atmosphereTrackingId) {
throwExceptionIfTrackingIdnotSet(atmosphereTrackingId);
log.info("CREATE channel for cluster controller: {} trackingId: {} ", ccid, atmosphereTrackingId);
Broadcaster broadcaster = null;
// look for an existing broadcaster
BroadcasterFactory defaultBroadcasterFactory = BroadcasterFactory.getDefault();
if (defaultBroadcasterFactory == null) {
throw new JoynrHttpException(500, 10009, "broadcaster was null");
}
broadcaster = defaultBroadcasterFactory.lookup(Broadcaster.class, ccid, false);
// create a new one if none already exists
if (broadcaster == null) {
broadcaster = defaultBroadcasterFactory.get(BounceProxyBroadcaster.class, ccid);
}
// avoids error where previous long poll from browser got message
// destined for new long poll
// especially as seen in js, where every second refresh caused a fail
for (AtmosphereResource resource : broadcaster.getAtmosphereResources()) {
if (resource.uuid() != null && resource.uuid().equals(atmosphereTrackingId)) {
resource.resume();
}
}
UUIDBroadcasterCache broadcasterCache = (UUIDBroadcasterCache) broadcaster.getBroadcasterConfig()
.getBroadcasterCache();
broadcasterCache.activeClients().put(atmosphereTrackingId, System.currentTimeMillis());
// BroadcasterCacheInspector is not implemented corrected in Atmosphere
// 1.1.0RC4
// broadcasterCache.inspector(new MessageExpirationInspector());
return "/channels/" + ccid + "/";
} | [
"public",
"String",
"createChannel",
"(",
"String",
"ccid",
",",
"String",
"atmosphereTrackingId",
")",
"{",
"throwExceptionIfTrackingIdnotSet",
"(",
"atmosphereTrackingId",
")",
";",
"log",
".",
"info",
"(",
"\"CREATE channel for cluster controller: {} trackingId: {} \"",
... | Creates a long polling channel.
@param ccid
the identifier of the channel
@param atmosphereTrackingId
the tracking ID of the channel
@return the path segment for the channel. The path, appended to the base
URI of the channel service, can be used to post messages to the
channel. | [
"Creates",
"a",
"long",
"polling",
"channel",
"."
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/messaging/bounceproxy/bounceproxy-common/src/main/java/io/joynr/messaging/bounceproxy/LongPollingMessagingDelegate.java#L95-L133 | train |
bmwcarit/joynr | java/messaging/bounceproxy/bounceproxy-common/src/main/java/io/joynr/messaging/bounceproxy/LongPollingMessagingDelegate.java | LongPollingMessagingDelegate.deleteChannel | public boolean deleteChannel(String ccid) {
log.info("DELETE channel for cluster controller: " + ccid);
Broadcaster broadcaster = BroadcasterFactory.getDefault().lookup(Broadcaster.class, ccid, false);
if (broadcaster == null) {
return false;
}
BroadcasterFactory.getDefault().remove(ccid);
broadcaster.resumeAll();
broadcaster.destroy();
// broadcaster.getBroadcasterConfig().forceDestroy();
return true;
} | java | public boolean deleteChannel(String ccid) {
log.info("DELETE channel for cluster controller: " + ccid);
Broadcaster broadcaster = BroadcasterFactory.getDefault().lookup(Broadcaster.class, ccid, false);
if (broadcaster == null) {
return false;
}
BroadcasterFactory.getDefault().remove(ccid);
broadcaster.resumeAll();
broadcaster.destroy();
// broadcaster.getBroadcasterConfig().forceDestroy();
return true;
} | [
"public",
"boolean",
"deleteChannel",
"(",
"String",
"ccid",
")",
"{",
"log",
".",
"info",
"(",
"\"DELETE channel for cluster controller: \"",
"+",
"ccid",
")",
";",
"Broadcaster",
"broadcaster",
"=",
"BroadcasterFactory",
".",
"getDefault",
"(",
")",
".",
"lookup... | Deletes a channel from the broadcaster.
@param ccid
the channel to delete
@return <code>true</code> if the channel existed and could be deleted,
<code>false</code> if there was no channel for the given ID and
therefore could not be deleted. | [
"Deletes",
"a",
"channel",
"from",
"the",
"broadcaster",
"."
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/messaging/bounceproxy/bounceproxy-common/src/main/java/io/joynr/messaging/bounceproxy/LongPollingMessagingDelegate.java#L144-L157 | train |
bmwcarit/joynr | java/messaging/bounceproxy/bounceproxy-common/src/main/java/io/joynr/messaging/bounceproxy/LongPollingMessagingDelegate.java | LongPollingMessagingDelegate.postMessage | public String postMessage(String ccid, byte[] serializedMessage) {
ImmutableMessage message;
try {
message = new ImmutableMessage(serializedMessage);
} catch (EncodingException | UnsuppportedVersionException e) {
throw new JoynrHttpException(Status.BAD_REQUEST, JOYNRMESSAGINGERROR_DESERIALIZATIONFAILED);
}
if (ccid == null) {
log.error("POST message {} to cluster controller: NULL. Dropped because: channel Id was not set.",
message.getId());
throw new JoynrHttpException(Status.BAD_REQUEST, JOYNRMESSAGINGERROR_CHANNELNOTSET);
}
// send the message to the receiver.
if (message.getTtlMs() == 0) {
log.error("POST message {} to cluster controller: {} dropped because: expiry date not set",
ccid,
message.getId());
throw new JoynrHttpException(Status.BAD_REQUEST, JOYNRMESSAGINGERROR_EXPIRYDATENOTSET);
}
// Relative TTLs are not supported yet.
if (!message.isTtlAbsolute()) {
throw new JoynrHttpException(Status.BAD_REQUEST, JOYNRMESSAGINGERROR_RELATIVE_TTL_UNSPORTED);
}
if (message.getTtlMs() < System.currentTimeMillis()) {
log.warn("POST message {} to cluster controller: {} dropped because: TTL expired", ccid, message.getId());
throw new JoynrHttpException(Status.BAD_REQUEST, JOYNRMESSAGINGERROR_EXPIRYDATEEXPIRED);
}
// look for an existing broadcaster
Broadcaster ccBroadcaster = BroadcasterFactory.getDefault().lookup(Broadcaster.class, ccid, false);
if (ccBroadcaster == null) {
// if the receiver has never registered with the bounceproxy
// (or his registration has expired) then return 204 no
// content.
log.error("POST message {} to cluster controller: {} dropped because: no channel found",
ccid,
message.getId());
throw new JoynrHttpException(Status.BAD_REQUEST, JOYNRMESSAGINGERROR_CHANNELNOTFOUND);
}
if (ccBroadcaster.getAtmosphereResources().size() == 0) {
log.debug("no poll currently waiting for channelId: {}", ccid);
}
ccBroadcaster.broadcast(message);
return "messages/" + message.getId();
} | java | public String postMessage(String ccid, byte[] serializedMessage) {
ImmutableMessage message;
try {
message = new ImmutableMessage(serializedMessage);
} catch (EncodingException | UnsuppportedVersionException e) {
throw new JoynrHttpException(Status.BAD_REQUEST, JOYNRMESSAGINGERROR_DESERIALIZATIONFAILED);
}
if (ccid == null) {
log.error("POST message {} to cluster controller: NULL. Dropped because: channel Id was not set.",
message.getId());
throw new JoynrHttpException(Status.BAD_REQUEST, JOYNRMESSAGINGERROR_CHANNELNOTSET);
}
// send the message to the receiver.
if (message.getTtlMs() == 0) {
log.error("POST message {} to cluster controller: {} dropped because: expiry date not set",
ccid,
message.getId());
throw new JoynrHttpException(Status.BAD_REQUEST, JOYNRMESSAGINGERROR_EXPIRYDATENOTSET);
}
// Relative TTLs are not supported yet.
if (!message.isTtlAbsolute()) {
throw new JoynrHttpException(Status.BAD_REQUEST, JOYNRMESSAGINGERROR_RELATIVE_TTL_UNSPORTED);
}
if (message.getTtlMs() < System.currentTimeMillis()) {
log.warn("POST message {} to cluster controller: {} dropped because: TTL expired", ccid, message.getId());
throw new JoynrHttpException(Status.BAD_REQUEST, JOYNRMESSAGINGERROR_EXPIRYDATEEXPIRED);
}
// look for an existing broadcaster
Broadcaster ccBroadcaster = BroadcasterFactory.getDefault().lookup(Broadcaster.class, ccid, false);
if (ccBroadcaster == null) {
// if the receiver has never registered with the bounceproxy
// (or his registration has expired) then return 204 no
// content.
log.error("POST message {} to cluster controller: {} dropped because: no channel found",
ccid,
message.getId());
throw new JoynrHttpException(Status.BAD_REQUEST, JOYNRMESSAGINGERROR_CHANNELNOTFOUND);
}
if (ccBroadcaster.getAtmosphereResources().size() == 0) {
log.debug("no poll currently waiting for channelId: {}", ccid);
}
ccBroadcaster.broadcast(message);
return "messages/" + message.getId();
} | [
"public",
"String",
"postMessage",
"(",
"String",
"ccid",
",",
"byte",
"[",
"]",
"serializedMessage",
")",
"{",
"ImmutableMessage",
"message",
";",
"try",
"{",
"message",
"=",
"new",
"ImmutableMessage",
"(",
"serializedMessage",
")",
";",
"}",
"catch",
"(",
... | Posts a message to a long polling channel.
@param ccid
the identifier of the long polling channel
@param serializedMessage
the message to send serialized as a SMRF message
@return the path segment for the message status. The path, appended to
the base URI of the messaging service, can be used to query the
message status
@throws JoynrHttpException
if one of:
<ul>
<li>ccid is not set</li>
<li>the message has expired or not expiry date is set</li>
<li>no channel registered for ccid</li>
</ul> | [
"Posts",
"a",
"message",
"to",
"a",
"long",
"polling",
"channel",
"."
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/messaging/bounceproxy/bounceproxy-common/src/main/java/io/joynr/messaging/bounceproxy/LongPollingMessagingDelegate.java#L212-L264 | train |
bmwcarit/joynr | java/core/clustercontroller/src/main/java/io/joynr/capabilities/LocalCapabilitiesDirectoryImpl.java | LocalCapabilitiesDirectoryImpl.asyncGetGlobalCapabilitities | private void asyncGetGlobalCapabilitities(final String[] domains,
final String interfaceName,
Collection<DiscoveryEntryWithMetaInfo> localDiscoveryEntries2,
long discoveryTimeout,
final CapabilitiesCallback capabilitiesCallback) {
final Collection<DiscoveryEntryWithMetaInfo> localDiscoveryEntries = localDiscoveryEntries2 == null
? new LinkedList<DiscoveryEntryWithMetaInfo>()
: localDiscoveryEntries2;
globalCapabilitiesDirectoryClient.lookup(new Callback<List<GlobalDiscoveryEntry>>() {
@Override
public void onSuccess(List<GlobalDiscoveryEntry> globalDiscoverEntries) {
if (globalDiscoverEntries != null) {
registerIncomingEndpoints(globalDiscoverEntries);
globalDiscoveryEntryCache.add(globalDiscoverEntries);
Collection<DiscoveryEntryWithMetaInfo> allDisoveryEntries = new ArrayList<DiscoveryEntryWithMetaInfo>(globalDiscoverEntries.size()
+ localDiscoveryEntries.size());
allDisoveryEntries.addAll(CapabilityUtils.convertToDiscoveryEntryWithMetaInfoList(false,
globalDiscoverEntries));
allDisoveryEntries.addAll(localDiscoveryEntries);
capabilitiesCallback.processCapabilitiesReceived(allDisoveryEntries);
} else {
capabilitiesCallback.onError(new NullPointerException("Received capabilities are null"));
}
}
@Override
public void onFailure(JoynrRuntimeException exception) {
capabilitiesCallback.onError(exception);
}
}, domains, interfaceName, discoveryTimeout);
} | java | private void asyncGetGlobalCapabilitities(final String[] domains,
final String interfaceName,
Collection<DiscoveryEntryWithMetaInfo> localDiscoveryEntries2,
long discoveryTimeout,
final CapabilitiesCallback capabilitiesCallback) {
final Collection<DiscoveryEntryWithMetaInfo> localDiscoveryEntries = localDiscoveryEntries2 == null
? new LinkedList<DiscoveryEntryWithMetaInfo>()
: localDiscoveryEntries2;
globalCapabilitiesDirectoryClient.lookup(new Callback<List<GlobalDiscoveryEntry>>() {
@Override
public void onSuccess(List<GlobalDiscoveryEntry> globalDiscoverEntries) {
if (globalDiscoverEntries != null) {
registerIncomingEndpoints(globalDiscoverEntries);
globalDiscoveryEntryCache.add(globalDiscoverEntries);
Collection<DiscoveryEntryWithMetaInfo> allDisoveryEntries = new ArrayList<DiscoveryEntryWithMetaInfo>(globalDiscoverEntries.size()
+ localDiscoveryEntries.size());
allDisoveryEntries.addAll(CapabilityUtils.convertToDiscoveryEntryWithMetaInfoList(false,
globalDiscoverEntries));
allDisoveryEntries.addAll(localDiscoveryEntries);
capabilitiesCallback.processCapabilitiesReceived(allDisoveryEntries);
} else {
capabilitiesCallback.onError(new NullPointerException("Received capabilities are null"));
}
}
@Override
public void onFailure(JoynrRuntimeException exception) {
capabilitiesCallback.onError(exception);
}
}, domains, interfaceName, discoveryTimeout);
} | [
"private",
"void",
"asyncGetGlobalCapabilitities",
"(",
"final",
"String",
"[",
"]",
"domains",
",",
"final",
"String",
"interfaceName",
",",
"Collection",
"<",
"DiscoveryEntryWithMetaInfo",
">",
"localDiscoveryEntries2",
",",
"long",
"discoveryTimeout",
",",
"final",
... | mixes in the localDiscoveryEntries to global capabilities found by participantId | [
"mixes",
"in",
"the",
"localDiscoveryEntries",
"to",
"global",
"capabilities",
"found",
"by",
"participantId"
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/core/clustercontroller/src/main/java/io/joynr/capabilities/LocalCapabilitiesDirectoryImpl.java#L610-L643 | train |
bmwcarit/joynr | java/messaging/messaging-common/src/main/java/io/joynr/messaging/util/Utilities.java | Utilities.isSessionEncodedInUrl | public static boolean isSessionEncodedInUrl(String encodedUrl, String sessionIdName) {
int sessionIdIndex = encodedUrl.indexOf(getSessionIdSubstring(sessionIdName));
return sessionIdIndex >= 0;
} | java | public static boolean isSessionEncodedInUrl(String encodedUrl, String sessionIdName) {
int sessionIdIndex = encodedUrl.indexOf(getSessionIdSubstring(sessionIdName));
return sessionIdIndex >= 0;
} | [
"public",
"static",
"boolean",
"isSessionEncodedInUrl",
"(",
"String",
"encodedUrl",
",",
"String",
"sessionIdName",
")",
"{",
"int",
"sessionIdIndex",
"=",
"encodedUrl",
".",
"indexOf",
"(",
"getSessionIdSubstring",
"(",
"sessionIdName",
")",
")",
";",
"return",
... | Returns whether the session ID is encoded into the URL.
@param encodedUrl
the url to check
@param sessionIdName
the name of the session ID, e.g. jsessionid
@return boolean value, true if session ID is encoded into the URL. | [
"Returns",
"whether",
"the",
"session",
"ID",
"is",
"encoded",
"into",
"the",
"URL",
"."
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/messaging/messaging-common/src/main/java/io/joynr/messaging/util/Utilities.java#L123-L126 | train |
bmwcarit/joynr | java/messaging/messaging-common/src/main/java/io/joynr/messaging/util/Utilities.java | Utilities.getUrlWithoutSessionId | public static String getUrlWithoutSessionId(String url, String sessionIdName) {
if (isSessionEncodedInUrl(url, sessionIdName)) {
return url.substring(0, url.indexOf(getSessionIdSubstring(sessionIdName)));
}
return url;
} | java | public static String getUrlWithoutSessionId(String url, String sessionIdName) {
if (isSessionEncodedInUrl(url, sessionIdName)) {
return url.substring(0, url.indexOf(getSessionIdSubstring(sessionIdName)));
}
return url;
} | [
"public",
"static",
"String",
"getUrlWithoutSessionId",
"(",
"String",
"url",
",",
"String",
"sessionIdName",
")",
"{",
"if",
"(",
"isSessionEncodedInUrl",
"(",
"url",
",",
"sessionIdName",
")",
")",
"{",
"return",
"url",
".",
"substring",
"(",
"0",
",",
"ur... | Returns the URL without the session encoded into the URL.
@param url
the url to de-code
@param sessionIdName
the name of the session ID, e.g. jsessionid
@return url without session id information or url, if no session was
encoded into the URL | [
"Returns",
"the",
"URL",
"without",
"the",
"session",
"encoded",
"into",
"the",
"URL",
"."
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/messaging/messaging-common/src/main/java/io/joynr/messaging/util/Utilities.java#L138-L144 | train |
bmwcarit/joynr | java/messaging/messaging-common/src/main/java/io/joynr/messaging/util/Utilities.java | Utilities.getSessionEncodedUrl | public static String getSessionEncodedUrl(String url, String sessionIdName, String sessionId) {
return url + getSessionIdSubstring(sessionIdName) + sessionId;
} | java | public static String getSessionEncodedUrl(String url, String sessionIdName, String sessionId) {
return url + getSessionIdSubstring(sessionIdName) + sessionId;
} | [
"public",
"static",
"String",
"getSessionEncodedUrl",
"(",
"String",
"url",
",",
"String",
"sessionIdName",
",",
"String",
"sessionId",
")",
"{",
"return",
"url",
"+",
"getSessionIdSubstring",
"(",
"sessionIdName",
")",
"+",
"sessionId",
";",
"}"
] | Returns a url with the session encoded into the URL
@param url the URL to encode
@param sessionIdName the name of the session ID, e.g. jsessionid
@param sessionId the session ID
@return URL with the session encoded into the URL | [
"Returns",
"a",
"url",
"with",
"the",
"session",
"encoded",
"into",
"the",
"URL"
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/messaging/messaging-common/src/main/java/io/joynr/messaging/util/Utilities.java#L181-L183 | train |
bmwcarit/joynr | java/core/libjoynr/src/main/java/io/joynr/dispatching/subscription/PublicationManagerImpl.java | PublicationManagerImpl.stopPublicationByProviderId | private void stopPublicationByProviderId(String providerParticipantId) {
for (PublicationInformation publicationInformation : subscriptionId2PublicationInformation.values()) {
if (publicationInformation.getProviderParticipantId().equals(providerParticipantId)) {
removePublication(publicationInformation.getSubscriptionId());
}
}
if (providerParticipantId != null && queuedSubscriptionRequests.containsKey(providerParticipantId)) {
queuedSubscriptionRequests.removeAll(providerParticipantId);
}
} | java | private void stopPublicationByProviderId(String providerParticipantId) {
for (PublicationInformation publicationInformation : subscriptionId2PublicationInformation.values()) {
if (publicationInformation.getProviderParticipantId().equals(providerParticipantId)) {
removePublication(publicationInformation.getSubscriptionId());
}
}
if (providerParticipantId != null && queuedSubscriptionRequests.containsKey(providerParticipantId)) {
queuedSubscriptionRequests.removeAll(providerParticipantId);
}
} | [
"private",
"void",
"stopPublicationByProviderId",
"(",
"String",
"providerParticipantId",
")",
"{",
"for",
"(",
"PublicationInformation",
"publicationInformation",
":",
"subscriptionId2PublicationInformation",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"publicationInfo... | Stops all publications for a provider
@param providerParticipantId provider for which all publication should be stopped | [
"Stops",
"all",
"publications",
"for",
"a",
"provider"
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/core/libjoynr/src/main/java/io/joynr/dispatching/subscription/PublicationManagerImpl.java#L576-L586 | train |
bmwcarit/joynr | java/core/libjoynr/src/main/java/io/joynr/dispatching/subscription/PublicationManagerImpl.java | PublicationManagerImpl.restoreQueuedSubscription | private void restoreQueuedSubscription(String providerId, ProviderContainer providerContainer) {
Collection<PublicationInformation> queuedRequests = queuedSubscriptionRequests.get(providerId);
Iterator<PublicationInformation> queuedRequestsIterator = queuedRequests.iterator();
while (queuedRequestsIterator.hasNext()) {
PublicationInformation publicationInformation = queuedRequestsIterator.next();
queuedRequestsIterator.remove();
if (!isExpired(publicationInformation)) {
addSubscriptionRequest(publicationInformation.getProxyParticipantId(),
publicationInformation.getProviderParticipantId(),
publicationInformation.subscriptionRequest,
providerContainer);
}
}
} | java | private void restoreQueuedSubscription(String providerId, ProviderContainer providerContainer) {
Collection<PublicationInformation> queuedRequests = queuedSubscriptionRequests.get(providerId);
Iterator<PublicationInformation> queuedRequestsIterator = queuedRequests.iterator();
while (queuedRequestsIterator.hasNext()) {
PublicationInformation publicationInformation = queuedRequestsIterator.next();
queuedRequestsIterator.remove();
if (!isExpired(publicationInformation)) {
addSubscriptionRequest(publicationInformation.getProxyParticipantId(),
publicationInformation.getProviderParticipantId(),
publicationInformation.subscriptionRequest,
providerContainer);
}
}
} | [
"private",
"void",
"restoreQueuedSubscription",
"(",
"String",
"providerId",
",",
"ProviderContainer",
"providerContainer",
")",
"{",
"Collection",
"<",
"PublicationInformation",
">",
"queuedRequests",
"=",
"queuedSubscriptionRequests",
".",
"get",
"(",
"providerId",
")",... | Called every time a provider is registered to check whether there are already
subscriptionRequests waiting.
@param providerId provider id
@param providerContainer provider container | [
"Called",
"every",
"time",
"a",
"provider",
"is",
"registered",
"to",
"check",
"whether",
"there",
"are",
"already",
"subscriptionRequests",
"waiting",
"."
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/core/libjoynr/src/main/java/io/joynr/dispatching/subscription/PublicationManagerImpl.java#L602-L615 | train |
bmwcarit/joynr | java/messaging/bounceproxy/bounceproxy-controller/src/main/java/io/joynr/messaging/bounceproxy/controller/util/ChannelUrlUtil.java | ChannelUrlUtil.createChannelLocation | public static URI createChannelLocation(ControlledBounceProxyInformation bpInfo, String ccid, URI location) {
return URI.create(location.toString() + ";jsessionid=." + bpInfo.getInstanceId());
} | java | public static URI createChannelLocation(ControlledBounceProxyInformation bpInfo, String ccid, URI location) {
return URI.create(location.toString() + ";jsessionid=." + bpInfo.getInstanceId());
} | [
"public",
"static",
"URI",
"createChannelLocation",
"(",
"ControlledBounceProxyInformation",
"bpInfo",
",",
"String",
"ccid",
",",
"URI",
"location",
")",
"{",
"return",
"URI",
".",
"create",
"(",
"location",
".",
"toString",
"(",
")",
"+",
"\";jsessionid=.\"",
... | Creates the channel location that is returned to the cluster controller.
This includes tweaking of the URL for example to contain a session ID.
@param bpInfo
information of the bounce proxy
@param ccid
channel identifier
@param location
the channel URL as returned by the bounce proxy instance that
created the channel
@return channel url that can be used by cluster controllers to do
messaging on the created channel | [
"Creates",
"the",
"channel",
"location",
"that",
"is",
"returned",
"to",
"the",
"cluster",
"controller",
".",
"This",
"includes",
"tweaking",
"of",
"the",
"URL",
"for",
"example",
"to",
"contain",
"a",
"session",
"ID",
"."
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/messaging/bounceproxy/bounceproxy-controller/src/main/java/io/joynr/messaging/bounceproxy/controller/util/ChannelUrlUtil.java#L48-L51 | train |
bmwcarit/joynr | java/messaging/channel-service/src/main/java/io/joynr/messaging/service/ChannelServiceRestAdapter.java | ChannelServiceRestAdapter.listChannels | @GET
@Produces("application/json")
public GenericEntity<List<ChannelInformation>> listChannels() {
try {
return new GenericEntity<List<ChannelInformation>>(channelService.listChannels()) {
};
} catch (Exception e) {
log.error("GET channels listChannels: error: {}", e.getMessage(), e);
throw new WebApplicationException(Status.INTERNAL_SERVER_ERROR);
}
} | java | @GET
@Produces("application/json")
public GenericEntity<List<ChannelInformation>> listChannels() {
try {
return new GenericEntity<List<ChannelInformation>>(channelService.listChannels()) {
};
} catch (Exception e) {
log.error("GET channels listChannels: error: {}", e.getMessage(), e);
throw new WebApplicationException(Status.INTERNAL_SERVER_ERROR);
}
} | [
"@",
"GET",
"@",
"Produces",
"(",
"\"application/json\"",
")",
"public",
"GenericEntity",
"<",
"List",
"<",
"ChannelInformation",
">",
">",
"listChannels",
"(",
")",
"{",
"try",
"{",
"return",
"new",
"GenericEntity",
"<",
"List",
"<",
"ChannelInformation",
">"... | A simple HTML list view of channels. A JSP is used for rendering.
@return a HTML list of available channels, and their resources (long poll
connections) if connected. | [
"A",
"simple",
"HTML",
"list",
"view",
"of",
"channels",
".",
"A",
"JSP",
"is",
"used",
"for",
"rendering",
"."
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/messaging/channel-service/src/main/java/io/joynr/messaging/service/ChannelServiceRestAdapter.java#L81-L91 | train |
bmwcarit/joynr | java/messaging/channel-service/src/main/java/io/joynr/messaging/service/ChannelServiceRestAdapter.java | ChannelServiceRestAdapter.open | @GET
@Path("/{ccid: [A-Z,a-z,0-9,_,\\-,\\.]+}")
@Produces({ MediaType.APPLICATION_JSON })
@Suspend(resumeOnBroadcast = true, period = ChannelServiceConstants.EXPIRE_TIME_CONNECTION,
timeUnit = TimeUnit.SECONDS, contentType = MediaType.APPLICATION_JSON)
public Broadcastable open(@PathParam("ccid") String ccid,
@HeaderParam("X-Cache-Index") Integer cacheIndex,
@HeaderParam(ChannelServiceConstants.X_ATMOSPHERE_TRACKING_ID) String atmosphereTrackingId) {
try {
return channelService.openChannel(ccid, cacheIndex, atmosphereTrackingId);
} catch (WebApplicationException e) {
throw e;
} catch (Exception e) {
log.error("GET Channels open long poll ccid: error: {}", e.getMessage(), e);
throw new WebApplicationException(Status.INTERNAL_SERVER_ERROR);
}
} | java | @GET
@Path("/{ccid: [A-Z,a-z,0-9,_,\\-,\\.]+}")
@Produces({ MediaType.APPLICATION_JSON })
@Suspend(resumeOnBroadcast = true, period = ChannelServiceConstants.EXPIRE_TIME_CONNECTION,
timeUnit = TimeUnit.SECONDS, contentType = MediaType.APPLICATION_JSON)
public Broadcastable open(@PathParam("ccid") String ccid,
@HeaderParam("X-Cache-Index") Integer cacheIndex,
@HeaderParam(ChannelServiceConstants.X_ATMOSPHERE_TRACKING_ID) String atmosphereTrackingId) {
try {
return channelService.openChannel(ccid, cacheIndex, atmosphereTrackingId);
} catch (WebApplicationException e) {
throw e;
} catch (Exception e) {
log.error("GET Channels open long poll ccid: error: {}", e.getMessage(), e);
throw new WebApplicationException(Status.INTERNAL_SERVER_ERROR);
}
} | [
"@",
"GET",
"@",
"Path",
"(",
"\"/{ccid: [A-Z,a-z,0-9,_,\\\\-,\\\\.]+}\"",
")",
"@",
"Produces",
"(",
"{",
"MediaType",
".",
"APPLICATION_JSON",
"}",
")",
"@",
"Suspend",
"(",
"resumeOnBroadcast",
"=",
"true",
",",
"period",
"=",
"ChannelServiceConstants",
".",
... | Open a long poll channel for the given cluster controller.
The channel is closed automatically by the server at
regular intervals to ensure liveliness.
@param ccid cluster controller id
@param cacheIndex cache index
@param atmosphereTrackingId the tracking for atmosphere
@return new message(s), or nothing if the channel is closed by the servr | [
"Open",
"a",
"long",
"poll",
"channel",
"for",
"the",
"given",
"cluster",
"controller",
".",
"The",
"channel",
"is",
"closed",
"automatically",
"by",
"the",
"server",
"at",
"regular",
"intervals",
"to",
"ensure",
"liveliness",
"."
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/messaging/channel-service/src/main/java/io/joynr/messaging/service/ChannelServiceRestAdapter.java#L103-L120 | train |
bmwcarit/joynr | java/messaging/channel-service/src/main/java/io/joynr/messaging/service/ChannelServiceRestAdapter.java | ChannelServiceRestAdapter.createChannel | @POST
@Produces({ MediaType.TEXT_PLAIN })
public Response createChannel(@QueryParam("ccid") String ccid,
@HeaderParam(ChannelServiceConstants.X_ATMOSPHERE_TRACKING_ID) String atmosphereTrackingId) {
try {
log.info("CREATE channel for channel ID: {}", ccid);
if (ccid == null || ccid.isEmpty())
throw new JoynrHttpException(Status.BAD_REQUEST, JOYNRMESSAGINGERROR_CHANNELNOTSET);
Channel channel = channelService.getChannel(ccid);
if (channel != null) {
String encodedChannelLocation = response.encodeURL(channel.getLocation().toString());
return Response.ok()
.entity(encodedChannelLocation)
.header("Location", encodedChannelLocation)
.header("bp", channel.getBounceProxy().getId())
.build();
}
// look for an existing bounce proxy handling the channel
channel = channelService.createChannel(ccid, atmosphereTrackingId);
String encodedChannelLocation = response.encodeURL(channel.getLocation().toString());
log.debug("encoded channel URL " + channel.getLocation() + " to " + encodedChannelLocation);
return Response.created(URI.create(encodedChannelLocation))
.entity(encodedChannelLocation)
.header("bp", channel.getBounceProxy().getId())
.build();
} catch (WebApplicationException ex) {
throw ex;
} catch (Exception e) {
throw new WebApplicationException(e);
}
} | java | @POST
@Produces({ MediaType.TEXT_PLAIN })
public Response createChannel(@QueryParam("ccid") String ccid,
@HeaderParam(ChannelServiceConstants.X_ATMOSPHERE_TRACKING_ID) String atmosphereTrackingId) {
try {
log.info("CREATE channel for channel ID: {}", ccid);
if (ccid == null || ccid.isEmpty())
throw new JoynrHttpException(Status.BAD_REQUEST, JOYNRMESSAGINGERROR_CHANNELNOTSET);
Channel channel = channelService.getChannel(ccid);
if (channel != null) {
String encodedChannelLocation = response.encodeURL(channel.getLocation().toString());
return Response.ok()
.entity(encodedChannelLocation)
.header("Location", encodedChannelLocation)
.header("bp", channel.getBounceProxy().getId())
.build();
}
// look for an existing bounce proxy handling the channel
channel = channelService.createChannel(ccid, atmosphereTrackingId);
String encodedChannelLocation = response.encodeURL(channel.getLocation().toString());
log.debug("encoded channel URL " + channel.getLocation() + " to " + encodedChannelLocation);
return Response.created(URI.create(encodedChannelLocation))
.entity(encodedChannelLocation)
.header("bp", channel.getBounceProxy().getId())
.build();
} catch (WebApplicationException ex) {
throw ex;
} catch (Exception e) {
throw new WebApplicationException(e);
}
} | [
"@",
"POST",
"@",
"Produces",
"(",
"{",
"MediaType",
".",
"TEXT_PLAIN",
"}",
")",
"public",
"Response",
"createChannel",
"(",
"@",
"QueryParam",
"(",
"\"ccid\"",
")",
"String",
"ccid",
",",
"@",
"HeaderParam",
"(",
"ChannelServiceConstants",
".",
"X_ATMOSPHERE... | HTTP POST to create a channel, returns location to new resource which can
then be long polled. Since the channel id may later change to be a UUID,
not using a PUT but rather POST with used id being returned
@param ccid cluster controller id
@param atmosphereTrackingId tracking id for atmosphere
@return location to new resource | [
"HTTP",
"POST",
"to",
"create",
"a",
"channel",
"returns",
"location",
"to",
"new",
"resource",
"which",
"can",
"then",
"be",
"long",
"polled",
".",
"Since",
"the",
"channel",
"id",
"may",
"later",
"change",
"to",
"be",
"a",
"UUID",
"not",
"using",
"a",
... | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/messaging/channel-service/src/main/java/io/joynr/messaging/service/ChannelServiceRestAdapter.java#L130-L168 | train |
bmwcarit/joynr | java/messaging/channel-service/src/main/java/io/joynr/messaging/service/ChannelServiceRestAdapter.java | ChannelServiceRestAdapter.deleteChannel | @DELETE
@Path("/{ccid: [A-Z,a-z,0-9,_,\\-,\\.]+}")
public Response deleteChannel(@PathParam("ccid") String ccid) {
try {
log.info("DELETE channel for cluster controller: {}", ccid);
if (channelService.deleteChannel(ccid)) {
return Response.ok().build();
}
return Response.noContent().build();
} catch (WebApplicationException e) {
throw e;
} catch (Exception e) {
log.error("DELETE channel for cluster controller: error: {}", e.getMessage(), e);
throw new WebApplicationException(Status.INTERNAL_SERVER_ERROR);
}
} | java | @DELETE
@Path("/{ccid: [A-Z,a-z,0-9,_,\\-,\\.]+}")
public Response deleteChannel(@PathParam("ccid") String ccid) {
try {
log.info("DELETE channel for cluster controller: {}", ccid);
if (channelService.deleteChannel(ccid)) {
return Response.ok().build();
}
return Response.noContent().build();
} catch (WebApplicationException e) {
throw e;
} catch (Exception e) {
log.error("DELETE channel for cluster controller: error: {}", e.getMessage(), e);
throw new WebApplicationException(Status.INTERNAL_SERVER_ERROR);
}
} | [
"@",
"DELETE",
"@",
"Path",
"(",
"\"/{ccid: [A-Z,a-z,0-9,_,\\\\-,\\\\.]+}\"",
")",
"public",
"Response",
"deleteChannel",
"(",
"@",
"PathParam",
"(",
"\"ccid\"",
")",
"String",
"ccid",
")",
"{",
"try",
"{",
"log",
".",
"info",
"(",
"\"DELETE channel for cluster co... | Remove the channel for the given cluster controller.
@param ccid the ID of the channel
@return response ok if deletion was successful, else empty response | [
"Remove",
"the",
"channel",
"for",
"the",
"given",
"cluster",
"controller",
"."
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/messaging/channel-service/src/main/java/io/joynr/messaging/service/ChannelServiceRestAdapter.java#L176-L193 | train |
bmwcarit/joynr | java/core/clustercontroller/src/main/java/io/joynr/messaging/http/operation/LongPollingChannelLifecycle.java | LongPollingChannelLifecycle.createChannel | private synchronized boolean createChannel() {
final String url = settings.getBounceProxyUrl().buildCreateChannelUrl(channelId);
HttpPost postCreateChannel = httpRequestFactory.createHttpPost(URI.create(url.trim()));
postCreateChannel.setConfig(defaultRequestConfig);
postCreateChannel.addHeader(httpConstants.getHEADER_X_ATMOSPHERE_TRACKING_ID(), receiverId);
postCreateChannel.addHeader(httpConstants.getHEADER_CONTENT_TYPE(), httpConstants.getAPPLICATION_JSON());
channelUrl = null;
CloseableHttpResponse response = null;
boolean created = false;
try {
response = httpclient.execute(postCreateChannel);
StatusLine statusLine = response.getStatusLine();
int statusCode = statusLine.getStatusCode();
String reasonPhrase = statusLine.getReasonPhrase();
switch (statusCode) {
case HttpURLConnection.HTTP_OK:
case HttpURLConnection.HTTP_CREATED:
try {
Header locationHeader = response.getFirstHeader(httpConstants.getHEADER_LOCATION());
channelUrl = locationHeader != null ? locationHeader.getValue() : null;
} catch (Exception e) {
throw new JoynrChannelMissingException("channel url was null");
}
break;
default:
logger.error("createChannel channelId: {} failed. status: {} reason: {}",
channelId,
statusCode,
reasonPhrase);
throw new JoynrChannelMissingException("channel url was null");
}
created = true;
logger.info("createChannel channelId: {} returned channelUrl {}", channelId, channelUrl);
} catch (ClientProtocolException e) {
logger.error("createChannel ERROR reason: {}", e.getMessage());
} catch (IOException e) {
logger.error("createChannel ERROR reason: {}", e.getMessage());
} finally {
if (response != null) {
try {
response.close();
} catch (IOException e) {
logger.error("createChannel ERROR reason: {}", e.getMessage());
}
}
}
return created;
} | java | private synchronized boolean createChannel() {
final String url = settings.getBounceProxyUrl().buildCreateChannelUrl(channelId);
HttpPost postCreateChannel = httpRequestFactory.createHttpPost(URI.create(url.trim()));
postCreateChannel.setConfig(defaultRequestConfig);
postCreateChannel.addHeader(httpConstants.getHEADER_X_ATMOSPHERE_TRACKING_ID(), receiverId);
postCreateChannel.addHeader(httpConstants.getHEADER_CONTENT_TYPE(), httpConstants.getAPPLICATION_JSON());
channelUrl = null;
CloseableHttpResponse response = null;
boolean created = false;
try {
response = httpclient.execute(postCreateChannel);
StatusLine statusLine = response.getStatusLine();
int statusCode = statusLine.getStatusCode();
String reasonPhrase = statusLine.getReasonPhrase();
switch (statusCode) {
case HttpURLConnection.HTTP_OK:
case HttpURLConnection.HTTP_CREATED:
try {
Header locationHeader = response.getFirstHeader(httpConstants.getHEADER_LOCATION());
channelUrl = locationHeader != null ? locationHeader.getValue() : null;
} catch (Exception e) {
throw new JoynrChannelMissingException("channel url was null");
}
break;
default:
logger.error("createChannel channelId: {} failed. status: {} reason: {}",
channelId,
statusCode,
reasonPhrase);
throw new JoynrChannelMissingException("channel url was null");
}
created = true;
logger.info("createChannel channelId: {} returned channelUrl {}", channelId, channelUrl);
} catch (ClientProtocolException e) {
logger.error("createChannel ERROR reason: {}", e.getMessage());
} catch (IOException e) {
logger.error("createChannel ERROR reason: {}", e.getMessage());
} finally {
if (response != null) {
try {
response.close();
} catch (IOException e) {
logger.error("createChannel ERROR reason: {}", e.getMessage());
}
}
}
return created;
} | [
"private",
"synchronized",
"boolean",
"createChannel",
"(",
")",
"{",
"final",
"String",
"url",
"=",
"settings",
".",
"getBounceProxyUrl",
"(",
")",
".",
"buildCreateChannelUrl",
"(",
"channelId",
")",
";",
"HttpPost",
"postCreateChannel",
"=",
"httpRequestFactory",... | Create a new channel for the given cluster controller id. If a channel already exists, it is returned instead.
@return whether channel was created | [
"Create",
"a",
"new",
"channel",
"for",
"the",
"given",
"cluster",
"controller",
"id",
".",
"If",
"a",
"channel",
"already",
"exists",
"it",
"is",
"returned",
"instead",
"."
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/core/clustercontroller/src/main/java/io/joynr/messaging/http/operation/LongPollingChannelLifecycle.java#L337-L393 | train |
bmwcarit/joynr | java/javaapi/src/main/java/io/joynr/dispatcher/rpc/ReflectionUtils.java | ReflectionUtils.findAndMergeParameterAnnotations | public static List<List<Annotation>> findAndMergeParameterAnnotations(Method method) {
List<List<Annotation>> res = new ArrayList<List<Annotation>>(method.getParameterTypes().length);
for (int i = 0; i < method.getParameterTypes().length; i++) {
res.add(new LinkedList<Annotation>());
}
findAndMergeAnnotations(method.getDeclaringClass(), method, res);
return res;
} | java | public static List<List<Annotation>> findAndMergeParameterAnnotations(Method method) {
List<List<Annotation>> res = new ArrayList<List<Annotation>>(method.getParameterTypes().length);
for (int i = 0; i < method.getParameterTypes().length; i++) {
res.add(new LinkedList<Annotation>());
}
findAndMergeAnnotations(method.getDeclaringClass(), method, res);
return res;
} | [
"public",
"static",
"List",
"<",
"List",
"<",
"Annotation",
">",
">",
"findAndMergeParameterAnnotations",
"(",
"Method",
"method",
")",
"{",
"List",
"<",
"List",
"<",
"Annotation",
">>",
"res",
"=",
"new",
"ArrayList",
"<",
"List",
"<",
"Annotation",
">",
... | Utility function to find all annotations on the parameters of the specified method and merge them with the same
annotations on all base classes and interfaces.
@param method the method in question
@return the list of annotations for this method | [
"Utility",
"function",
"to",
"find",
"all",
"annotations",
"on",
"the",
"parameters",
"of",
"the",
"specified",
"method",
"and",
"merge",
"them",
"with",
"the",
"same",
"annotations",
"on",
"all",
"base",
"classes",
"and",
"interfaces",
"."
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/javaapi/src/main/java/io/joynr/dispatcher/rpc/ReflectionUtils.java#L141-L148 | train |
bmwcarit/joynr | java/javaapi/src/main/java/io/joynr/dispatcher/rpc/ReflectionUtils.java | ReflectionUtils.areMethodNameAndParameterTypesEqual | private static boolean areMethodNameAndParameterTypesEqual(Method methodA, Method methodB) {
if (!methodA.getName().equals(methodB.getName())) {
return false;
}
Class<?>[] methodAParameterTypes = methodA.getParameterTypes();
Class<?>[] methodBParameterTypes = methodB.getParameterTypes();
if (methodAParameterTypes.length != methodBParameterTypes.length) {
return false;
}
for (int i = 0; i < methodAParameterTypes.length; i++) {
if (!methodAParameterTypes[i].equals(methodBParameterTypes[i])) {
return false;
}
}
return true;
} | java | private static boolean areMethodNameAndParameterTypesEqual(Method methodA, Method methodB) {
if (!methodA.getName().equals(methodB.getName())) {
return false;
}
Class<?>[] methodAParameterTypes = methodA.getParameterTypes();
Class<?>[] methodBParameterTypes = methodB.getParameterTypes();
if (methodAParameterTypes.length != methodBParameterTypes.length) {
return false;
}
for (int i = 0; i < methodAParameterTypes.length; i++) {
if (!methodAParameterTypes[i].equals(methodBParameterTypes[i])) {
return false;
}
}
return true;
} | [
"private",
"static",
"boolean",
"areMethodNameAndParameterTypesEqual",
"(",
"Method",
"methodA",
",",
"Method",
"methodB",
")",
"{",
"if",
"(",
"!",
"methodA",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"methodB",
".",
"getName",
"(",
")",
")",
")",
"{"... | Compares to methods for equality based on name and parameter types. | [
"Compares",
"to",
"methods",
"for",
"equality",
"based",
"on",
"name",
"and",
"parameter",
"types",
"."
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/javaapi/src/main/java/io/joynr/dispatcher/rpc/ReflectionUtils.java#L174-L190 | train |
bmwcarit/joynr | java/core/libjoynr/src/main/java/io/joynr/arbitration/Arbitrator.java | Arbitrator.arbitrationFinished | protected void arbitrationFinished(ArbitrationStatus arbitrationStatus, ArbitrationResult arbitrationResult) {
this.arbitrationStatus = arbitrationStatus;
this.arbitrationResult = arbitrationResult;
// wait for arbitration listener to be registered
if (arbitrationListenerSemaphore.tryAcquire()) {
arbitrationListener.onSuccess(arbitrationResult);
arbitrationListenerSemaphore.release();
}
} | java | protected void arbitrationFinished(ArbitrationStatus arbitrationStatus, ArbitrationResult arbitrationResult) {
this.arbitrationStatus = arbitrationStatus;
this.arbitrationResult = arbitrationResult;
// wait for arbitration listener to be registered
if (arbitrationListenerSemaphore.tryAcquire()) {
arbitrationListener.onSuccess(arbitrationResult);
arbitrationListenerSemaphore.release();
}
} | [
"protected",
"void",
"arbitrationFinished",
"(",
"ArbitrationStatus",
"arbitrationStatus",
",",
"ArbitrationResult",
"arbitrationResult",
")",
"{",
"this",
".",
"arbitrationStatus",
"=",
"arbitrationStatus",
";",
"this",
".",
"arbitrationResult",
"=",
"arbitrationResult",
... | Sets the arbitration result at the arbitrationListener if the listener is already registered | [
"Sets",
"the",
"arbitration",
"result",
"at",
"the",
"arbitrationListener",
"if",
"the",
"listener",
"is",
"already",
"registered"
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/core/libjoynr/src/main/java/io/joynr/arbitration/Arbitrator.java#L153-L162 | train |
bmwcarit/joynr | java/core/libjoynr/src/main/java/io/joynr/runtime/JoynrRuntimeImpl.java | JoynrRuntimeImpl.registerProvider | @Override
public Future<Void> registerProvider(String domain,
Object provider,
ProviderQos providerQos,
boolean awaitGlobalRegistration,
final Class<?> interfaceClass) {
if (interfaceClass == null) {
throw new IllegalArgumentException("Cannot registerProvider: interfaceClass may not be NULL");
}
registerInterfaceClassTypes(interfaceClass, "Cannot registerProvider");
return capabilitiesRegistrar.registerProvider(domain, provider, providerQos, awaitGlobalRegistration);
} | java | @Override
public Future<Void> registerProvider(String domain,
Object provider,
ProviderQos providerQos,
boolean awaitGlobalRegistration,
final Class<?> interfaceClass) {
if (interfaceClass == null) {
throw new IllegalArgumentException("Cannot registerProvider: interfaceClass may not be NULL");
}
registerInterfaceClassTypes(interfaceClass, "Cannot registerProvider");
return capabilitiesRegistrar.registerProvider(domain, provider, providerQos, awaitGlobalRegistration);
} | [
"@",
"Override",
"public",
"Future",
"<",
"Void",
">",
"registerProvider",
"(",
"String",
"domain",
",",
"Object",
"provider",
",",
"ProviderQos",
"providerQos",
",",
"boolean",
"awaitGlobalRegistration",
",",
"final",
"Class",
"<",
"?",
">",
"interfaceClass",
"... | Registers a provider in the joynr framework by JEE
@param domain
The domain the provider should be registered for. Has to be identical at the client to be able to find
the provider.
@param provider
Instance of the provider implementation (has to extend a generated ...AbstractProvider).
@param providerQos
the provider's quality of service settings
@param awaitGlobalRegistration
If true, wait for global registration to complete or timeout, if required.
@param interfaceClass
The interface class of the provider.
@return Returns a Future which can be used to check the registration status. | [
"Registers",
"a",
"provider",
"in",
"the",
"joynr",
"framework",
"by",
"JEE"
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/core/libjoynr/src/main/java/io/joynr/runtime/JoynrRuntimeImpl.java#L211-L223 | train |
bmwcarit/joynr | java/messaging/bounceproxy/bounceproxy-controller-persistence/persistence-common/src/main/java/io/joynr/messaging/bounceproxy/controller/directory/BounceProxyRecord.java | BounceProxyRecord.setStatus | public void setStatus(BounceProxyStatus status) throws IllegalStateException {
// this checks if the transition is valid
if (this.status.isValidTransition(status)) {
this.status = status;
} else {
throw new IllegalStateException("Illegal status transition from " + this.status + " to " + status);
}
} | java | public void setStatus(BounceProxyStatus status) throws IllegalStateException {
// this checks if the transition is valid
if (this.status.isValidTransition(status)) {
this.status = status;
} else {
throw new IllegalStateException("Illegal status transition from " + this.status + " to " + status);
}
} | [
"public",
"void",
"setStatus",
"(",
"BounceProxyStatus",
"status",
")",
"throws",
"IllegalStateException",
"{",
"// this checks if the transition is valid",
"if",
"(",
"this",
".",
"status",
".",
"isValidTransition",
"(",
"status",
")",
")",
"{",
"this",
".",
"statu... | Sets the status of the bounce proxy.
@param status the status of the bounce proxy
@throws IllegalStateException
if setting this status is not possible for the current bounce
proxy status. | [
"Sets",
"the",
"status",
"of",
"the",
"bounce",
"proxy",
"."
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/messaging/bounceproxy/bounceproxy-controller-persistence/persistence-common/src/main/java/io/joynr/messaging/bounceproxy/controller/directory/BounceProxyRecord.java#L93-L100 | train |
bmwcarit/joynr | java/messaging/messaging-service/src/main/java/io/joynr/messaging/service/MessagingServiceRestAdapter.java | MessagingServiceRestAdapter.postMessage | @POST
@Produces({ MediaType.APPLICATION_OCTET_STREAM })
public Response postMessage(@PathParam("ccid") String ccid, byte[] serializedMessage) {
ImmutableMessage message;
try {
message = new ImmutableMessage(serializedMessage);
} catch (EncodingException | UnsuppportedVersionException e) {
throw new JoynrHttpException(Status.BAD_REQUEST, JOYNRMESSAGINGERROR_DESERIALIZATIONFAILED);
}
try {
log.debug("POST message to channel: {} message: {}", ccid, message);
// TODO Can this happen at all with empty path parameter???
if (ccid == null) {
log.error("POST message to channel: NULL. message: {} dropped because: channel Id was not set",
message);
throw new JoynrHttpException(Status.BAD_REQUEST, JOYNRMESSAGINGERROR_CHANNELNOTSET);
}
// send the message to the receiver.
if (message.getTtlMs() == 0) {
log.error("POST message to channel: {} message: {} dropped because: TTL not set", ccid, message);
throw new JoynrHttpException(Status.BAD_REQUEST, JOYNRMESSAGINGERROR_EXPIRYDATENOTSET);
}
if (message.getTtlMs() < timestampProvider.getCurrentTime()) {
log.warn("POST message {} to cluster controller: {} dropped because: TTL expired",
ccid,
message.getId());
throw new JoynrHttpException(Status.BAD_REQUEST,
JOYNRMESSAGINGERROR_EXPIRYDATEEXPIRED,
request.getRemoteHost());
}
if (!messagingService.isAssignedForChannel(ccid)) {
// scalability extensions: in case that other component should handle this channel
log.debug("POST message {}: Bounce Proxy not assigned for channel: {}", message, ccid);
if (messagingService.hasChannelAssignmentMoved(ccid)) {
// scalability extension: in case that this component was responsible before but isn't any more
log.debug("POST message {}: Bounce Proxy assignment moved for channel: {}", message, ccid);
return Response.status(410 /* Gone */).build();
} else {
log.debug("POST message {}: channel unknown: {}", message, ccid);
return Response.status(404 /* Not Found */).build();
}
}
// if the receiver has never registered with the bounceproxy
// (or his registration has expired) then return 204 no
// content.
if (!messagingService.hasMessageReceiver(ccid)) {
log.debug("POST message {}: no receiver for channel: {}", message, ccid);
return Response.noContent().build();
}
messagingService.passMessageToReceiver(ccid, serializedMessage);
// the location that can be queried to get the message
// status
// TODO REST URL for message status?
URI location = ui.getBaseUriBuilder().path("messages/" + message.getId()).build();
// encode URL in case we use sessions
String encodeURL = response.encodeURL(location.toString());
// return the message status location to the sender.
return Response.created(URI.create(encodeURL)).header("msgId", message.getId()).build();
} catch (WebApplicationException e) {
throw e;
} catch (Exception e) {
log.debug("POST message to channel: {} error: {}", ccid, e.getMessage());
throw new WebApplicationException(e, Status.INTERNAL_SERVER_ERROR);
}
} | java | @POST
@Produces({ MediaType.APPLICATION_OCTET_STREAM })
public Response postMessage(@PathParam("ccid") String ccid, byte[] serializedMessage) {
ImmutableMessage message;
try {
message = new ImmutableMessage(serializedMessage);
} catch (EncodingException | UnsuppportedVersionException e) {
throw new JoynrHttpException(Status.BAD_REQUEST, JOYNRMESSAGINGERROR_DESERIALIZATIONFAILED);
}
try {
log.debug("POST message to channel: {} message: {}", ccid, message);
// TODO Can this happen at all with empty path parameter???
if (ccid == null) {
log.error("POST message to channel: NULL. message: {} dropped because: channel Id was not set",
message);
throw new JoynrHttpException(Status.BAD_REQUEST, JOYNRMESSAGINGERROR_CHANNELNOTSET);
}
// send the message to the receiver.
if (message.getTtlMs() == 0) {
log.error("POST message to channel: {} message: {} dropped because: TTL not set", ccid, message);
throw new JoynrHttpException(Status.BAD_REQUEST, JOYNRMESSAGINGERROR_EXPIRYDATENOTSET);
}
if (message.getTtlMs() < timestampProvider.getCurrentTime()) {
log.warn("POST message {} to cluster controller: {} dropped because: TTL expired",
ccid,
message.getId());
throw new JoynrHttpException(Status.BAD_REQUEST,
JOYNRMESSAGINGERROR_EXPIRYDATEEXPIRED,
request.getRemoteHost());
}
if (!messagingService.isAssignedForChannel(ccid)) {
// scalability extensions: in case that other component should handle this channel
log.debug("POST message {}: Bounce Proxy not assigned for channel: {}", message, ccid);
if (messagingService.hasChannelAssignmentMoved(ccid)) {
// scalability extension: in case that this component was responsible before but isn't any more
log.debug("POST message {}: Bounce Proxy assignment moved for channel: {}", message, ccid);
return Response.status(410 /* Gone */).build();
} else {
log.debug("POST message {}: channel unknown: {}", message, ccid);
return Response.status(404 /* Not Found */).build();
}
}
// if the receiver has never registered with the bounceproxy
// (or his registration has expired) then return 204 no
// content.
if (!messagingService.hasMessageReceiver(ccid)) {
log.debug("POST message {}: no receiver for channel: {}", message, ccid);
return Response.noContent().build();
}
messagingService.passMessageToReceiver(ccid, serializedMessage);
// the location that can be queried to get the message
// status
// TODO REST URL for message status?
URI location = ui.getBaseUriBuilder().path("messages/" + message.getId()).build();
// encode URL in case we use sessions
String encodeURL = response.encodeURL(location.toString());
// return the message status location to the sender.
return Response.created(URI.create(encodeURL)).header("msgId", message.getId()).build();
} catch (WebApplicationException e) {
throw e;
} catch (Exception e) {
log.debug("POST message to channel: {} error: {}", ccid, e.getMessage());
throw new WebApplicationException(e, Status.INTERNAL_SERVER_ERROR);
}
} | [
"@",
"POST",
"@",
"Produces",
"(",
"{",
"MediaType",
".",
"APPLICATION_OCTET_STREAM",
"}",
")",
"public",
"Response",
"postMessage",
"(",
"@",
"PathParam",
"(",
"\"ccid\"",
")",
"String",
"ccid",
",",
"byte",
"[",
"]",
"serializedMessage",
")",
"{",
"Immutab... | Send a message.
@param ccid
channel id of the receiver.
@param message
the content being sent (serialized SMRF message).
@return a location for querying the message status | [
"Send",
"a",
"message",
"."
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/messaging/messaging-service/src/main/java/io/joynr/messaging/service/MessagingServiceRestAdapter.java#L91-L169 | train |
bmwcarit/joynr | java/core/libjoynr/src/main/java/io/joynr/arbitration/ArbitratorFactory.java | ArbitratorFactory.create | public static Arbitrator create(final Set<String> domains,
final String interfaceName,
final Version interfaceVersion,
final DiscoveryQos discoveryQos,
DiscoveryAsync localDiscoveryAggregator) throws DiscoveryException {
ArbitrationStrategyFunction arbitrationStrategyFunction;
switch (discoveryQos.getArbitrationStrategy()) {
case FixedChannel:
arbitrationStrategyFunction = new FixedParticipantArbitrationStrategyFunction();
break;
case Keyword:
arbitrationStrategyFunction = new KeywordArbitrationStrategyFunction();
break;
case HighestPriority:
arbitrationStrategyFunction = new HighestPriorityArbitrationStrategyFunction();
break;
case LastSeen:
arbitrationStrategyFunction = new LastSeenArbitrationStrategyFunction();
break;
case Custom:
arbitrationStrategyFunction = discoveryQos.getArbitrationStrategyFunction();
break;
default:
throw new DiscoveryException("Arbitration failed: domain: " + domains + " interface: " + interfaceName
+ " qos: " + discoveryQos + ": unknown arbitration strategy or strategy not set!");
}
return new Arbitrator(domains,
interfaceName,
interfaceVersion,
discoveryQos,
localDiscoveryAggregator,
minimumArbitrationRetryDelay,
arbitrationStrategyFunction,
discoveryEntryVersionFilter);
} | java | public static Arbitrator create(final Set<String> domains,
final String interfaceName,
final Version interfaceVersion,
final DiscoveryQos discoveryQos,
DiscoveryAsync localDiscoveryAggregator) throws DiscoveryException {
ArbitrationStrategyFunction arbitrationStrategyFunction;
switch (discoveryQos.getArbitrationStrategy()) {
case FixedChannel:
arbitrationStrategyFunction = new FixedParticipantArbitrationStrategyFunction();
break;
case Keyword:
arbitrationStrategyFunction = new KeywordArbitrationStrategyFunction();
break;
case HighestPriority:
arbitrationStrategyFunction = new HighestPriorityArbitrationStrategyFunction();
break;
case LastSeen:
arbitrationStrategyFunction = new LastSeenArbitrationStrategyFunction();
break;
case Custom:
arbitrationStrategyFunction = discoveryQos.getArbitrationStrategyFunction();
break;
default:
throw new DiscoveryException("Arbitration failed: domain: " + domains + " interface: " + interfaceName
+ " qos: " + discoveryQos + ": unknown arbitration strategy or strategy not set!");
}
return new Arbitrator(domains,
interfaceName,
interfaceVersion,
discoveryQos,
localDiscoveryAggregator,
minimumArbitrationRetryDelay,
arbitrationStrategyFunction,
discoveryEntryVersionFilter);
} | [
"public",
"static",
"Arbitrator",
"create",
"(",
"final",
"Set",
"<",
"String",
">",
"domains",
",",
"final",
"String",
"interfaceName",
",",
"final",
"Version",
"interfaceVersion",
",",
"final",
"DiscoveryQos",
"discoveryQos",
",",
"DiscoveryAsync",
"localDiscovery... | Creates an arbitrator defined by the arbitrationStrategy set in the discoveryQos.
@param domains
Set of domains of the provider.
@param interfaceName
Provided interface.
@param interfaceVersion
the Version of the interface being looked for.
@param discoveryQos
Arbitration settings like arbitration strategy, timeout and strategy specific parameters.
@param localDiscoveryAggregator
Source for capabilities lookup.
@return the created Arbitrator object
@throws DiscoveryException
if arbitration strategy is unknown | [
"Creates",
"an",
"arbitrator",
"defined",
"by",
"the",
"arbitrationStrategy",
"set",
"in",
"the",
"discoveryQos",
"."
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/core/libjoynr/src/main/java/io/joynr/arbitration/ArbitratorFactory.java#L79-L114 | train |
bmwcarit/joynr | java/messaging/messaging-common/src/main/java/io/joynr/runtime/PropertyLoader.java | PropertyLoader.loadProperties | public static Properties loadProperties(String fileName) {
LowerCaseProperties properties = new LowerCaseProperties();
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
URL url = classLoader.getResource(fileName);
// try opening from classpath
if (url != null) {
InputStream urlStream = null;
try {
urlStream = url.openStream();
properties.load(urlStream);
logger.info("Properties from classpath loaded file: " + fileName);
} catch (IOException e) {
logger.info("Properties from classpath not loaded because file not found: " + fileName);
} finally {
if (urlStream != null) {
try {
urlStream.close();
} catch (IOException e) {
}
}
}
}
// Override properties found on the classpath with any found in a file
// of the same name
LowerCaseProperties propertiesFromFileSystem = loadProperties(new File(fileName));
properties.putAll(propertiesFromFileSystem);
return properties;
} | java | public static Properties loadProperties(String fileName) {
LowerCaseProperties properties = new LowerCaseProperties();
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
URL url = classLoader.getResource(fileName);
// try opening from classpath
if (url != null) {
InputStream urlStream = null;
try {
urlStream = url.openStream();
properties.load(urlStream);
logger.info("Properties from classpath loaded file: " + fileName);
} catch (IOException e) {
logger.info("Properties from classpath not loaded because file not found: " + fileName);
} finally {
if (urlStream != null) {
try {
urlStream.close();
} catch (IOException e) {
}
}
}
}
// Override properties found on the classpath with any found in a file
// of the same name
LowerCaseProperties propertiesFromFileSystem = loadProperties(new File(fileName));
properties.putAll(propertiesFromFileSystem);
return properties;
} | [
"public",
"static",
"Properties",
"loadProperties",
"(",
"String",
"fileName",
")",
"{",
"LowerCaseProperties",
"properties",
"=",
"new",
"LowerCaseProperties",
"(",
")",
";",
"ClassLoader",
"classLoader",
"=",
"Thread",
".",
"currentThread",
"(",
")",
".",
"getCo... | load properties from file
@param fileName The filename of the file in which the properties are stored
@return The loaded properties. | [
"load",
"properties",
"from",
"file"
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/messaging/messaging-common/src/main/java/io/joynr/runtime/PropertyLoader.java#L79-L109 | train |
bmwcarit/joynr | java/messaging/bounceproxy-controller-service/src/main/java/io/joynr/messaging/service/MonitoringServiceRestAdapter.java | MonitoringServiceRestAdapter.getBounceProxies | @GET
@Produces({ MediaType.APPLICATION_JSON })
public GenericEntity<List<BounceProxyStatusInformation>> getBounceProxies() {
return new GenericEntity<List<BounceProxyStatusInformation>>(monitoringService.getRegisteredBounceProxies()) {
};
} | java | @GET
@Produces({ MediaType.APPLICATION_JSON })
public GenericEntity<List<BounceProxyStatusInformation>> getBounceProxies() {
return new GenericEntity<List<BounceProxyStatusInformation>>(monitoringService.getRegisteredBounceProxies()) {
};
} | [
"@",
"GET",
"@",
"Produces",
"(",
"{",
"MediaType",
".",
"APPLICATION_JSON",
"}",
")",
"public",
"GenericEntity",
"<",
"List",
"<",
"BounceProxyStatusInformation",
">",
">",
"getBounceProxies",
"(",
")",
"{",
"return",
"new",
"GenericEntity",
"<",
"List",
"<",... | Returns a list of bounce proxies that are registered with the bounceproxy
controller.
@return a list of bounce proxies that are registered with the bounceproxy
controller | [
"Returns",
"a",
"list",
"of",
"bounce",
"proxies",
"that",
"are",
"registered",
"with",
"the",
"bounceproxy",
"controller",
"."
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/messaging/bounceproxy-controller-service/src/main/java/io/joynr/messaging/service/MonitoringServiceRestAdapter.java#L70-L75 | train |
bmwcarit/joynr | java/messaging/bounceproxy/bounceproxy-controller/src/main/java/io/joynr/messaging/bounceproxy/controller/RemoteBounceProxyFacade.java | RemoteBounceProxyFacade.createChannel | public URI createChannel(ControlledBounceProxyInformation bpInfo,
String ccid,
String trackingId) throws JoynrProtocolException {
try {
// Try to create a channel on a bounce proxy with maximum number of
// retries.
return createChannelLoop(bpInfo, ccid, trackingId, sendCreateChannelMaxRetries);
} catch (JoynrProtocolException e) {
logger.error("Unexpected bounce proxy behaviour: message: {}", e.getMessage());
throw e;
} catch (JoynrRuntimeException e) {
logger.error("Channel creation on bounce proxy failed: message: {}", e.getMessage());
throw e;
} catch (Exception e) {
logger.error("Uncaught exception in channel creation: message: {}", e.getMessage());
throw new JoynrRuntimeException("Unknown exception when creating channel '" + ccid + "' on bounce proxy '"
+ bpInfo.getId() + "'", e);
}
} | java | public URI createChannel(ControlledBounceProxyInformation bpInfo,
String ccid,
String trackingId) throws JoynrProtocolException {
try {
// Try to create a channel on a bounce proxy with maximum number of
// retries.
return createChannelLoop(bpInfo, ccid, trackingId, sendCreateChannelMaxRetries);
} catch (JoynrProtocolException e) {
logger.error("Unexpected bounce proxy behaviour: message: {}", e.getMessage());
throw e;
} catch (JoynrRuntimeException e) {
logger.error("Channel creation on bounce proxy failed: message: {}", e.getMessage());
throw e;
} catch (Exception e) {
logger.error("Uncaught exception in channel creation: message: {}", e.getMessage());
throw new JoynrRuntimeException("Unknown exception when creating channel '" + ccid + "' on bounce proxy '"
+ bpInfo.getId() + "'", e);
}
} | [
"public",
"URI",
"createChannel",
"(",
"ControlledBounceProxyInformation",
"bpInfo",
",",
"String",
"ccid",
",",
"String",
"trackingId",
")",
"throws",
"JoynrProtocolException",
"{",
"try",
"{",
"// Try to create a channel on a bounce proxy with maximum number of",
"// retries.... | Creates a channel on the remote bounce proxy.
@param bpInfo information for a bounce proxy, including the cluster the
bounce proxy is running on
@param ccid the channel id
@param trackingId the tracking id
@return URI representing the channel
@throws JoynrProtocolException
if the bounce proxy rejects channel creation | [
"Creates",
"a",
"channel",
"on",
"the",
"remote",
"bounce",
"proxy",
"."
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/messaging/bounceproxy/bounceproxy-controller/src/main/java/io/joynr/messaging/bounceproxy/controller/RemoteBounceProxyFacade.java#L78-L98 | train |
bmwcarit/joynr | java/messaging/bounceproxy/bounceproxy-controller/src/main/java/io/joynr/messaging/bounceproxy/controller/RemoteBounceProxyFacade.java | RemoteBounceProxyFacade.createChannelLoop | private URI createChannelLoop(ControlledBounceProxyInformation bpInfo,
String ccid,
String trackingId,
int retries) throws JoynrProtocolException {
while (retries > 0) {
retries--;
try {
return sendCreateChannelHttpRequest(bpInfo, ccid, trackingId);
} catch (IOException e) {
// failed to establish communication with the bounce proxy
logger.error("creating a channel on bounce proxy {} failed due to communication errors: message: {}",
bpInfo.getId(),
e.getMessage());
}
// try again if creating the channel failed
try {
Thread.sleep(sendCreateChannelRetryIntervalMs);
} catch (InterruptedException e) {
throw new JoynrRuntimeException("creating a channel on bounce proxy " + bpInfo.getId()
+ " was interrupted.");
}
}
// the maximum number of retries passed, so channel creation failed
throw new JoynrRuntimeException("creating a channel on bounce proxy " + bpInfo.getId() + " failed.");
} | java | private URI createChannelLoop(ControlledBounceProxyInformation bpInfo,
String ccid,
String trackingId,
int retries) throws JoynrProtocolException {
while (retries > 0) {
retries--;
try {
return sendCreateChannelHttpRequest(bpInfo, ccid, trackingId);
} catch (IOException e) {
// failed to establish communication with the bounce proxy
logger.error("creating a channel on bounce proxy {} failed due to communication errors: message: {}",
bpInfo.getId(),
e.getMessage());
}
// try again if creating the channel failed
try {
Thread.sleep(sendCreateChannelRetryIntervalMs);
} catch (InterruptedException e) {
throw new JoynrRuntimeException("creating a channel on bounce proxy " + bpInfo.getId()
+ " was interrupted.");
}
}
// the maximum number of retries passed, so channel creation failed
throw new JoynrRuntimeException("creating a channel on bounce proxy " + bpInfo.getId() + " failed.");
} | [
"private",
"URI",
"createChannelLoop",
"(",
"ControlledBounceProxyInformation",
"bpInfo",
",",
"String",
"ccid",
",",
"String",
"trackingId",
",",
"int",
"retries",
")",
"throws",
"JoynrProtocolException",
"{",
"while",
"(",
"retries",
">",
"0",
")",
"{",
"retries... | Starts a loop to send createChannel requests to a bounce proxy with a
maximum number of retries.
@param bpInfo
information about the bounce proxy to create the channel at
@param ccid
the channel ID for the channel to create
@param trackingId
a tracking ID necessary for long polling
@param retries
the maximum number of retries
@return the url of the channel at the bounce proxy as it was returned by
the bounce proxy itself
@throws JoynrProtocolException
if the bounce proxy rejects channel creation | [
"Starts",
"a",
"loop",
"to",
"send",
"createChannel",
"requests",
"to",
"a",
"bounce",
"proxy",
"with",
"a",
"maximum",
"number",
"of",
"retries",
"."
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/messaging/bounceproxy/bounceproxy-controller/src/main/java/io/joynr/messaging/bounceproxy/controller/RemoteBounceProxyFacade.java#L117-L143 | train |
bmwcarit/joynr | java/messaging/bounceproxy/controlled-bounceproxy/src/main/java/io/joynr/messaging/bounceproxy/monitoring/BounceProxyStartupReporter.java | BounceProxyStartupReporter.cancelReporting | public void cancelReporting() {
if (startupReportFuture != null) {
startupReportFuture.cancel(true);
}
if (execService != null) {
// interrupt reporting loop
execService.shutdownNow();
}
} | java | public void cancelReporting() {
if (startupReportFuture != null) {
startupReportFuture.cancel(true);
}
if (execService != null) {
// interrupt reporting loop
execService.shutdownNow();
}
} | [
"public",
"void",
"cancelReporting",
"(",
")",
"{",
"if",
"(",
"startupReportFuture",
"!=",
"null",
")",
"{",
"startupReportFuture",
".",
"cancel",
"(",
"true",
")",
";",
"}",
"if",
"(",
"execService",
"!=",
"null",
")",
"{",
"// interrupt reporting loop",
"... | Cancels startup reporting. | [
"Cancels",
"startup",
"reporting",
"."
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/messaging/bounceproxy/controlled-bounceproxy/src/main/java/io/joynr/messaging/bounceproxy/monitoring/BounceProxyStartupReporter.java#L183-L191 | train |
bmwcarit/joynr | java/messaging/bounceproxy/controlled-bounceproxy/src/main/java/io/joynr/messaging/bounceproxy/monitoring/BounceProxyStartupReporter.java | BounceProxyStartupReporter.reportEventAsHttpRequest | private void reportEventAsHttpRequest() throws IOException {
final String url = bounceProxyControllerUrl.buildReportStartupUrl(controlledBounceProxyUrl);
logger.debug("Using monitoring service URL: {}", url);
HttpPut putReportStartup = new HttpPut(url.trim());
CloseableHttpResponse response = null;
try {
response = httpclient.execute(putReportStartup);
StatusLine statusLine = response.getStatusLine();
int statusCode = statusLine.getStatusCode();
switch (statusCode) {
case HttpURLConnection.HTTP_NO_CONTENT:
// bounce proxy instance was already known at the bounce proxy
// controller
// nothing else to do
logger.info("Bounce proxy was already registered with the controller");
break;
case HttpURLConnection.HTTP_CREATED:
// bounce proxy instance was registered for the very first time
// TODO maybe read URL
logger.info("Registered bounce proxy with controller");
break;
default:
logger.error("Failed to send startup notification: {}", response);
throw new JoynrHttpException(statusCode,
"Failed to send startup notification. Bounce Proxy won't get any channels assigned.");
}
} finally {
if (response != null) {
response.close();
}
}
} | java | private void reportEventAsHttpRequest() throws IOException {
final String url = bounceProxyControllerUrl.buildReportStartupUrl(controlledBounceProxyUrl);
logger.debug("Using monitoring service URL: {}", url);
HttpPut putReportStartup = new HttpPut(url.trim());
CloseableHttpResponse response = null;
try {
response = httpclient.execute(putReportStartup);
StatusLine statusLine = response.getStatusLine();
int statusCode = statusLine.getStatusCode();
switch (statusCode) {
case HttpURLConnection.HTTP_NO_CONTENT:
// bounce proxy instance was already known at the bounce proxy
// controller
// nothing else to do
logger.info("Bounce proxy was already registered with the controller");
break;
case HttpURLConnection.HTTP_CREATED:
// bounce proxy instance was registered for the very first time
// TODO maybe read URL
logger.info("Registered bounce proxy with controller");
break;
default:
logger.error("Failed to send startup notification: {}", response);
throw new JoynrHttpException(statusCode,
"Failed to send startup notification. Bounce Proxy won't get any channels assigned.");
}
} finally {
if (response != null) {
response.close();
}
}
} | [
"private",
"void",
"reportEventAsHttpRequest",
"(",
")",
"throws",
"IOException",
"{",
"final",
"String",
"url",
"=",
"bounceProxyControllerUrl",
".",
"buildReportStartupUrl",
"(",
"controlledBounceProxyUrl",
")",
";",
"logger",
".",
"debug",
"(",
"\"Using monitoring se... | Reports the lifecycle event to the monitoring service as HTTP request.
@throws IOException
if the connection with the bounce proxy controller could not
be established
@throws JoynrHttpException
if the bounce proxy responded that registering the bounce
proxy did not succeed | [
"Reports",
"the",
"lifecycle",
"event",
"to",
"the",
"monitoring",
"service",
"as",
"HTTP",
"request",
"."
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/messaging/bounceproxy/controlled-bounceproxy/src/main/java/io/joynr/messaging/bounceproxy/monitoring/BounceProxyStartupReporter.java#L252-L290 | train |
bmwcarit/joynr | java/javaapi/src/main/java/joynr/OnChangeSubscriptionQos.java | OnChangeSubscriptionQos.setMinIntervalMsInternal | private OnChangeSubscriptionQos setMinIntervalMsInternal(final long minIntervalMs) {
if (minIntervalMs < MIN_MIN_INTERVAL_MS) {
this.minIntervalMs = MIN_MIN_INTERVAL_MS;
logger.warn("minIntervalMs < MIN_MIN_INTERVAL_MS. Using MIN_MIN_INTERVAL_MS: {}", MIN_MIN_INTERVAL_MS);
} else if (minIntervalMs > MAX_MIN_INTERVAL_MS) {
this.minIntervalMs = MAX_MIN_INTERVAL_MS;
logger.warn("minIntervalMs > MAX_MIN_INTERVAL_MS. Using MAX_MIN_INTERVAL_MS: {}", MAX_MIN_INTERVAL_MS);
} else {
this.minIntervalMs = minIntervalMs;
}
return this;
} | java | private OnChangeSubscriptionQos setMinIntervalMsInternal(final long minIntervalMs) {
if (minIntervalMs < MIN_MIN_INTERVAL_MS) {
this.minIntervalMs = MIN_MIN_INTERVAL_MS;
logger.warn("minIntervalMs < MIN_MIN_INTERVAL_MS. Using MIN_MIN_INTERVAL_MS: {}", MIN_MIN_INTERVAL_MS);
} else if (minIntervalMs > MAX_MIN_INTERVAL_MS) {
this.minIntervalMs = MAX_MIN_INTERVAL_MS;
logger.warn("minIntervalMs > MAX_MIN_INTERVAL_MS. Using MAX_MIN_INTERVAL_MS: {}", MAX_MIN_INTERVAL_MS);
} else {
this.minIntervalMs = minIntervalMs;
}
return this;
} | [
"private",
"OnChangeSubscriptionQos",
"setMinIntervalMsInternal",
"(",
"final",
"long",
"minIntervalMs",
")",
"{",
"if",
"(",
"minIntervalMs",
"<",
"MIN_MIN_INTERVAL_MS",
")",
"{",
"this",
".",
"minIntervalMs",
"=",
"MIN_MIN_INTERVAL_MS",
";",
"logger",
".",
"warn",
... | internal method required to prevent findbugs warning | [
"internal",
"method",
"required",
"to",
"prevent",
"findbugs",
"warning"
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/javaapi/src/main/java/joynr/OnChangeSubscriptionQos.java#L150-L162 | train |
bmwcarit/joynr | java/backend-services/domain-access-controller/src/main/java/io/joynr/accesscontrol/global/GlobalDomainAccessControlListEditorProviderImpl.java | GlobalDomainAccessControlListEditorProviderImpl.hasRoleMaster | private boolean hasRoleMaster(String userId, String domain) {
DomainRoleEntry domainRole = domainAccessStore.getDomainRole(userId, Role.MASTER);
if (domainRole == null || !Arrays.asList(domainRole.getDomains()).contains(domain)) {
return false;
}
return true;
} | java | private boolean hasRoleMaster(String userId, String domain) {
DomainRoleEntry domainRole = domainAccessStore.getDomainRole(userId, Role.MASTER);
if (domainRole == null || !Arrays.asList(domainRole.getDomains()).contains(domain)) {
return false;
}
return true;
} | [
"private",
"boolean",
"hasRoleMaster",
"(",
"String",
"userId",
",",
"String",
"domain",
")",
"{",
"DomainRoleEntry",
"domainRole",
"=",
"domainAccessStore",
".",
"getDomainRole",
"(",
"userId",
",",
"Role",
".",
"MASTER",
")",
";",
"if",
"(",
"domainRole",
"=... | Indicates if the given user has master role for the given domain | [
"Indicates",
"if",
"the",
"given",
"user",
"has",
"master",
"role",
"for",
"the",
"given",
"domain"
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/backend-services/domain-access-controller/src/main/java/io/joynr/accesscontrol/global/GlobalDomainAccessControlListEditorProviderImpl.java#L86-L94 | train |
bmwcarit/joynr | java/messaging/messaging-common/src/main/java/io/joynr/messaging/routing/MessageQueue.java | MessageQueue.put | public void put(DelayableImmutableMessage delayableImmutableMessage) {
if (messagePersister.persist(messageQueueId, delayableImmutableMessage)) {
logger.trace("Message {} was persisted for messageQueueId {}",
delayableImmutableMessage.getMessage(),
messageQueueId);
} else {
logger.trace("Message {} was not persisted for messageQueueId {}",
delayableImmutableMessage.getMessage(),
messageQueueId);
}
delayableImmutableMessages.put(delayableImmutableMessage);
} | java | public void put(DelayableImmutableMessage delayableImmutableMessage) {
if (messagePersister.persist(messageQueueId, delayableImmutableMessage)) {
logger.trace("Message {} was persisted for messageQueueId {}",
delayableImmutableMessage.getMessage(),
messageQueueId);
} else {
logger.trace("Message {} was not persisted for messageQueueId {}",
delayableImmutableMessage.getMessage(),
messageQueueId);
}
delayableImmutableMessages.put(delayableImmutableMessage);
} | [
"public",
"void",
"put",
"(",
"DelayableImmutableMessage",
"delayableImmutableMessage",
")",
"{",
"if",
"(",
"messagePersister",
".",
"persist",
"(",
"messageQueueId",
",",
"delayableImmutableMessage",
")",
")",
"{",
"logger",
".",
"trace",
"(",
"\"Message {} was pers... | Add the passed in message to the queue of messages to be processed.
Also offer the message for persisting.
@param delayableImmutableMessage the message to add. | [
"Add",
"the",
"passed",
"in",
"message",
"to",
"the",
"queue",
"of",
"messages",
"to",
"be",
"processed",
".",
"Also",
"offer",
"the",
"message",
"for",
"persisting",
"."
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/messaging/messaging-common/src/main/java/io/joynr/messaging/routing/MessageQueue.java#L159-L170 | train |
bmwcarit/joynr | java/messaging/messaging-common/src/main/java/io/joynr/messaging/routing/MessageQueue.java | MessageQueue.poll | public DelayableImmutableMessage poll(long timeout, TimeUnit unit) throws InterruptedException {
DelayableImmutableMessage message = delayableImmutableMessages.poll(timeout, unit);
if (message != null) {
messagePersister.remove(messageQueueId, message);
}
return message;
} | java | public DelayableImmutableMessage poll(long timeout, TimeUnit unit) throws InterruptedException {
DelayableImmutableMessage message = delayableImmutableMessages.poll(timeout, unit);
if (message != null) {
messagePersister.remove(messageQueueId, message);
}
return message;
} | [
"public",
"DelayableImmutableMessage",
"poll",
"(",
"long",
"timeout",
",",
"TimeUnit",
"unit",
")",
"throws",
"InterruptedException",
"{",
"DelayableImmutableMessage",
"message",
"=",
"delayableImmutableMessages",
".",
"poll",
"(",
"timeout",
",",
"unit",
")",
";",
... | Polls the message queue for a period no longer than the timeout specified for a new message.
If a message is successfully obtained, before returning it, a message persister is called in order to remove
this message from the persistence (in case it was persisted at all).
@param timeout the maximum time to wait for a message to become available.
@param unit the time unit of measurement for <code>timeout</code>
@return a new message if one is available, or <code>null</code> if none became available within the specified time limit.
@throws InterruptedException if the thread was interrupted while waiting for a message to become available. | [
"Polls",
"the",
"message",
"queue",
"for",
"a",
"period",
"no",
"longer",
"than",
"the",
"timeout",
"specified",
"for",
"a",
"new",
"message",
"."
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/messaging/messaging-common/src/main/java/io/joynr/messaging/routing/MessageQueue.java#L183-L189 | train |
bmwcarit/joynr | java/messaging/bounceproxy/controlled-bounceproxy/src/main/java/io/joynr/messaging/bounceproxy/monitoring/BounceProxyPerformanceReporter.java | BounceProxyPerformanceReporter.startReporting | public void startReporting() {
if (executorService == null) {
throw new IllegalStateException("MonitoringServiceClient already shutdown");
}
if (scheduledFuture != null) {
logger.error("only one performance reporting thread can be started");
return;
}
Runnable performanceReporterCallable = new Runnable() {
@Override
public void run() {
try {
// only send a report if the bounce proxy is initialized
if (bounceProxyLifecycleMonitor.isInitialized()) {
// Don't do any retries here. If we miss on performance
// report, we'll just wait for the next loop.
sendPerformanceReportAsHttpRequest();
}
} catch (Exception e) {
logger.error("Uncaught exception in reportPerformance.", e);
}
}
};
scheduledFuture = executorService.scheduleWithFixedDelay(performanceReporterCallable,
performanceReportingFrequencyMs,
performanceReportingFrequencyMs,
TimeUnit.MILLISECONDS);
} | java | public void startReporting() {
if (executorService == null) {
throw new IllegalStateException("MonitoringServiceClient already shutdown");
}
if (scheduledFuture != null) {
logger.error("only one performance reporting thread can be started");
return;
}
Runnable performanceReporterCallable = new Runnable() {
@Override
public void run() {
try {
// only send a report if the bounce proxy is initialized
if (bounceProxyLifecycleMonitor.isInitialized()) {
// Don't do any retries here. If we miss on performance
// report, we'll just wait for the next loop.
sendPerformanceReportAsHttpRequest();
}
} catch (Exception e) {
logger.error("Uncaught exception in reportPerformance.", e);
}
}
};
scheduledFuture = executorService.scheduleWithFixedDelay(performanceReporterCallable,
performanceReportingFrequencyMs,
performanceReportingFrequencyMs,
TimeUnit.MILLISECONDS);
} | [
"public",
"void",
"startReporting",
"(",
")",
"{",
"if",
"(",
"executorService",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"MonitoringServiceClient already shutdown\"",
")",
";",
"}",
"if",
"(",
"scheduledFuture",
"!=",
"null",
")",
... | Starts a reporting loop that sends performance measures to the monitoring
service in a certain frequency. | [
"Starts",
"a",
"reporting",
"loop",
"that",
"sends",
"performance",
"measures",
"to",
"the",
"monitoring",
"service",
"in",
"a",
"certain",
"frequency",
"."
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/messaging/bounceproxy/controlled-bounceproxy/src/main/java/io/joynr/messaging/bounceproxy/monitoring/BounceProxyPerformanceReporter.java#L91-L127 | train |
bmwcarit/joynr | java/messaging/bounceproxy/controlled-bounceproxy/src/main/java/io/joynr/messaging/bounceproxy/monitoring/BounceProxyPerformanceReporter.java | BounceProxyPerformanceReporter.sendPerformanceReportAsHttpRequest | private void sendPerformanceReportAsHttpRequest() throws IOException {
final String url = bounceProxyControllerUrl.buildReportPerformanceUrl();
logger.debug("Using monitoring service URL: {}", url);
Map<String, Integer> performanceMap = bounceProxyPerformanceMonitor.getAsKeyValuePairs();
String serializedMessage = objectMapper.writeValueAsString(performanceMap);
HttpPost postReportPerformance = new HttpPost(url.trim());
// using http apache constants here because JOYNr constants are in
// libjoynr which should not be included here
postReportPerformance.addHeader(HttpHeaders.CONTENT_TYPE, "application/json");
postReportPerformance.setEntity(new StringEntity(serializedMessage, "UTF-8"));
CloseableHttpResponse response = null;
try {
response = httpclient.execute(postReportPerformance);
StatusLine statusLine = response.getStatusLine();
int statusCode = statusLine.getStatusCode();
if (statusCode != HttpURLConnection.HTTP_NO_CONTENT) {
logger.error("Failed to send performance report: {}", response);
throw new JoynrHttpException(statusCode, "Failed to send performance report.");
}
} finally {
if (response != null) {
response.close();
}
}
} | java | private void sendPerformanceReportAsHttpRequest() throws IOException {
final String url = bounceProxyControllerUrl.buildReportPerformanceUrl();
logger.debug("Using monitoring service URL: {}", url);
Map<String, Integer> performanceMap = bounceProxyPerformanceMonitor.getAsKeyValuePairs();
String serializedMessage = objectMapper.writeValueAsString(performanceMap);
HttpPost postReportPerformance = new HttpPost(url.trim());
// using http apache constants here because JOYNr constants are in
// libjoynr which should not be included here
postReportPerformance.addHeader(HttpHeaders.CONTENT_TYPE, "application/json");
postReportPerformance.setEntity(new StringEntity(serializedMessage, "UTF-8"));
CloseableHttpResponse response = null;
try {
response = httpclient.execute(postReportPerformance);
StatusLine statusLine = response.getStatusLine();
int statusCode = statusLine.getStatusCode();
if (statusCode != HttpURLConnection.HTTP_NO_CONTENT) {
logger.error("Failed to send performance report: {}", response);
throw new JoynrHttpException(statusCode, "Failed to send performance report.");
}
} finally {
if (response != null) {
response.close();
}
}
} | [
"private",
"void",
"sendPerformanceReportAsHttpRequest",
"(",
")",
"throws",
"IOException",
"{",
"final",
"String",
"url",
"=",
"bounceProxyControllerUrl",
".",
"buildReportPerformanceUrl",
"(",
")",
";",
"logger",
".",
"debug",
"(",
"\"Using monitoring service URL: {}\""... | Sends an HTTP request to the monitoring service to report performance
measures of a bounce proxy instance.
@throws IOException | [
"Sends",
"an",
"HTTP",
"request",
"to",
"the",
"monitoring",
"service",
"to",
"report",
"performance",
"measures",
"of",
"a",
"bounce",
"proxy",
"instance",
"."
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/messaging/bounceproxy/controlled-bounceproxy/src/main/java/io/joynr/messaging/bounceproxy/monitoring/BounceProxyPerformanceReporter.java#L135-L165 | train |
bmwcarit/joynr | java/messaging/bounceproxy/controlled-bounceproxy/src/main/java/io/joynr/messaging/bounceproxy/monitoring/BounceProxyPerformanceReporter.java | BounceProxyPerformanceReporter.stopReporting | public boolean stopReporting() {
// quit the bounce proxy heartbeat but let a possibly running request
// finish
if (scheduledFuture != null) {
return scheduledFuture.cancel(false);
}
executorService.shutdown();
executorService = null;
return false;
} | java | public boolean stopReporting() {
// quit the bounce proxy heartbeat but let a possibly running request
// finish
if (scheduledFuture != null) {
return scheduledFuture.cancel(false);
}
executorService.shutdown();
executorService = null;
return false;
} | [
"public",
"boolean",
"stopReporting",
"(",
")",
"{",
"// quit the bounce proxy heartbeat but let a possibly running request",
"// finish",
"if",
"(",
"scheduledFuture",
"!=",
"null",
")",
"{",
"return",
"scheduledFuture",
".",
"cancel",
"(",
"false",
")",
";",
"}",
"e... | Stops the performance reporting loop.
@return <code>false</code> if the reporing task could not be cancelled
(maybe because it has already completed normally),
<code>true</code> otherwise | [
"Stops",
"the",
"performance",
"reporting",
"loop",
"."
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/messaging/bounceproxy/controlled-bounceproxy/src/main/java/io/joynr/messaging/bounceproxy/monitoring/BounceProxyPerformanceReporter.java#L174-L185 | train |
bmwcarit/joynr | java/messaging/messaging-common/src/main/java/io/joynr/arbitration/DiscoveryQos.java | DiscoveryQos.setArbitrationStrategy | public void setArbitrationStrategy(ArbitrationStrategy arbitrationStrategy) {
if (arbitrationStrategy.equals(ArbitrationStrategy.Custom)) {
throw new IllegalStateException("A Custom strategy can only be set by passing an arbitration strategy function to the DiscoveryQos constructor");
}
this.arbitrationStrategy = arbitrationStrategy;
} | java | public void setArbitrationStrategy(ArbitrationStrategy arbitrationStrategy) {
if (arbitrationStrategy.equals(ArbitrationStrategy.Custom)) {
throw new IllegalStateException("A Custom strategy can only be set by passing an arbitration strategy function to the DiscoveryQos constructor");
}
this.arbitrationStrategy = arbitrationStrategy;
} | [
"public",
"void",
"setArbitrationStrategy",
"(",
"ArbitrationStrategy",
"arbitrationStrategy",
")",
"{",
"if",
"(",
"arbitrationStrategy",
".",
"equals",
"(",
"ArbitrationStrategy",
".",
"Custom",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"A Custo... | The discovery process outputs a list of matching providers. The arbitration strategy then chooses one or more of
them to be used by the proxy.
@param arbitrationStrategy
Defines the strategy used to choose the "best" provider. | [
"The",
"discovery",
"process",
"outputs",
"a",
"list",
"of",
"matching",
"providers",
".",
"The",
"arbitration",
"strategy",
"then",
"chooses",
"one",
"or",
"more",
"of",
"them",
"to",
"be",
"used",
"by",
"the",
"proxy",
"."
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/messaging/messaging-common/src/main/java/io/joynr/arbitration/DiscoveryQos.java#L187-L192 | train |
bmwcarit/joynr | java/javaapi/src/main/java/io/joynr/proxy/Future.java | Future.onSuccess | public void onSuccess(T result) {
try {
statusLock.lock();
value = result;
status = new RequestStatus(RequestStatusCode.OK);
statusLockChangedCondition.signalAll();
} catch (Exception e) {
status = new RequestStatus(RequestStatusCode.ERROR);
exception = new JoynrRuntimeException(e);
} finally {
statusLock.unlock();
}
} | java | public void onSuccess(T result) {
try {
statusLock.lock();
value = result;
status = new RequestStatus(RequestStatusCode.OK);
statusLockChangedCondition.signalAll();
} catch (Exception e) {
status = new RequestStatus(RequestStatusCode.ERROR);
exception = new JoynrRuntimeException(e);
} finally {
statusLock.unlock();
}
} | [
"public",
"void",
"onSuccess",
"(",
"T",
"result",
")",
"{",
"try",
"{",
"statusLock",
".",
"lock",
"(",
")",
";",
"value",
"=",
"result",
";",
"status",
"=",
"new",
"RequestStatus",
"(",
"RequestStatusCode",
".",
"OK",
")",
";",
"statusLockChangedConditio... | Resolves the future using the given result
@param result
the result of the asynchronous call | [
"Resolves",
"the",
"future",
"using",
"the",
"given",
"result"
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/javaapi/src/main/java/io/joynr/proxy/Future.java#L118-L130 | train |
bmwcarit/joynr | java/javaapi/src/main/java/io/joynr/proxy/Future.java | Future.onFailure | public void onFailure(JoynrException newException) {
exception = newException;
status = new RequestStatus(RequestStatusCode.ERROR);
try {
statusLock.lock();
statusLockChangedCondition.signalAll();
} finally {
statusLock.unlock();
}
} | java | public void onFailure(JoynrException newException) {
exception = newException;
status = new RequestStatus(RequestStatusCode.ERROR);
try {
statusLock.lock();
statusLockChangedCondition.signalAll();
} finally {
statusLock.unlock();
}
} | [
"public",
"void",
"onFailure",
"(",
"JoynrException",
"newException",
")",
"{",
"exception",
"=",
"newException",
";",
"status",
"=",
"new",
"RequestStatus",
"(",
"RequestStatusCode",
".",
"ERROR",
")",
";",
"try",
"{",
"statusLock",
".",
"lock",
"(",
")",
"... | Terminates the future in error
@param newException
that caused the failure | [
"Terminates",
"the",
"future",
"in",
"error"
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/javaapi/src/main/java/io/joynr/proxy/Future.java#L138-L147 | train |
bmwcarit/joynr | java/javaapi/src/main/java/io/joynr/exceptions/MultiDomainNoCompatibleProviderFoundException.java | MultiDomainNoCompatibleProviderFoundException.getDiscoveredVersionsForDomain | public Set<Version> getDiscoveredVersionsForDomain(String domain) {
Set<Version> result = new HashSet<>();
if (hasExceptionForDomain(domain)) {
result.addAll(exceptionsByDomain.get(domain).getDiscoveredVersions());
}
return result;
} | java | public Set<Version> getDiscoveredVersionsForDomain(String domain) {
Set<Version> result = new HashSet<>();
if (hasExceptionForDomain(domain)) {
result.addAll(exceptionsByDomain.get(domain).getDiscoveredVersions());
}
return result;
} | [
"public",
"Set",
"<",
"Version",
">",
"getDiscoveredVersionsForDomain",
"(",
"String",
"domain",
")",
"{",
"Set",
"<",
"Version",
">",
"result",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"if",
"(",
"hasExceptionForDomain",
"(",
"domain",
")",
")",
"{",
... | Returns the set of versions which were discovered for a given domain.
@param domain
the domain for which to return the set of versions which were found by that domain.
@return the set of discovered versions for the given domain, or an empty set if no discovered versions are
available for that domain. Will never be <code>null</code>. | [
"Returns",
"the",
"set",
"of",
"versions",
"which",
"were",
"discovered",
"for",
"a",
"given",
"domain",
"."
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/javaapi/src/main/java/io/joynr/exceptions/MultiDomainNoCompatibleProviderFoundException.java#L104-L110 | train |
bmwcarit/joynr | java/core/libjoynr/src/main/java/io/joynr/proxy/ConnectorFactory.java | ConnectorFactory.create | @CheckForNull
public ConnectorInvocationHandler create(final String fromParticipantId,
final ArbitrationResult arbitrationResult,
final MessagingQos qosSettings,
String statelessAsyncParticipantId) {
// iterate through arbitrationResult.getDiscoveryEntries()
// check if there is at least one Globally visible
// set isGloballyVisible = true. otherwise = false
boolean isGloballyVisible = false;
Set<DiscoveryEntryWithMetaInfo> entries = arbitrationResult.getDiscoveryEntries();
for (DiscoveryEntryWithMetaInfo entry : entries) {
if (entry.getQos().getScope() == ProviderScope.GLOBAL) {
isGloballyVisible = true;
}
messageRouter.setToKnown(entry.getParticipantId());
}
messageRouter.addNextHop(fromParticipantId, libjoynrMessagingAddress, isGloballyVisible);
return joynrMessagingConnectorFactory.create(fromParticipantId,
arbitrationResult.getDiscoveryEntries(),
qosSettings,
statelessAsyncParticipantId);
} | java | @CheckForNull
public ConnectorInvocationHandler create(final String fromParticipantId,
final ArbitrationResult arbitrationResult,
final MessagingQos qosSettings,
String statelessAsyncParticipantId) {
// iterate through arbitrationResult.getDiscoveryEntries()
// check if there is at least one Globally visible
// set isGloballyVisible = true. otherwise = false
boolean isGloballyVisible = false;
Set<DiscoveryEntryWithMetaInfo> entries = arbitrationResult.getDiscoveryEntries();
for (DiscoveryEntryWithMetaInfo entry : entries) {
if (entry.getQos().getScope() == ProviderScope.GLOBAL) {
isGloballyVisible = true;
}
messageRouter.setToKnown(entry.getParticipantId());
}
messageRouter.addNextHop(fromParticipantId, libjoynrMessagingAddress, isGloballyVisible);
return joynrMessagingConnectorFactory.create(fromParticipantId,
arbitrationResult.getDiscoveryEntries(),
qosSettings,
statelessAsyncParticipantId);
} | [
"@",
"CheckForNull",
"public",
"ConnectorInvocationHandler",
"create",
"(",
"final",
"String",
"fromParticipantId",
",",
"final",
"ArbitrationResult",
"arbitrationResult",
",",
"final",
"MessagingQos",
"qosSettings",
",",
"String",
"statelessAsyncParticipantId",
")",
"{",
... | Creates a new connector object using concrete connector factories chosen by the endpointAddress which is passed
in.
@param fromParticipantId origin participant id
@param arbitrationResult result of arbitration
@param qosSettings QOS settings
@param statelessAsyncParticipantId
@return connector object | [
"Creates",
"a",
"new",
"connector",
"object",
"using",
"concrete",
"connector",
"factories",
"chosen",
"by",
"the",
"endpointAddress",
"which",
"is",
"passed",
"in",
"."
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/core/libjoynr/src/main/java/io/joynr/proxy/ConnectorFactory.java#L64-L85 | train |
bmwcarit/joynr | java/javaapi/src/main/java/io/joynr/provider/AbstractSubscriptionPublisher.java | AbstractSubscriptionPublisher.registerAttributeListener | @Override
public void registerAttributeListener(String attributeName, AttributeListener attributeListener) {
attributeListeners.putIfAbsent(attributeName, new ArrayList<AttributeListener>());
List<AttributeListener> listeners = attributeListeners.get(attributeName);
synchronized (listeners) {
listeners.add(attributeListener);
}
} | java | @Override
public void registerAttributeListener(String attributeName, AttributeListener attributeListener) {
attributeListeners.putIfAbsent(attributeName, new ArrayList<AttributeListener>());
List<AttributeListener> listeners = attributeListeners.get(attributeName);
synchronized (listeners) {
listeners.add(attributeListener);
}
} | [
"@",
"Override",
"public",
"void",
"registerAttributeListener",
"(",
"String",
"attributeName",
",",
"AttributeListener",
"attributeListener",
")",
"{",
"attributeListeners",
".",
"putIfAbsent",
"(",
"attributeName",
",",
"new",
"ArrayList",
"<",
"AttributeListener",
">... | Registers an attribute listener that gets notified in case the attribute
changes. This is used for on change subscriptions.
@param attributeName the attribute name as defined in the Franca model
to subscribe to.
@param attributeListener the listener to add. | [
"Registers",
"an",
"attribute",
"listener",
"that",
"gets",
"notified",
"in",
"case",
"the",
"attribute",
"changes",
".",
"This",
"is",
"used",
"for",
"on",
"change",
"subscriptions",
"."
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/javaapi/src/main/java/io/joynr/provider/AbstractSubscriptionPublisher.java#L127-L134 | train |
bmwcarit/joynr | java/javaapi/src/main/java/io/joynr/provider/AbstractSubscriptionPublisher.java | AbstractSubscriptionPublisher.unregisterAttributeListener | @Override
public void unregisterAttributeListener(String attributeName, AttributeListener attributeListener) {
List<AttributeListener> listeners = attributeListeners.get(attributeName);
if (listeners == null) {
LOG.error("trying to unregister an attribute listener for attribute \"" + attributeName
+ "\" that was never registered");
return;
}
synchronized (listeners) {
boolean success = listeners.remove(attributeListener);
if (!success) {
LOG.error("trying to unregister an attribute listener for attribute \"" + attributeName
+ "\" that was never registered");
return;
}
}
} | java | @Override
public void unregisterAttributeListener(String attributeName, AttributeListener attributeListener) {
List<AttributeListener> listeners = attributeListeners.get(attributeName);
if (listeners == null) {
LOG.error("trying to unregister an attribute listener for attribute \"" + attributeName
+ "\" that was never registered");
return;
}
synchronized (listeners) {
boolean success = listeners.remove(attributeListener);
if (!success) {
LOG.error("trying to unregister an attribute listener for attribute \"" + attributeName
+ "\" that was never registered");
return;
}
}
} | [
"@",
"Override",
"public",
"void",
"unregisterAttributeListener",
"(",
"String",
"attributeName",
",",
"AttributeListener",
"attributeListener",
")",
"{",
"List",
"<",
"AttributeListener",
">",
"listeners",
"=",
"attributeListeners",
".",
"get",
"(",
"attributeName",
... | Unregisters an attribute listener.
@param attributeName the attribute name as defined in the Franca model
to unsubscribe from.
@param attributeListener the listener to remove. | [
"Unregisters",
"an",
"attribute",
"listener",
"."
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/javaapi/src/main/java/io/joynr/provider/AbstractSubscriptionPublisher.java#L143-L159 | train |
bmwcarit/joynr | java/javaapi/src/main/java/io/joynr/provider/AbstractSubscriptionPublisher.java | AbstractSubscriptionPublisher.registerBroadcastListener | @Override
public void registerBroadcastListener(String broadcastName, BroadcastListener broadcastListener) {
broadcastListeners.putIfAbsent(broadcastName, new ArrayList<BroadcastListener>());
List<BroadcastListener> listeners = broadcastListeners.get(broadcastName);
synchronized (listeners) {
listeners.add(broadcastListener);
}
} | java | @Override
public void registerBroadcastListener(String broadcastName, BroadcastListener broadcastListener) {
broadcastListeners.putIfAbsent(broadcastName, new ArrayList<BroadcastListener>());
List<BroadcastListener> listeners = broadcastListeners.get(broadcastName);
synchronized (listeners) {
listeners.add(broadcastListener);
}
} | [
"@",
"Override",
"public",
"void",
"registerBroadcastListener",
"(",
"String",
"broadcastName",
",",
"BroadcastListener",
"broadcastListener",
")",
"{",
"broadcastListeners",
".",
"putIfAbsent",
"(",
"broadcastName",
",",
"new",
"ArrayList",
"<",
"BroadcastListener",
">... | Registers a broadcast listener that gets notified in case the broadcast
is fired.
@param broadcastName the broadcast name as defined in the Franca model
to subscribe to.
@param broadcastListener the listener to add. | [
"Registers",
"a",
"broadcast",
"listener",
"that",
"gets",
"notified",
"in",
"case",
"the",
"broadcast",
"is",
"fired",
"."
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/javaapi/src/main/java/io/joynr/provider/AbstractSubscriptionPublisher.java#L169-L176 | train |
bmwcarit/joynr | java/javaapi/src/main/java/io/joynr/provider/AbstractSubscriptionPublisher.java | AbstractSubscriptionPublisher.unregisterBroadcastListener | @Override
public void unregisterBroadcastListener(String broadcastName, BroadcastListener broadcastListener) {
List<BroadcastListener> listeners = broadcastListeners.get(broadcastName);
if (listeners == null) {
LOG.error("trying to unregister a listener for broadcast \"" + broadcastName
+ "\" that was never registered");
return;
}
synchronized (listeners) {
boolean success = listeners.remove(broadcastListener);
if (!success) {
LOG.error("trying to unregister a listener for broadcast \"" + broadcastName
+ "\" that was never registered");
return;
}
}
} | java | @Override
public void unregisterBroadcastListener(String broadcastName, BroadcastListener broadcastListener) {
List<BroadcastListener> listeners = broadcastListeners.get(broadcastName);
if (listeners == null) {
LOG.error("trying to unregister a listener for broadcast \"" + broadcastName
+ "\" that was never registered");
return;
}
synchronized (listeners) {
boolean success = listeners.remove(broadcastListener);
if (!success) {
LOG.error("trying to unregister a listener for broadcast \"" + broadcastName
+ "\" that was never registered");
return;
}
}
} | [
"@",
"Override",
"public",
"void",
"unregisterBroadcastListener",
"(",
"String",
"broadcastName",
",",
"BroadcastListener",
"broadcastListener",
")",
"{",
"List",
"<",
"BroadcastListener",
">",
"listeners",
"=",
"broadcastListeners",
".",
"get",
"(",
"broadcastName",
... | Unregisters a broadcast listener.
@param broadcastName the broadcast name as defined in the Franca model
to unsubscribe from.
@param broadcastListener the listener to remove. | [
"Unregisters",
"a",
"broadcast",
"listener",
"."
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/javaapi/src/main/java/io/joynr/provider/AbstractSubscriptionPublisher.java#L185-L201 | train |
bmwcarit/joynr | java/javaapi/src/main/java/io/joynr/provider/AbstractSubscriptionPublisher.java | AbstractSubscriptionPublisher.addBroadcastFilter | @Override
public void addBroadcastFilter(BroadcastFilterImpl filter) {
if (broadcastFilters.containsKey(filter.getName())) {
broadcastFilters.get(filter.getName()).add(filter);
} else {
ArrayList<BroadcastFilter> list = new ArrayList<BroadcastFilter>();
list.add(filter);
broadcastFilters.put(filter.getName(), list);
}
} | java | @Override
public void addBroadcastFilter(BroadcastFilterImpl filter) {
if (broadcastFilters.containsKey(filter.getName())) {
broadcastFilters.get(filter.getName()).add(filter);
} else {
ArrayList<BroadcastFilter> list = new ArrayList<BroadcastFilter>();
list.add(filter);
broadcastFilters.put(filter.getName(), list);
}
} | [
"@",
"Override",
"public",
"void",
"addBroadcastFilter",
"(",
"BroadcastFilterImpl",
"filter",
")",
"{",
"if",
"(",
"broadcastFilters",
".",
"containsKey",
"(",
"filter",
".",
"getName",
"(",
")",
")",
")",
"{",
"broadcastFilters",
".",
"get",
"(",
"filter",
... | Adds a broadcast filter to the provider. The filter is specific for a
single broadcast as defined in the Franca model. It will be executed
once for each subscribed client whenever the broadcast is fired. Clients
set individual filter parameters to control filter behavior.
@param filter the filter to add. | [
"Adds",
"a",
"broadcast",
"filter",
"to",
"the",
"provider",
".",
"The",
"filter",
"is",
"specific",
"for",
"a",
"single",
"broadcast",
"as",
"defined",
"in",
"the",
"Franca",
"model",
".",
"It",
"will",
"be",
"executed",
"once",
"for",
"each",
"subscribed... | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/javaapi/src/main/java/io/joynr/provider/AbstractSubscriptionPublisher.java#L225-L234 | train |
bmwcarit/joynr | java/javaapi/src/main/java/io/joynr/provider/AbstractSubscriptionPublisher.java | AbstractSubscriptionPublisher.addBroadcastFilter | @Override
public void addBroadcastFilter(BroadcastFilterImpl... filters) {
List<BroadcastFilterImpl> filtersList = Arrays.asList(filters);
for (BroadcastFilterImpl filter : filtersList) {
addBroadcastFilter(filter);
}
} | java | @Override
public void addBroadcastFilter(BroadcastFilterImpl... filters) {
List<BroadcastFilterImpl> filtersList = Arrays.asList(filters);
for (BroadcastFilterImpl filter : filtersList) {
addBroadcastFilter(filter);
}
} | [
"@",
"Override",
"public",
"void",
"addBroadcastFilter",
"(",
"BroadcastFilterImpl",
"...",
"filters",
")",
"{",
"List",
"<",
"BroadcastFilterImpl",
">",
"filtersList",
"=",
"Arrays",
".",
"asList",
"(",
"filters",
")",
";",
"for",
"(",
"BroadcastFilterImpl",
"f... | Adds multiple broadcast filters to the provider.
@param filters the filters to add.
@see AbstractSubscriptionPublisher#addBroadcastFilter(BroadcastFilterImpl filter) | [
"Adds",
"multiple",
"broadcast",
"filters",
"to",
"the",
"provider",
"."
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/javaapi/src/main/java/io/joynr/provider/AbstractSubscriptionPublisher.java#L242-L249 | train |
bmwcarit/joynr | java/javaapi/src/main/java/io/joynr/provider/PromiseKeeper.java | PromiseKeeper.getValues | @CheckForNull
public Object[] getValues(long timeout) throws InterruptedException {
if (!isSettled()) {
synchronized (this) {
wait(timeout);
}
}
if (values == null) {
return null;
}
return Arrays.copyOf(values, values.length);
} | java | @CheckForNull
public Object[] getValues(long timeout) throws InterruptedException {
if (!isSettled()) {
synchronized (this) {
wait(timeout);
}
}
if (values == null) {
return null;
}
return Arrays.copyOf(values, values.length);
} | [
"@",
"CheckForNull",
"public",
"Object",
"[",
"]",
"getValues",
"(",
"long",
"timeout",
")",
"throws",
"InterruptedException",
"{",
"if",
"(",
"!",
"isSettled",
"(",
")",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"wait",
"(",
"timeout",
")",
";",
... | Get the resolved values of the promise. If the promise is not settled,
the call blocks until the promise is settled or timeout is reached.
@param timeout the maximum time to wait in milliseconds.
@return the resolved values or null in case of timeout.
@throws InterruptedException if the thread is interrupted. | [
"Get",
"the",
"resolved",
"values",
"of",
"the",
"promise",
".",
"If",
"the",
"promise",
"is",
"not",
"settled",
"the",
"call",
"blocks",
"until",
"the",
"promise",
"is",
"settled",
"or",
"timeout",
"is",
"reached",
"."
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/javaapi/src/main/java/io/joynr/provider/PromiseKeeper.java#L74-L85 | train |
bmwcarit/joynr | java/core/clustercontroller/src/main/java/io/joynr/accesscontrol/AccessControllerImpl.java | AccessControllerImpl.getCapabilityEntry | private void getCapabilityEntry(ImmutableMessage message, CapabilityCallback callback) {
long cacheMaxAge = Long.MAX_VALUE;
DiscoveryQos discoveryQos = new DiscoveryQos(DiscoveryQos.NO_MAX_AGE,
ArbitrationStrategy.NotSet,
cacheMaxAge,
DiscoveryScope.LOCAL_THEN_GLOBAL);
String participantId = message.getRecipient();
localCapabilitiesDirectory.lookup(participantId, discoveryQos, callback);
} | java | private void getCapabilityEntry(ImmutableMessage message, CapabilityCallback callback) {
long cacheMaxAge = Long.MAX_VALUE;
DiscoveryQos discoveryQos = new DiscoveryQos(DiscoveryQos.NO_MAX_AGE,
ArbitrationStrategy.NotSet,
cacheMaxAge,
DiscoveryScope.LOCAL_THEN_GLOBAL);
String participantId = message.getRecipient();
localCapabilitiesDirectory.lookup(participantId, discoveryQos, callback);
} | [
"private",
"void",
"getCapabilityEntry",
"(",
"ImmutableMessage",
"message",
",",
"CapabilityCallback",
"callback",
")",
"{",
"long",
"cacheMaxAge",
"=",
"Long",
".",
"MAX_VALUE",
";",
"DiscoveryQos",
"discoveryQos",
"=",
"new",
"DiscoveryQos",
"(",
"DiscoveryQos",
... | Get the capability entry for the given message | [
"Get",
"the",
"capability",
"entry",
"for",
"the",
"given",
"message"
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/core/clustercontroller/src/main/java/io/joynr/accesscontrol/AccessControllerImpl.java#L173-L183 | train |
bmwcarit/joynr | java/javaapi/src/main/java/io/joynr/util/JoynrUtil.java | JoynrUtil.copyDirectory | public static void copyDirectory(File sourceLocation, File targetLocation) throws IOException {
if (sourceLocation.isDirectory()) {
if (!targetLocation.exists()) {
if (targetLocation.mkdir() == false) {
logger.debug("Creating target directory " + targetLocation + " failed.");
}
}
String[] children = sourceLocation.list();
if (children == null) {
return;
}
for (int i = 0; i < children.length; i++) {
copyDirectory(new File(sourceLocation, children[i]), new File(targetLocation, children[i]));
}
} else {
FileInputStream in = null;
FileOutputStream out = null;
try {
in = new FileInputStream(sourceLocation);
out = new FileOutputStream(targetLocation);
copyStream(in, out);
} finally {
if (in != null) {
in.close();
}
if (out != null) {
out.close();
}
}
}
} | java | public static void copyDirectory(File sourceLocation, File targetLocation) throws IOException {
if (sourceLocation.isDirectory()) {
if (!targetLocation.exists()) {
if (targetLocation.mkdir() == false) {
logger.debug("Creating target directory " + targetLocation + " failed.");
}
}
String[] children = sourceLocation.list();
if (children == null) {
return;
}
for (int i = 0; i < children.length; i++) {
copyDirectory(new File(sourceLocation, children[i]), new File(targetLocation, children[i]));
}
} else {
FileInputStream in = null;
FileOutputStream out = null;
try {
in = new FileInputStream(sourceLocation);
out = new FileOutputStream(targetLocation);
copyStream(in, out);
} finally {
if (in != null) {
in.close();
}
if (out != null) {
out.close();
}
}
}
} | [
"public",
"static",
"void",
"copyDirectory",
"(",
"File",
"sourceLocation",
",",
"File",
"targetLocation",
")",
"throws",
"IOException",
"{",
"if",
"(",
"sourceLocation",
".",
"isDirectory",
"(",
")",
")",
"{",
"if",
"(",
"!",
"targetLocation",
".",
"exists",
... | If targetLocation does not exist, it will be created. | [
"If",
"targetLocation",
"does",
"not",
"exist",
"it",
"will",
"be",
"created",
"."
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/javaapi/src/main/java/io/joynr/util/JoynrUtil.java#L126-L159 | train |
bmwcarit/joynr | java/core/libjoynr/src/main/java/io/joynr/arbitration/VersionCompatibilityChecker.java | VersionCompatibilityChecker.check | public boolean check(Version caller, Version provider) {
if (caller == null || provider == null) {
throw new IllegalArgumentException(format("Both caller (%s) and provider (%s) must be non-null.",
caller,
provider));
}
if (caller.getMajorVersion() == null || caller.getMinorVersion() == null || provider.getMajorVersion() == null
|| provider.getMinorVersion() == null) {
throw new IllegalArgumentException(format("Neither major nor minor version values can be null in either caller %s or provider %s.",
caller,
provider));
}
int callerMajor = caller.getMajorVersion();
int callerMinor = caller.getMinorVersion();
int providerMajor = provider.getMajorVersion();
int providerMinor = provider.getMinorVersion();
return callerMajor == providerMajor && callerMinor <= providerMinor;
} | java | public boolean check(Version caller, Version provider) {
if (caller == null || provider == null) {
throw new IllegalArgumentException(format("Both caller (%s) and provider (%s) must be non-null.",
caller,
provider));
}
if (caller.getMajorVersion() == null || caller.getMinorVersion() == null || provider.getMajorVersion() == null
|| provider.getMinorVersion() == null) {
throw new IllegalArgumentException(format("Neither major nor minor version values can be null in either caller %s or provider %s.",
caller,
provider));
}
int callerMajor = caller.getMajorVersion();
int callerMinor = caller.getMinorVersion();
int providerMajor = provider.getMajorVersion();
int providerMinor = provider.getMinorVersion();
return callerMajor == providerMajor && callerMinor <= providerMinor;
} | [
"public",
"boolean",
"check",
"(",
"Version",
"caller",
",",
"Version",
"provider",
")",
"{",
"if",
"(",
"caller",
"==",
"null",
"||",
"provider",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"format",
"(",
"\"Both caller (%s) and p... | Compatibility of two versions is defined as the caller and provider versions having the same major version, and
the provider having the same or a higher minor version as the caller.
@param caller
the version of the participant performing the call. Must not be <code>null</code>. If either major or
minor is <code>null</code>, this will be interpreted as <code>0</code>.
@param provider
the version of the provider who is being called. Must not be <code>null</code>. If either major or
minor is <code>null</code>, this will be interpreted as <code>0</code>.
@return <code>true</code> if the versions are compatible as described above, or <code>false</code> if not.
@throws IllegalArgumentException
if either caller or provider are <code>null</code>. | [
"Compatibility",
"of",
"two",
"versions",
"is",
"defined",
"as",
"the",
"caller",
"and",
"provider",
"versions",
"having",
"the",
"same",
"major",
"version",
"and",
"the",
"provider",
"having",
"the",
"same",
"or",
"a",
"higher",
"minor",
"version",
"as",
"t... | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/core/libjoynr/src/main/java/io/joynr/arbitration/VersionCompatibilityChecker.java#L48-L67 | train |
bmwcarit/joynr | java/common/discovery-common/src/main/java/io/joynr/capabilities/CapabilityUtils.java | CapabilityUtils.newGlobalDiscoveryEntry | public static GlobalDiscoveryEntry newGlobalDiscoveryEntry(Version providerVesion,
String domain,
String interfaceName,
String participantId,
ProviderQos qos,
Long lastSeenDateMs,
Long expiryDateMs,
String publicKeyId,
Address address) {
// CHECKSTYLE ON
return new GlobalDiscoveryEntry(providerVesion,
domain,
interfaceName,
participantId,
qos,
lastSeenDateMs,
expiryDateMs,
publicKeyId,
serializeAddress(address));
} | java | public static GlobalDiscoveryEntry newGlobalDiscoveryEntry(Version providerVesion,
String domain,
String interfaceName,
String participantId,
ProviderQos qos,
Long lastSeenDateMs,
Long expiryDateMs,
String publicKeyId,
Address address) {
// CHECKSTYLE ON
return new GlobalDiscoveryEntry(providerVesion,
domain,
interfaceName,
participantId,
qos,
lastSeenDateMs,
expiryDateMs,
publicKeyId,
serializeAddress(address));
} | [
"public",
"static",
"GlobalDiscoveryEntry",
"newGlobalDiscoveryEntry",
"(",
"Version",
"providerVesion",
",",
"String",
"domain",
",",
"String",
"interfaceName",
",",
"String",
"participantId",
",",
"ProviderQos",
"qos",
",",
"Long",
"lastSeenDateMs",
",",
"Long",
"ex... | CHECKSTYLE IGNORE ParameterNumber FOR NEXT 1 LINES | [
"CHECKSTYLE",
"IGNORE",
"ParameterNumber",
"FOR",
"NEXT",
"1",
"LINES"
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/common/discovery-common/src/main/java/io/joynr/capabilities/CapabilityUtils.java#L67-L86 | train |
bmwcarit/joynr | java/core/libjoynr/src/main/java/io/joynr/proxy/ProxyInvocationHandler.java | ProxyInvocationHandler.invoke | @Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
if (throwable != null) {
throw throwable;
}
try {
return invokeInternal(proxy, method, args);
} catch (Exception e) {
if (this.throwable != null) {
logger.debug("exception caught: {} overridden by: {}", e.getMessage(), throwable.getMessage());
throw throwable;
} else {
throw e;
}
}
} | java | @Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
if (throwable != null) {
throw throwable;
}
try {
return invokeInternal(proxy, method, args);
} catch (Exception e) {
if (this.throwable != null) {
logger.debug("exception caught: {} overridden by: {}", e.getMessage(), throwable.getMessage());
throw throwable;
} else {
throw e;
}
}
} | [
"@",
"Override",
"public",
"Object",
"invoke",
"(",
"Object",
"proxy",
",",
"Method",
"method",
",",
"Object",
"[",
"]",
"args",
")",
"throws",
"Throwable",
"{",
"if",
"(",
"throwable",
"!=",
"null",
")",
"{",
"throw",
"throwable",
";",
"}",
"try",
"{"... | The InvocationHandler invoke method is mapped to the ProxyInvocationHandler.invokeInternal | [
"The",
"InvocationHandler",
"invoke",
"method",
"is",
"mapped",
"to",
"the",
"ProxyInvocationHandler",
".",
"invokeInternal"
] | b7a92bad1cf2f093de080facd2c803560f4c6c26 | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/core/libjoynr/src/main/java/io/joynr/proxy/ProxyInvocationHandler.java#L55-L70 | train |
camunda/camunda-bpmn-model | src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractEndEventBuilder.java | AbstractEndEventBuilder.error | public B error(String errorCode) {
ErrorEventDefinition errorEventDefinition = createErrorEventDefinition(errorCode);
element.getEventDefinitions().add(errorEventDefinition);
return myself;
} | java | public B error(String errorCode) {
ErrorEventDefinition errorEventDefinition = createErrorEventDefinition(errorCode);
element.getEventDefinitions().add(errorEventDefinition);
return myself;
} | [
"public",
"B",
"error",
"(",
"String",
"errorCode",
")",
"{",
"ErrorEventDefinition",
"errorEventDefinition",
"=",
"createErrorEventDefinition",
"(",
"errorCode",
")",
";",
"element",
".",
"getEventDefinitions",
"(",
")",
".",
"add",
"(",
"errorEventDefinition",
")"... | Sets an error definition for the given error code. If already an error
with this code exists it will be used, otherwise a new error is created.
@param errorCode the code of the error
@return the builder object | [
"Sets",
"an",
"error",
"definition",
"for",
"the",
"given",
"error",
"code",
".",
"If",
"already",
"an",
"error",
"with",
"this",
"code",
"exists",
"it",
"will",
"be",
"used",
"otherwise",
"a",
"new",
"error",
"is",
"created",
"."
] | debcadf041d10fa62b799de0307b832cea84e5d4 | https://github.com/camunda/camunda-bpmn-model/blob/debcadf041d10fa62b799de0307b832cea84e5d4/src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractEndEventBuilder.java#L39-L44 | train |
camunda/camunda-bpmn-model | src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractBaseElementBuilder.java | AbstractBaseElementBuilder.addExtensionElement | public B addExtensionElement(BpmnModelElementInstance extensionElement) {
ExtensionElements extensionElements = getCreateSingleChild(ExtensionElements.class);
extensionElements.addChildElement(extensionElement);
return myself;
} | java | public B addExtensionElement(BpmnModelElementInstance extensionElement) {
ExtensionElements extensionElements = getCreateSingleChild(ExtensionElements.class);
extensionElements.addChildElement(extensionElement);
return myself;
} | [
"public",
"B",
"addExtensionElement",
"(",
"BpmnModelElementInstance",
"extensionElement",
")",
"{",
"ExtensionElements",
"extensionElements",
"=",
"getCreateSingleChild",
"(",
"ExtensionElements",
".",
"class",
")",
";",
"extensionElements",
".",
"addChildElement",
"(",
... | Add an extension element to the element.
@param extensionElement the extension element to add
@return the builder object | [
"Add",
"an",
"extension",
"element",
"to",
"the",
"element",
"."
] | debcadf041d10fa62b799de0307b832cea84e5d4 | https://github.com/camunda/camunda-bpmn-model/blob/debcadf041d10fa62b799de0307b832cea84e5d4/src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractBaseElementBuilder.java#L254-L258 | train |
camunda/camunda-bpmn-model | src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractFlowNodeBuilder.java | AbstractFlowNodeBuilder.camundaFailedJobRetryTimeCycle | public B camundaFailedJobRetryTimeCycle(String retryTimeCycle) {
CamundaFailedJobRetryTimeCycle failedJobRetryTimeCycle = createInstance(CamundaFailedJobRetryTimeCycle.class);
failedJobRetryTimeCycle.setTextContent(retryTimeCycle);
addExtensionElement(failedJobRetryTimeCycle);
return myself;
} | java | public B camundaFailedJobRetryTimeCycle(String retryTimeCycle) {
CamundaFailedJobRetryTimeCycle failedJobRetryTimeCycle = createInstance(CamundaFailedJobRetryTimeCycle.class);
failedJobRetryTimeCycle.setTextContent(retryTimeCycle);
addExtensionElement(failedJobRetryTimeCycle);
return myself;
} | [
"public",
"B",
"camundaFailedJobRetryTimeCycle",
"(",
"String",
"retryTimeCycle",
")",
"{",
"CamundaFailedJobRetryTimeCycle",
"failedJobRetryTimeCycle",
"=",
"createInstance",
"(",
"CamundaFailedJobRetryTimeCycle",
".",
"class",
")",
";",
"failedJobRetryTimeCycle",
".",
"setT... | Sets the camunda failedJobRetryTimeCycle attribute for the build flow node.
@param retryTimeCycle
the retry time cycle value to set
@return the builder object | [
"Sets",
"the",
"camunda",
"failedJobRetryTimeCycle",
"attribute",
"for",
"the",
"build",
"flow",
"node",
"."
] | debcadf041d10fa62b799de0307b832cea84e5d4 | https://github.com/camunda/camunda-bpmn-model/blob/debcadf041d10fa62b799de0307b832cea84e5d4/src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractFlowNodeBuilder.java#L409-L416 | train |
camunda/camunda-bpmn-model | src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractSendTaskBuilder.java | AbstractSendTaskBuilder.message | public B message(String messageName) {
Message message = findMessageForName(messageName);
return message(message);
} | java | public B message(String messageName) {
Message message = findMessageForName(messageName);
return message(message);
} | [
"public",
"B",
"message",
"(",
"String",
"messageName",
")",
"{",
"Message",
"message",
"=",
"findMessageForName",
"(",
"messageName",
")",
";",
"return",
"message",
"(",
"message",
")",
";",
"}"
] | Sets the message with the given message name. If already a message
with this name exists it will be used, otherwise a new message is created.
@param messageName the name of the message
@return the builder object | [
"Sets",
"the",
"message",
"with",
"the",
"given",
"message",
"name",
".",
"If",
"already",
"a",
"message",
"with",
"this",
"name",
"exists",
"it",
"will",
"be",
"used",
"otherwise",
"a",
"new",
"message",
"is",
"created",
"."
] | debcadf041d10fa62b799de0307b832cea84e5d4 | https://github.com/camunda/camunda-bpmn-model/blob/debcadf041d10fa62b799de0307b832cea84e5d4/src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractSendTaskBuilder.java#L61-L64 | train |
camunda/camunda-bpmn-model | src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractCallActivityBuilder.java | AbstractCallActivityBuilder.camundaOut | public B camundaOut(String source, String target) {
CamundaOut param = modelInstance.newInstance(CamundaOut.class);
param.setCamundaSource(source);
param.setCamundaTarget(target);
addExtensionElement(param);
return myself;
} | java | public B camundaOut(String source, String target) {
CamundaOut param = modelInstance.newInstance(CamundaOut.class);
param.setCamundaSource(source);
param.setCamundaTarget(target);
addExtensionElement(param);
return myself;
} | [
"public",
"B",
"camundaOut",
"(",
"String",
"source",
",",
"String",
"target",
")",
"{",
"CamundaOut",
"param",
"=",
"modelInstance",
".",
"newInstance",
"(",
"CamundaOut",
".",
"class",
")",
";",
"param",
".",
"setCamundaSource",
"(",
"source",
")",
";",
... | Sets a "camunda out" parameter to pass a variable from a sub process instance to the super process instance
@param source the name of variable in the sub process instance
@param target the name of the variable in the super process instance
@return the builder object | [
"Sets",
"a",
"camunda",
"out",
"parameter",
"to",
"pass",
"a",
"variable",
"from",
"a",
"sub",
"process",
"instance",
"to",
"the",
"super",
"process",
"instance"
] | debcadf041d10fa62b799de0307b832cea84e5d4 | https://github.com/camunda/camunda-bpmn-model/blob/debcadf041d10fa62b799de0307b832cea84e5d4/src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractCallActivityBuilder.java#L181-L187 | train |
camunda/camunda-bpmn-model | src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractCatchEventBuilder.java | AbstractCatchEventBuilder.message | public B message(String messageName) {
MessageEventDefinition messageEventDefinition = createMessageEventDefinition(messageName);
element.getEventDefinitions().add(messageEventDefinition);
return myself;
} | java | public B message(String messageName) {
MessageEventDefinition messageEventDefinition = createMessageEventDefinition(messageName);
element.getEventDefinitions().add(messageEventDefinition);
return myself;
} | [
"public",
"B",
"message",
"(",
"String",
"messageName",
")",
"{",
"MessageEventDefinition",
"messageEventDefinition",
"=",
"createMessageEventDefinition",
"(",
"messageName",
")",
";",
"element",
".",
"getEventDefinitions",
"(",
")",
".",
"add",
"(",
"messageEventDefi... | Sets an event definition for the given message name. If already a message
with this name exists it will be used, otherwise a new message is created.
@param messageName the name of the message
@return the builder object | [
"Sets",
"an",
"event",
"definition",
"for",
"the",
"given",
"message",
"name",
".",
"If",
"already",
"a",
"message",
"with",
"this",
"name",
"exists",
"it",
"will",
"be",
"used",
"otherwise",
"a",
"new",
"message",
"is",
"created",
"."
] | debcadf041d10fa62b799de0307b832cea84e5d4 | https://github.com/camunda/camunda-bpmn-model/blob/debcadf041d10fa62b799de0307b832cea84e5d4/src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractCatchEventBuilder.java#L58-L63 | train |
camunda/camunda-bpmn-model | src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractCatchEventBuilder.java | AbstractCatchEventBuilder.signal | public B signal(String signalName) {
SignalEventDefinition signalEventDefinition = createSignalEventDefinition(signalName);
element.getEventDefinitions().add(signalEventDefinition);
return myself;
} | java | public B signal(String signalName) {
SignalEventDefinition signalEventDefinition = createSignalEventDefinition(signalName);
element.getEventDefinitions().add(signalEventDefinition);
return myself;
} | [
"public",
"B",
"signal",
"(",
"String",
"signalName",
")",
"{",
"SignalEventDefinition",
"signalEventDefinition",
"=",
"createSignalEventDefinition",
"(",
"signalName",
")",
";",
"element",
".",
"getEventDefinitions",
"(",
")",
".",
"add",
"(",
"signalEventDefinition"... | Sets an event definition for the given signal name. If already a signal
with this name exists it will be used, otherwise a new signal is created.
@param signalName the name of the signal
@return the builder object | [
"Sets",
"an",
"event",
"definition",
"for",
"the",
"given",
"signal",
"name",
".",
"If",
"already",
"a",
"signal",
"with",
"this",
"name",
"exists",
"it",
"will",
"be",
"used",
"otherwise",
"a",
"new",
"signal",
"is",
"created",
"."
] | debcadf041d10fa62b799de0307b832cea84e5d4 | https://github.com/camunda/camunda-bpmn-model/blob/debcadf041d10fa62b799de0307b832cea84e5d4/src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractCatchEventBuilder.java#L72-L77 | train |
camunda/camunda-bpmn-model | src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractCatchEventBuilder.java | AbstractCatchEventBuilder.timerWithDate | public B timerWithDate(String timerDate) {
TimeDate timeDate = createInstance(TimeDate.class);
timeDate.setTextContent(timerDate);
TimerEventDefinition timerEventDefinition = createInstance(TimerEventDefinition.class);
timerEventDefinition.setTimeDate(timeDate);
element.getEventDefinitions().add(timerEventDefinition);
return myself;
} | java | public B timerWithDate(String timerDate) {
TimeDate timeDate = createInstance(TimeDate.class);
timeDate.setTextContent(timerDate);
TimerEventDefinition timerEventDefinition = createInstance(TimerEventDefinition.class);
timerEventDefinition.setTimeDate(timeDate);
element.getEventDefinitions().add(timerEventDefinition);
return myself;
} | [
"public",
"B",
"timerWithDate",
"(",
"String",
"timerDate",
")",
"{",
"TimeDate",
"timeDate",
"=",
"createInstance",
"(",
"TimeDate",
".",
"class",
")",
";",
"timeDate",
".",
"setTextContent",
"(",
"timerDate",
")",
";",
"TimerEventDefinition",
"timerEventDefiniti... | Sets an event definition for the timer with a time date.
@param timerDate the time date of the timer
@return the builder object | [
"Sets",
"an",
"event",
"definition",
"for",
"the",
"timer",
"with",
"a",
"time",
"date",
"."
] | debcadf041d10fa62b799de0307b832cea84e5d4 | https://github.com/camunda/camunda-bpmn-model/blob/debcadf041d10fa62b799de0307b832cea84e5d4/src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractCatchEventBuilder.java#L86-L96 | train |
camunda/camunda-bpmn-model | src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractCatchEventBuilder.java | AbstractCatchEventBuilder.timerWithDuration | public B timerWithDuration(String timerDuration) {
TimeDuration timeDuration = createInstance(TimeDuration.class);
timeDuration.setTextContent(timerDuration);
TimerEventDefinition timerEventDefinition = createInstance(TimerEventDefinition.class);
timerEventDefinition.setTimeDuration(timeDuration);
element.getEventDefinitions().add(timerEventDefinition);
return myself;
} | java | public B timerWithDuration(String timerDuration) {
TimeDuration timeDuration = createInstance(TimeDuration.class);
timeDuration.setTextContent(timerDuration);
TimerEventDefinition timerEventDefinition = createInstance(TimerEventDefinition.class);
timerEventDefinition.setTimeDuration(timeDuration);
element.getEventDefinitions().add(timerEventDefinition);
return myself;
} | [
"public",
"B",
"timerWithDuration",
"(",
"String",
"timerDuration",
")",
"{",
"TimeDuration",
"timeDuration",
"=",
"createInstance",
"(",
"TimeDuration",
".",
"class",
")",
";",
"timeDuration",
".",
"setTextContent",
"(",
"timerDuration",
")",
";",
"TimerEventDefini... | Sets an event definition for the timer with a time duration.
@param timerDuration the time duration of the timer
@return the builder object | [
"Sets",
"an",
"event",
"definition",
"for",
"the",
"timer",
"with",
"a",
"time",
"duration",
"."
] | debcadf041d10fa62b799de0307b832cea84e5d4 | https://github.com/camunda/camunda-bpmn-model/blob/debcadf041d10fa62b799de0307b832cea84e5d4/src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractCatchEventBuilder.java#L104-L114 | train |
camunda/camunda-bpmn-model | src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractCatchEventBuilder.java | AbstractCatchEventBuilder.timerWithCycle | public B timerWithCycle(String timerCycle) {
TimeCycle timeCycle = createInstance(TimeCycle.class);
timeCycle.setTextContent(timerCycle);
TimerEventDefinition timerEventDefinition = createInstance(TimerEventDefinition.class);
timerEventDefinition.setTimeCycle(timeCycle);
element.getEventDefinitions().add(timerEventDefinition);
return myself;
} | java | public B timerWithCycle(String timerCycle) {
TimeCycle timeCycle = createInstance(TimeCycle.class);
timeCycle.setTextContent(timerCycle);
TimerEventDefinition timerEventDefinition = createInstance(TimerEventDefinition.class);
timerEventDefinition.setTimeCycle(timeCycle);
element.getEventDefinitions().add(timerEventDefinition);
return myself;
} | [
"public",
"B",
"timerWithCycle",
"(",
"String",
"timerCycle",
")",
"{",
"TimeCycle",
"timeCycle",
"=",
"createInstance",
"(",
"TimeCycle",
".",
"class",
")",
";",
"timeCycle",
".",
"setTextContent",
"(",
"timerCycle",
")",
";",
"TimerEventDefinition",
"timerEventD... | Sets an event definition for the timer with a time cycle.
@param timerCycle the time cycle of the timer
@return the builder object | [
"Sets",
"an",
"event",
"definition",
"for",
"the",
"timer",
"with",
"a",
"time",
"cycle",
"."
] | debcadf041d10fa62b799de0307b832cea84e5d4 | https://github.com/camunda/camunda-bpmn-model/blob/debcadf041d10fa62b799de0307b832cea84e5d4/src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractCatchEventBuilder.java#L122-L132 | train |
camunda/camunda-bpmn-model | src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractBpmnModelElementBuilder.java | AbstractBpmnModelElementBuilder.subProcessDone | public SubProcessBuilder subProcessDone() {
BpmnModelElementInstance lastSubProcess = element.getScope();
if (lastSubProcess != null && lastSubProcess instanceof SubProcess) {
return ((SubProcess) lastSubProcess).builder();
}
else {
throw new BpmnModelException("Unable to find a parent subProcess.");
}
} | java | public SubProcessBuilder subProcessDone() {
BpmnModelElementInstance lastSubProcess = element.getScope();
if (lastSubProcess != null && lastSubProcess instanceof SubProcess) {
return ((SubProcess) lastSubProcess).builder();
}
else {
throw new BpmnModelException("Unable to find a parent subProcess.");
}
} | [
"public",
"SubProcessBuilder",
"subProcessDone",
"(",
")",
"{",
"BpmnModelElementInstance",
"lastSubProcess",
"=",
"element",
".",
"getScope",
"(",
")",
";",
"if",
"(",
"lastSubProcess",
"!=",
"null",
"&&",
"lastSubProcess",
"instanceof",
"SubProcess",
")",
"{",
"... | Finishes the building of an embedded sub-process.
@return the parent sub-process builder
@throws BpmnModelException if no parent sub-process can be found | [
"Finishes",
"the",
"building",
"of",
"an",
"embedded",
"sub",
"-",
"process",
"."
] | debcadf041d10fa62b799de0307b832cea84e5d4 | https://github.com/camunda/camunda-bpmn-model/blob/debcadf041d10fa62b799de0307b832cea84e5d4/src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractBpmnModelElementBuilder.java#L59-L67 | train |
camunda/camunda-bpmn-model | src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractBoundaryEventBuilder.java | AbstractBoundaryEventBuilder.error | public B error() {
ErrorEventDefinition errorEventDefinition = createInstance(ErrorEventDefinition.class);
element.getEventDefinitions().add(errorEventDefinition);
return myself;
} | java | public B error() {
ErrorEventDefinition errorEventDefinition = createInstance(ErrorEventDefinition.class);
element.getEventDefinitions().add(errorEventDefinition);
return myself;
} | [
"public",
"B",
"error",
"(",
")",
"{",
"ErrorEventDefinition",
"errorEventDefinition",
"=",
"createInstance",
"(",
"ErrorEventDefinition",
".",
"class",
")",
";",
"element",
".",
"getEventDefinitions",
"(",
")",
".",
"add",
"(",
"errorEventDefinition",
")",
";",
... | Sets a catch all error definition.
@return the builder object | [
"Sets",
"a",
"catch",
"all",
"error",
"definition",
"."
] | debcadf041d10fa62b799de0307b832cea84e5d4 | https://github.com/camunda/camunda-bpmn-model/blob/debcadf041d10fa62b799de0307b832cea84e5d4/src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractBoundaryEventBuilder.java#L52-L57 | train |
camunda/camunda-bpmn-model | src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractBoundaryEventBuilder.java | AbstractBoundaryEventBuilder.errorEventDefinition | public ErrorEventDefinitionBuilder errorEventDefinition(String id) {
ErrorEventDefinition errorEventDefinition = createEmptyErrorEventDefinition();
if (id != null) {
errorEventDefinition.setId(id);
}
element.getEventDefinitions().add(errorEventDefinition);
return new ErrorEventDefinitionBuilder(modelInstance, errorEventDefinition);
} | java | public ErrorEventDefinitionBuilder errorEventDefinition(String id) {
ErrorEventDefinition errorEventDefinition = createEmptyErrorEventDefinition();
if (id != null) {
errorEventDefinition.setId(id);
}
element.getEventDefinitions().add(errorEventDefinition);
return new ErrorEventDefinitionBuilder(modelInstance, errorEventDefinition);
} | [
"public",
"ErrorEventDefinitionBuilder",
"errorEventDefinition",
"(",
"String",
"id",
")",
"{",
"ErrorEventDefinition",
"errorEventDefinition",
"=",
"createEmptyErrorEventDefinition",
"(",
")",
";",
"if",
"(",
"id",
"!=",
"null",
")",
"{",
"errorEventDefinition",
".",
... | Creates an error event definition with an unique id
and returns a builder for the error event definition.
@return the error event definition builder object | [
"Creates",
"an",
"error",
"event",
"definition",
"with",
"an",
"unique",
"id",
"and",
"returns",
"a",
"builder",
"for",
"the",
"error",
"event",
"definition",
"."
] | debcadf041d10fa62b799de0307b832cea84e5d4 | https://github.com/camunda/camunda-bpmn-model/blob/debcadf041d10fa62b799de0307b832cea84e5d4/src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractBoundaryEventBuilder.java#L79-L87 | train |
camunda/camunda-bpmn-model | src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractBoundaryEventBuilder.java | AbstractBoundaryEventBuilder.errorEventDefinition | public ErrorEventDefinitionBuilder errorEventDefinition() {
ErrorEventDefinition errorEventDefinition = createEmptyErrorEventDefinition();
element.getEventDefinitions().add(errorEventDefinition);
return new ErrorEventDefinitionBuilder(modelInstance, errorEventDefinition);
} | java | public ErrorEventDefinitionBuilder errorEventDefinition() {
ErrorEventDefinition errorEventDefinition = createEmptyErrorEventDefinition();
element.getEventDefinitions().add(errorEventDefinition);
return new ErrorEventDefinitionBuilder(modelInstance, errorEventDefinition);
} | [
"public",
"ErrorEventDefinitionBuilder",
"errorEventDefinition",
"(",
")",
"{",
"ErrorEventDefinition",
"errorEventDefinition",
"=",
"createEmptyErrorEventDefinition",
"(",
")",
";",
"element",
".",
"getEventDefinitions",
"(",
")",
".",
"add",
"(",
"errorEventDefinition",
... | Creates an error event definition
and returns a builder for the error event definition.
@return the error event definition builder object | [
"Creates",
"an",
"error",
"event",
"definition",
"and",
"returns",
"a",
"builder",
"for",
"the",
"error",
"event",
"definition",
"."
] | debcadf041d10fa62b799de0307b832cea84e5d4 | https://github.com/camunda/camunda-bpmn-model/blob/debcadf041d10fa62b799de0307b832cea84e5d4/src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractBoundaryEventBuilder.java#L95-L99 | train |
camunda/camunda-bpmn-model | src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractBoundaryEventBuilder.java | AbstractBoundaryEventBuilder.escalation | public B escalation() {
EscalationEventDefinition escalationEventDefinition = createInstance(EscalationEventDefinition.class);
element.getEventDefinitions().add(escalationEventDefinition);
return myself;
} | java | public B escalation() {
EscalationEventDefinition escalationEventDefinition = createInstance(EscalationEventDefinition.class);
element.getEventDefinitions().add(escalationEventDefinition);
return myself;
} | [
"public",
"B",
"escalation",
"(",
")",
"{",
"EscalationEventDefinition",
"escalationEventDefinition",
"=",
"createInstance",
"(",
"EscalationEventDefinition",
".",
"class",
")",
";",
"element",
".",
"getEventDefinitions",
"(",
")",
".",
"add",
"(",
"escalationEventDef... | Sets a catch all escalation definition.
@return the builder object | [
"Sets",
"a",
"catch",
"all",
"escalation",
"definition",
"."
] | debcadf041d10fa62b799de0307b832cea84e5d4 | https://github.com/camunda/camunda-bpmn-model/blob/debcadf041d10fa62b799de0307b832cea84e5d4/src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractBoundaryEventBuilder.java#L106-L111 | train |
camunda/camunda-bpmn-model | src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractBoundaryEventBuilder.java | AbstractBoundaryEventBuilder.escalation | public B escalation(String escalationCode) {
EscalationEventDefinition escalationEventDefinition = createEscalationEventDefinition(escalationCode);
element.getEventDefinitions().add(escalationEventDefinition);
return myself;
} | java | public B escalation(String escalationCode) {
EscalationEventDefinition escalationEventDefinition = createEscalationEventDefinition(escalationCode);
element.getEventDefinitions().add(escalationEventDefinition);
return myself;
} | [
"public",
"B",
"escalation",
"(",
"String",
"escalationCode",
")",
"{",
"EscalationEventDefinition",
"escalationEventDefinition",
"=",
"createEscalationEventDefinition",
"(",
"escalationCode",
")",
";",
"element",
".",
"getEventDefinitions",
"(",
")",
".",
"add",
"(",
... | Sets an escalation definition for the given escalation code. If already an escalation
with this code exists it will be used, otherwise a new escalation is created.
@param escalationCode the code of the escalation
@return the builder object | [
"Sets",
"an",
"escalation",
"definition",
"for",
"the",
"given",
"escalation",
"code",
".",
"If",
"already",
"an",
"escalation",
"with",
"this",
"code",
"exists",
"it",
"will",
"be",
"used",
"otherwise",
"a",
"new",
"escalation",
"is",
"created",
"."
] | debcadf041d10fa62b799de0307b832cea84e5d4 | https://github.com/camunda/camunda-bpmn-model/blob/debcadf041d10fa62b799de0307b832cea84e5d4/src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractBoundaryEventBuilder.java#L120-L125 | train |
camunda/camunda-bpmn-model | src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractUserTaskBuilder.java | AbstractUserTaskBuilder.camundaFormField | public CamundaUserTaskFormFieldBuilder camundaFormField() {
CamundaFormData camundaFormData = getCreateSingleExtensionElement(CamundaFormData.class);
CamundaFormField camundaFormField = createChild(camundaFormData, CamundaFormField.class);
return new CamundaUserTaskFormFieldBuilder(modelInstance, element, camundaFormField);
} | java | public CamundaUserTaskFormFieldBuilder camundaFormField() {
CamundaFormData camundaFormData = getCreateSingleExtensionElement(CamundaFormData.class);
CamundaFormField camundaFormField = createChild(camundaFormData, CamundaFormField.class);
return new CamundaUserTaskFormFieldBuilder(modelInstance, element, camundaFormField);
} | [
"public",
"CamundaUserTaskFormFieldBuilder",
"camundaFormField",
"(",
")",
"{",
"CamundaFormData",
"camundaFormData",
"=",
"getCreateSingleExtensionElement",
"(",
"CamundaFormData",
".",
"class",
")",
";",
"CamundaFormField",
"camundaFormField",
"=",
"createChild",
"(",
"ca... | Creates a new camunda form field extension element.
@return the builder object | [
"Creates",
"a",
"new",
"camunda",
"form",
"field",
"extension",
"element",
"."
] | debcadf041d10fa62b799de0307b832cea84e5d4 | https://github.com/camunda/camunda-bpmn-model/blob/debcadf041d10fa62b799de0307b832cea84e5d4/src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractUserTaskBuilder.java#L176-L180 | train |
camunda/camunda-bpmn-model | src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractComplexGatewayBuilder.java | AbstractComplexGatewayBuilder.activationCondition | public B activationCondition(String conditionExpression) {
ActivationCondition activationCondition = createInstance(ActivationCondition.class);
activationCondition.setTextContent(conditionExpression);
element.setActivationCondition(activationCondition);
return myself;
} | java | public B activationCondition(String conditionExpression) {
ActivationCondition activationCondition = createInstance(ActivationCondition.class);
activationCondition.setTextContent(conditionExpression);
element.setActivationCondition(activationCondition);
return myself;
} | [
"public",
"B",
"activationCondition",
"(",
"String",
"conditionExpression",
")",
"{",
"ActivationCondition",
"activationCondition",
"=",
"createInstance",
"(",
"ActivationCondition",
".",
"class",
")",
";",
"activationCondition",
".",
"setTextContent",
"(",
"conditionExpr... | Sets the activation condition expression for the build complex gateway
@param conditionExpression the activation condition expression to set
@return the builder object | [
"Sets",
"the",
"activation",
"condition",
"expression",
"for",
"the",
"build",
"complex",
"gateway"
] | debcadf041d10fa62b799de0307b832cea84e5d4 | https://github.com/camunda/camunda-bpmn-model/blob/debcadf041d10fa62b799de0307b832cea84e5d4/src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractComplexGatewayBuilder.java#L50-L55 | train |
camunda/camunda-bpmn-model | src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractMultiInstanceLoopCharacteristicsBuilder.java | AbstractMultiInstanceLoopCharacteristicsBuilder.cardinality | public B cardinality(String expression) {
LoopCardinality cardinality = getCreateSingleChild(LoopCardinality.class);
cardinality.setTextContent(expression);
return myself;
} | java | public B cardinality(String expression) {
LoopCardinality cardinality = getCreateSingleChild(LoopCardinality.class);
cardinality.setTextContent(expression);
return myself;
} | [
"public",
"B",
"cardinality",
"(",
"String",
"expression",
")",
"{",
"LoopCardinality",
"cardinality",
"=",
"getCreateSingleChild",
"(",
"LoopCardinality",
".",
"class",
")",
";",
"cardinality",
".",
"setTextContent",
"(",
"expression",
")",
";",
"return",
"myself... | Sets the cardinality expression.
@param expression the cardinality expression
@return the builder object | [
"Sets",
"the",
"cardinality",
"expression",
"."
] | debcadf041d10fa62b799de0307b832cea84e5d4 | https://github.com/camunda/camunda-bpmn-model/blob/debcadf041d10fa62b799de0307b832cea84e5d4/src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractMultiInstanceLoopCharacteristicsBuilder.java#L62-L67 | train |
camunda/camunda-bpmn-model | src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractMultiInstanceLoopCharacteristicsBuilder.java | AbstractMultiInstanceLoopCharacteristicsBuilder.completionCondition | public B completionCondition(String expression) {
CompletionCondition condition = getCreateSingleChild(CompletionCondition.class);
condition.setTextContent(expression);
return myself;
} | java | public B completionCondition(String expression) {
CompletionCondition condition = getCreateSingleChild(CompletionCondition.class);
condition.setTextContent(expression);
return myself;
} | [
"public",
"B",
"completionCondition",
"(",
"String",
"expression",
")",
"{",
"CompletionCondition",
"condition",
"=",
"getCreateSingleChild",
"(",
"CompletionCondition",
".",
"class",
")",
";",
"condition",
".",
"setTextContent",
"(",
"expression",
")",
";",
"return... | Sets the completion condition expression.
@param expression the completion condition expression
@return the builder object | [
"Sets",
"the",
"completion",
"condition",
"expression",
"."
] | debcadf041d10fa62b799de0307b832cea84e5d4 | https://github.com/camunda/camunda-bpmn-model/blob/debcadf041d10fa62b799de0307b832cea84e5d4/src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractMultiInstanceLoopCharacteristicsBuilder.java#L75-L80 | train |
camunda/camunda-bpmn-model | src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractMultiInstanceLoopCharacteristicsBuilder.java | AbstractMultiInstanceLoopCharacteristicsBuilder.multiInstanceDone | @SuppressWarnings({ "rawtypes", "unchecked" })
public <T extends AbstractActivityBuilder> T multiInstanceDone() {
return (T) ((Activity) element.getParentElement()).builder();
} | java | @SuppressWarnings({ "rawtypes", "unchecked" })
public <T extends AbstractActivityBuilder> T multiInstanceDone() {
return (T) ((Activity) element.getParentElement()).builder();
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"rawtypes\"",
",",
"\"unchecked\"",
"}",
")",
"public",
"<",
"T",
"extends",
"AbstractActivityBuilder",
">",
"T",
"multiInstanceDone",
"(",
")",
"{",
"return",
"(",
"T",
")",
"(",
"(",
"Activity",
")",
"element",
".",
"... | Finishes the building of a multi instance loop characteristics.
@return the parent activity builder | [
"Finishes",
"the",
"building",
"of",
"a",
"multi",
"instance",
"loop",
"characteristics",
"."
] | debcadf041d10fa62b799de0307b832cea84e5d4 | https://github.com/camunda/camunda-bpmn-model/blob/debcadf041d10fa62b799de0307b832cea84e5d4/src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractMultiInstanceLoopCharacteristicsBuilder.java#L111-L114 | train |
camunda/camunda-bpmn-model | src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractConditionalEventDefinitionBuilder.java | AbstractConditionalEventDefinitionBuilder.condition | public B condition(String conditionText) {
Condition condition = createInstance(Condition.class);
condition.setTextContent(conditionText);
element.setCondition(condition);
return myself;
} | java | public B condition(String conditionText) {
Condition condition = createInstance(Condition.class);
condition.setTextContent(conditionText);
element.setCondition(condition);
return myself;
} | [
"public",
"B",
"condition",
"(",
"String",
"conditionText",
")",
"{",
"Condition",
"condition",
"=",
"createInstance",
"(",
"Condition",
".",
"class",
")",
";",
"condition",
".",
"setTextContent",
"(",
"conditionText",
")",
";",
"element",
".",
"setCondition",
... | Sets the condition of the conditional event definition.
@param conditionText the condition which should be evaluate to true or false
@return the builder object | [
"Sets",
"the",
"condition",
"of",
"the",
"conditional",
"event",
"definition",
"."
] | debcadf041d10fa62b799de0307b832cea84e5d4 | https://github.com/camunda/camunda-bpmn-model/blob/debcadf041d10fa62b799de0307b832cea84e5d4/src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractConditionalEventDefinitionBuilder.java#L43-L48 | train |
camunda/camunda-bpmn-model | src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractConditionalEventDefinitionBuilder.java | AbstractConditionalEventDefinitionBuilder.conditionalEventDefinitionDone | @SuppressWarnings({ "rawtypes", "unchecked" })
public <T extends AbstractFlowNodeBuilder> T conditionalEventDefinitionDone() {
return (T) ((Event) element.getParentElement()).builder();
} | java | @SuppressWarnings({ "rawtypes", "unchecked" })
public <T extends AbstractFlowNodeBuilder> T conditionalEventDefinitionDone() {
return (T) ((Event) element.getParentElement()).builder();
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"rawtypes\"",
",",
"\"unchecked\"",
"}",
")",
"public",
"<",
"T",
"extends",
"AbstractFlowNodeBuilder",
">",
"T",
"conditionalEventDefinitionDone",
"(",
")",
"{",
"return",
"(",
"T",
")",
"(",
"(",
"Event",
")",
"element",
... | Finishes the building of a conditional event definition.
@param <T>
@return the parent event builder | [
"Finishes",
"the",
"building",
"of",
"a",
"conditional",
"event",
"definition",
"."
] | debcadf041d10fa62b799de0307b832cea84e5d4 | https://github.com/camunda/camunda-bpmn-model/blob/debcadf041d10fa62b799de0307b832cea84e5d4/src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractConditionalEventDefinitionBuilder.java#L92-L95 | train |
camunda/camunda-bpmn-model | src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractErrorEventDefinitionBuilder.java | AbstractErrorEventDefinitionBuilder.errorEventDefinitionDone | @SuppressWarnings({ "rawtypes", "unchecked" })
public <T extends AbstractFlowNodeBuilder> T errorEventDefinitionDone() {
return (T) ((Event) element.getParentElement()).builder();
} | java | @SuppressWarnings({ "rawtypes", "unchecked" })
public <T extends AbstractFlowNodeBuilder> T errorEventDefinitionDone() {
return (T) ((Event) element.getParentElement()).builder();
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"rawtypes\"",
",",
"\"unchecked\"",
"}",
")",
"public",
"<",
"T",
"extends",
"AbstractFlowNodeBuilder",
">",
"T",
"errorEventDefinitionDone",
"(",
")",
"{",
"return",
"(",
"T",
")",
"(",
"(",
"Event",
")",
"element",
".",... | Finishes the building of a error event definition.
@param <T>
@return the parent event builder | [
"Finishes",
"the",
"building",
"of",
"a",
"error",
"event",
"definition",
"."
] | debcadf041d10fa62b799de0307b832cea84e5d4 | https://github.com/camunda/camunda-bpmn-model/blob/debcadf041d10fa62b799de0307b832cea84e5d4/src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractErrorEventDefinitionBuilder.java#L70-L73 | train |
camunda/camunda-bpmn-model | src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractEventBuilder.java | AbstractEventBuilder.camundaInputParameter | public B camundaInputParameter(String name, String value) {
CamundaInputOutput camundaInputOutput = getCreateSingleExtensionElement(CamundaInputOutput.class);
CamundaInputParameter camundaInputParameter = createChild(camundaInputOutput, CamundaInputParameter.class);
camundaInputParameter.setCamundaName(name);
camundaInputParameter.setTextContent(value);
return myself;
} | java | public B camundaInputParameter(String name, String value) {
CamundaInputOutput camundaInputOutput = getCreateSingleExtensionElement(CamundaInputOutput.class);
CamundaInputParameter camundaInputParameter = createChild(camundaInputOutput, CamundaInputParameter.class);
camundaInputParameter.setCamundaName(name);
camundaInputParameter.setTextContent(value);
return myself;
} | [
"public",
"B",
"camundaInputParameter",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"CamundaInputOutput",
"camundaInputOutput",
"=",
"getCreateSingleExtensionElement",
"(",
"CamundaInputOutput",
".",
"class",
")",
";",
"CamundaInputParameter",
"camundaInputPa... | Creates a new camunda input parameter extension element with the
given name and value.
@param name the name of the input parameter
@param value the value of the input parameter
@return the builder object | [
"Creates",
"a",
"new",
"camunda",
"input",
"parameter",
"extension",
"element",
"with",
"the",
"given",
"name",
"and",
"value",
"."
] | debcadf041d10fa62b799de0307b832cea84e5d4 | https://github.com/camunda/camunda-bpmn-model/blob/debcadf041d10fa62b799de0307b832cea84e5d4/src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractEventBuilder.java#L42-L50 | train |
camunda/camunda-bpmn-model | src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractEventBuilder.java | AbstractEventBuilder.camundaOutputParameter | public B camundaOutputParameter(String name, String value) {
CamundaInputOutput camundaInputOutput = getCreateSingleExtensionElement(CamundaInputOutput.class);
CamundaOutputParameter camundaOutputParameter = createChild(camundaInputOutput, CamundaOutputParameter.class);
camundaOutputParameter.setCamundaName(name);
camundaOutputParameter.setTextContent(value);
return myself;
} | java | public B camundaOutputParameter(String name, String value) {
CamundaInputOutput camundaInputOutput = getCreateSingleExtensionElement(CamundaInputOutput.class);
CamundaOutputParameter camundaOutputParameter = createChild(camundaInputOutput, CamundaOutputParameter.class);
camundaOutputParameter.setCamundaName(name);
camundaOutputParameter.setTextContent(value);
return myself;
} | [
"public",
"B",
"camundaOutputParameter",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"CamundaInputOutput",
"camundaInputOutput",
"=",
"getCreateSingleExtensionElement",
"(",
"CamundaInputOutput",
".",
"class",
")",
";",
"CamundaOutputParameter",
"camundaOutpu... | Creates a new camunda output parameter extension element with the
given name and value.
@param name the name of the output parameter
@param value the value of the output parameter
@return the builder object | [
"Creates",
"a",
"new",
"camunda",
"output",
"parameter",
"extension",
"element",
"with",
"the",
"given",
"name",
"and",
"value",
"."
] | debcadf041d10fa62b799de0307b832cea84e5d4 | https://github.com/camunda/camunda-bpmn-model/blob/debcadf041d10fa62b799de0307b832cea84e5d4/src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractEventBuilder.java#L60-L68 | train |
camunda/camunda-bpmn-model | src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractThrowEventBuilder.java | AbstractThrowEventBuilder.messageEventDefinition | public MessageEventDefinitionBuilder messageEventDefinition(String id) {
MessageEventDefinition messageEventDefinition = createEmptyMessageEventDefinition();
if (id != null) {
messageEventDefinition.setId(id);
}
element.getEventDefinitions().add(messageEventDefinition);
return new MessageEventDefinitionBuilder(modelInstance, messageEventDefinition);
} | java | public MessageEventDefinitionBuilder messageEventDefinition(String id) {
MessageEventDefinition messageEventDefinition = createEmptyMessageEventDefinition();
if (id != null) {
messageEventDefinition.setId(id);
}
element.getEventDefinitions().add(messageEventDefinition);
return new MessageEventDefinitionBuilder(modelInstance, messageEventDefinition);
} | [
"public",
"MessageEventDefinitionBuilder",
"messageEventDefinition",
"(",
"String",
"id",
")",
"{",
"MessageEventDefinition",
"messageEventDefinition",
"=",
"createEmptyMessageEventDefinition",
"(",
")",
";",
"if",
"(",
"id",
"!=",
"null",
")",
"{",
"messageEventDefinitio... | Creates an empty message event definition with the given id
and returns a builder for the message event definition.
@param id the id of the message event definition
@return the message event definition builder object | [
"Creates",
"an",
"empty",
"message",
"event",
"definition",
"with",
"the",
"given",
"id",
"and",
"returns",
"a",
"builder",
"for",
"the",
"message",
"event",
"definition",
"."
] | debcadf041d10fa62b799de0307b832cea84e5d4 | https://github.com/camunda/camunda-bpmn-model/blob/debcadf041d10fa62b799de0307b832cea84e5d4/src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractThrowEventBuilder.java#L66-L74 | train |
camunda/camunda-bpmn-model | src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractThrowEventBuilder.java | AbstractThrowEventBuilder.signalEventDefinition | public SignalEventDefinitionBuilder signalEventDefinition(String signalName) {
SignalEventDefinition signalEventDefinition = createSignalEventDefinition(signalName);
element.getEventDefinitions().add(signalEventDefinition);
return new SignalEventDefinitionBuilder(modelInstance, signalEventDefinition);
} | java | public SignalEventDefinitionBuilder signalEventDefinition(String signalName) {
SignalEventDefinition signalEventDefinition = createSignalEventDefinition(signalName);
element.getEventDefinitions().add(signalEventDefinition);
return new SignalEventDefinitionBuilder(modelInstance, signalEventDefinition);
} | [
"public",
"SignalEventDefinitionBuilder",
"signalEventDefinition",
"(",
"String",
"signalName",
")",
"{",
"SignalEventDefinition",
"signalEventDefinition",
"=",
"createSignalEventDefinition",
"(",
"signalName",
")",
";",
"element",
".",
"getEventDefinitions",
"(",
")",
".",... | Sets an event definition for the given Signal name. If a signal with this
name already exists it will be used, otherwise a new signal is created.
It returns a builder for the Signal Event Definition.
@param signalName the name of the signal
@return the signal event definition builder object | [
"Sets",
"an",
"event",
"definition",
"for",
"the",
"given",
"Signal",
"name",
".",
"If",
"a",
"signal",
"with",
"this",
"name",
"already",
"exists",
"it",
"will",
"be",
"used",
"otherwise",
"a",
"new",
"signal",
"is",
"created",
".",
"It",
"returns",
"a"... | debcadf041d10fa62b799de0307b832cea84e5d4 | https://github.com/camunda/camunda-bpmn-model/blob/debcadf041d10fa62b799de0307b832cea84e5d4/src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractThrowEventBuilder.java#L98-L103 | train |
camunda/camunda-bpmn-model | src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractSequenceFlowBuilder.java | AbstractSequenceFlowBuilder.from | public B from(FlowNode source) {
element.setSource(source);
source.getOutgoing().add(element);
return myself;
} | java | public B from(FlowNode source) {
element.setSource(source);
source.getOutgoing().add(element);
return myself;
} | [
"public",
"B",
"from",
"(",
"FlowNode",
"source",
")",
"{",
"element",
".",
"setSource",
"(",
"source",
")",
";",
"source",
".",
"getOutgoing",
"(",
")",
".",
"add",
"(",
"element",
")",
";",
"return",
"myself",
";",
"}"
] | Sets the source flow node of this sequence flow.
@param source the source of this sequence flow
@return the builder object | [
"Sets",
"the",
"source",
"flow",
"node",
"of",
"this",
"sequence",
"flow",
"."
] | debcadf041d10fa62b799de0307b832cea84e5d4 | https://github.com/camunda/camunda-bpmn-model/blob/debcadf041d10fa62b799de0307b832cea84e5d4/src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractSequenceFlowBuilder.java#L39-L43 | train |
camunda/camunda-bpmn-model | src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractSequenceFlowBuilder.java | AbstractSequenceFlowBuilder.to | public B to(FlowNode target) {
element.setTarget(target);
target.getIncoming().add(element);
return myself;
} | java | public B to(FlowNode target) {
element.setTarget(target);
target.getIncoming().add(element);
return myself;
} | [
"public",
"B",
"to",
"(",
"FlowNode",
"target",
")",
"{",
"element",
".",
"setTarget",
"(",
"target",
")",
";",
"target",
".",
"getIncoming",
"(",
")",
".",
"add",
"(",
"element",
")",
";",
"return",
"myself",
";",
"}"
] | Sets the target flow node of this sequence flow.
@param target the target of this sequence flow
@return the builder object | [
"Sets",
"the",
"target",
"flow",
"node",
"of",
"this",
"sequence",
"flow",
"."
] | debcadf041d10fa62b799de0307b832cea84e5d4 | https://github.com/camunda/camunda-bpmn-model/blob/debcadf041d10fa62b799de0307b832cea84e5d4/src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractSequenceFlowBuilder.java#L51-L55 | train |
camunda/camunda-bpmn-model | src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractMessageEventDefinitionBuilder.java | AbstractMessageEventDefinitionBuilder.messageEventDefinitionDone | @SuppressWarnings({ "rawtypes", "unchecked" })
public <T extends AbstractFlowNodeBuilder> T messageEventDefinitionDone() {
return (T) ((Event) element.getParentElement()).builder();
} | java | @SuppressWarnings({ "rawtypes", "unchecked" })
public <T extends AbstractFlowNodeBuilder> T messageEventDefinitionDone() {
return (T) ((Event) element.getParentElement()).builder();
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"rawtypes\"",
",",
"\"unchecked\"",
"}",
")",
"public",
"<",
"T",
"extends",
"AbstractFlowNodeBuilder",
">",
"T",
"messageEventDefinitionDone",
"(",
")",
"{",
"return",
"(",
"T",
")",
"(",
"(",
"Event",
")",
"element",
".... | Finishes the building of a message event definition.
@param <T>
@return the parent event builder | [
"Finishes",
"the",
"building",
"of",
"a",
"message",
"event",
"definition",
"."
] | debcadf041d10fa62b799de0307b832cea84e5d4 | https://github.com/camunda/camunda-bpmn-model/blob/debcadf041d10fa62b799de0307b832cea84e5d4/src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractMessageEventDefinitionBuilder.java#L92-L95 | train |
camunda/camunda-bpmn-model | src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractStartEventBuilder.java | AbstractStartEventBuilder.compensation | public B compensation() {
CompensateEventDefinition compensateEventDefinition = createCompensateEventDefinition();
element.getEventDefinitions().add(compensateEventDefinition);
return myself;
} | java | public B compensation() {
CompensateEventDefinition compensateEventDefinition = createCompensateEventDefinition();
element.getEventDefinitions().add(compensateEventDefinition);
return myself;
} | [
"public",
"B",
"compensation",
"(",
")",
"{",
"CompensateEventDefinition",
"compensateEventDefinition",
"=",
"createCompensateEventDefinition",
"(",
")",
";",
"element",
".",
"getEventDefinitions",
"(",
")",
".",
"add",
"(",
"compensateEventDefinition",
")",
";",
"ret... | Sets a catch compensation definition.
@return the builder object | [
"Sets",
"a",
"catch",
"compensation",
"definition",
"."
] | debcadf041d10fa62b799de0307b832cea84e5d4 | https://github.com/camunda/camunda-bpmn-model/blob/debcadf041d10fa62b799de0307b832cea84e5d4/src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractStartEventBuilder.java#L194-L199 | train |
netty/netty-tcnative | openssl-dynamic/src/main/java/io/netty/internal/tcnative/SSLContext.java | SSLContext.setSessionTicketKeys | public static void setSessionTicketKeys(long ctx, SessionTicketKey[] keys) {
if (keys == null || keys.length == 0) {
throw new IllegalArgumentException("Length of the keys should be longer than 0.");
}
byte[] binaryKeys = new byte[keys.length * SessionTicketKey.TICKET_KEY_SIZE];
for (int i = 0; i < keys.length; i++) {
SessionTicketKey key = keys[i];
int dstCurPos = SessionTicketKey.TICKET_KEY_SIZE * i;
System.arraycopy(key.name, 0, binaryKeys, dstCurPos, SessionTicketKey.NAME_SIZE);
dstCurPos += SessionTicketKey.NAME_SIZE;
System.arraycopy(key.hmacKey, 0, binaryKeys, dstCurPos, SessionTicketKey.HMAC_KEY_SIZE);
dstCurPos += SessionTicketKey.HMAC_KEY_SIZE;
System.arraycopy(key.aesKey, 0, binaryKeys, dstCurPos, SessionTicketKey.AES_KEY_SIZE);
}
setSessionTicketKeys0(ctx, binaryKeys);
} | java | public static void setSessionTicketKeys(long ctx, SessionTicketKey[] keys) {
if (keys == null || keys.length == 0) {
throw new IllegalArgumentException("Length of the keys should be longer than 0.");
}
byte[] binaryKeys = new byte[keys.length * SessionTicketKey.TICKET_KEY_SIZE];
for (int i = 0; i < keys.length; i++) {
SessionTicketKey key = keys[i];
int dstCurPos = SessionTicketKey.TICKET_KEY_SIZE * i;
System.arraycopy(key.name, 0, binaryKeys, dstCurPos, SessionTicketKey.NAME_SIZE);
dstCurPos += SessionTicketKey.NAME_SIZE;
System.arraycopy(key.hmacKey, 0, binaryKeys, dstCurPos, SessionTicketKey.HMAC_KEY_SIZE);
dstCurPos += SessionTicketKey.HMAC_KEY_SIZE;
System.arraycopy(key.aesKey, 0, binaryKeys, dstCurPos, SessionTicketKey.AES_KEY_SIZE);
}
setSessionTicketKeys0(ctx, binaryKeys);
} | [
"public",
"static",
"void",
"setSessionTicketKeys",
"(",
"long",
"ctx",
",",
"SessionTicketKey",
"[",
"]",
"keys",
")",
"{",
"if",
"(",
"keys",
"==",
"null",
"||",
"keys",
".",
"length",
"==",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",... | Set TLS session ticket keys.
<p> The first key in the list is the primary key. Tickets dervied from the other keys
in the list will be accepted but updated to a new ticket using the primary key. This
is useful for implementing ticket key rotation.
See <a href="https://tools.ietf.org/html/rfc5077">RFC 5077</a>
@param ctx Server or Client context to use
@param keys the {@link SessionTicketKey}s | [
"Set",
"TLS",
"session",
"ticket",
"keys",
"."
] | 4a5d7330c6c36cff2bebbb465571cab1cf7a4063 | https://github.com/netty/netty-tcnative/blob/4a5d7330c6c36cff2bebbb465571cab1cf7a4063/openssl-dynamic/src/main/java/io/netty/internal/tcnative/SSLContext.java#L423-L438 | train |
netty/netty-tcnative | openssl-dynamic/src/main/java/io/netty/internal/tcnative/Library.java | Library.calculatePackagePrefix | private static String calculatePackagePrefix() {
String maybeShaded = Library.class.getName();
// Use ! instead of . to avoid shading utilities from modifying the string
String expected = "io!netty!internal!tcnative!Library".replace('!', '.');
if (!maybeShaded.endsWith(expected)) {
throw new UnsatisfiedLinkError(String.format(
"Could not find prefix added to %s to get %s. When shading, only adding a "
+ "package prefix is supported", expected, maybeShaded));
}
return maybeShaded.substring(0, maybeShaded.length() - expected.length());
} | java | private static String calculatePackagePrefix() {
String maybeShaded = Library.class.getName();
// Use ! instead of . to avoid shading utilities from modifying the string
String expected = "io!netty!internal!tcnative!Library".replace('!', '.');
if (!maybeShaded.endsWith(expected)) {
throw new UnsatisfiedLinkError(String.format(
"Could not find prefix added to %s to get %s. When shading, only adding a "
+ "package prefix is supported", expected, maybeShaded));
}
return maybeShaded.substring(0, maybeShaded.length() - expected.length());
} | [
"private",
"static",
"String",
"calculatePackagePrefix",
"(",
")",
"{",
"String",
"maybeShaded",
"=",
"Library",
".",
"class",
".",
"getName",
"(",
")",
";",
"// Use ! instead of . to avoid shading utilities from modifying the string",
"String",
"expected",
"=",
"\"io!net... | The shading prefix added to this class's full name.
@throws UnsatisfiedLinkError if the shader used something other than a prefix | [
"The",
"shading",
"prefix",
"added",
"to",
"this",
"class",
"s",
"full",
"name",
"."
] | 4a5d7330c6c36cff2bebbb465571cab1cf7a4063 | https://github.com/netty/netty-tcnative/blob/4a5d7330c6c36cff2bebbb465571cab1cf7a4063/openssl-dynamic/src/main/java/io/netty/internal/tcnative/Library.java#L103-L113 | train |
netty/netty-tcnative | openssl-dynamic/src/main/java/io/netty/internal/tcnative/Library.java | Library.initialize | public static boolean initialize(String libraryName, String engine) throws Exception {
if (_instance == null) {
_instance = libraryName == null ? new Library() : new Library(libraryName);
if (aprMajorVersion() < 1) {
throw new UnsatisfiedLinkError("Unsupported APR Version (" +
aprVersionString() + ")");
}
if (!aprHasThreads()) {
throw new UnsatisfiedLinkError("Missing APR_HAS_THREADS");
}
}
return initialize0() && SSL.initialize(engine) == 0;
} | java | public static boolean initialize(String libraryName, String engine) throws Exception {
if (_instance == null) {
_instance = libraryName == null ? new Library() : new Library(libraryName);
if (aprMajorVersion() < 1) {
throw new UnsatisfiedLinkError("Unsupported APR Version (" +
aprVersionString() + ")");
}
if (!aprHasThreads()) {
throw new UnsatisfiedLinkError("Missing APR_HAS_THREADS");
}
}
return initialize0() && SSL.initialize(engine) == 0;
} | [
"public",
"static",
"boolean",
"initialize",
"(",
"String",
"libraryName",
",",
"String",
"engine",
")",
"throws",
"Exception",
"{",
"if",
"(",
"_instance",
"==",
"null",
")",
"{",
"_instance",
"=",
"libraryName",
"==",
"null",
"?",
"new",
"Library",
"(",
... | Setup native library. This is the first method that must be called!
@param libraryName the name of the library to load
@param engine Support for external a Crypto Device ("engine"), usually
@return {@code true} if initialization was successful
@throws Exception if an error happens during initialization | [
"Setup",
"native",
"library",
".",
"This",
"is",
"the",
"first",
"method",
"that",
"must",
"be",
"called!"
] | 4a5d7330c6c36cff2bebbb465571cab1cf7a4063 | https://github.com/netty/netty-tcnative/blob/4a5d7330c6c36cff2bebbb465571cab1cf7a4063/openssl-dynamic/src/main/java/io/netty/internal/tcnative/Library.java#L145-L159 | train |
GoogleCloudPlatform/app-gradle-plugin | src/main/java/com/google/cloud/tools/gradle/appengine/util/NullSafe.java | NullSafe.convert | public static <S, R> List<R> convert(List<S> source, Function<S, R> converter) {
return (source == null)
? null
: source
.stream()
.filter(Objects::nonNull)
.map(converter)
.filter(Objects::nonNull)
.collect(Collectors.toList());
} | java | public static <S, R> List<R> convert(List<S> source, Function<S, R> converter) {
return (source == null)
? null
: source
.stream()
.filter(Objects::nonNull)
.map(converter)
.filter(Objects::nonNull)
.collect(Collectors.toList());
} | [
"public",
"static",
"<",
"S",
",",
"R",
">",
"List",
"<",
"R",
">",
"convert",
"(",
"List",
"<",
"S",
">",
"source",
",",
"Function",
"<",
"S",
",",
"R",
">",
"converter",
")",
"{",
"return",
"(",
"source",
"==",
"null",
")",
"?",
"null",
":",
... | Convert a list of a given type using converter.
@param source a list to convert
@param converter the map function to apply
@param <S> type to convert from
@param <R> type to convert to
@return A converted List with all pre-conversion and post-conversion null values removed. Can
return an empty list. Will return null if source is null. | [
"Convert",
"a",
"list",
"of",
"a",
"given",
"type",
"using",
"converter",
"."
] | 86d44fe0668e28f55eee9e002d5e19f0041efa3c | https://github.com/GoogleCloudPlatform/app-gradle-plugin/blob/86d44fe0668e28f55eee9e002d5e19f0041efa3c/src/main/java/com/google/cloud/tools/gradle/appengine/util/NullSafe.java#L40-L49 | train |
GoogleCloudPlatform/app-gradle-plugin | src/main/java/com/google/cloud/tools/gradle/appengine/core/CloudSdkOperations.java | CloudSdkOperations.getDefaultHandler | public static ProcessHandler getDefaultHandler(Logger logger) {
return LegacyProcessHandler.builder()
.addStdErrLineListener(logger::lifecycle)
.addStdOutLineListener(logger::lifecycle)
.setExitListener(new NonZeroExceptionExitListener())
.build();
} | java | public static ProcessHandler getDefaultHandler(Logger logger) {
return LegacyProcessHandler.builder()
.addStdErrLineListener(logger::lifecycle)
.addStdOutLineListener(logger::lifecycle)
.setExitListener(new NonZeroExceptionExitListener())
.build();
} | [
"public",
"static",
"ProcessHandler",
"getDefaultHandler",
"(",
"Logger",
"logger",
")",
"{",
"return",
"LegacyProcessHandler",
".",
"builder",
"(",
")",
".",
"addStdErrLineListener",
"(",
"logger",
"::",
"lifecycle",
")",
".",
"addStdOutLineListener",
"(",
"logger"... | Create a return a new default configured process handler. | [
"Create",
"a",
"return",
"a",
"new",
"default",
"configured",
"process",
"handler",
"."
] | 86d44fe0668e28f55eee9e002d5e19f0041efa3c | https://github.com/GoogleCloudPlatform/app-gradle-plugin/blob/86d44fe0668e28f55eee9e002d5e19f0041efa3c/src/main/java/com/google/cloud/tools/gradle/appengine/core/CloudSdkOperations.java#L82-L88 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.