code
stringlengths 25
201k
| docstring
stringlengths 19
96.2k
| func_name
stringlengths 0
235
| language
stringclasses 1
value | repo
stringlengths 8
51
| path
stringlengths 11
314
| url
stringlengths 62
377
| license
stringclasses 7
values |
|---|---|---|---|---|---|---|---|
private static int decode4to3(byte[] source, int srcOffset,
byte[] destination, int destOffset, byte[] decodabet) {
// Example: Dk==
if (source[srcOffset + 2] == EQUALS_SIGN) {
int outBuff =
((decodabet[source[srcOffset]] << 24) >>> 6)
| ((decodabet[source[srcOffset + 1]] << 24) >>> 12);
destination[destOffset] = (byte) (outBuff >>> 16);
return 1;
} else if (source[srcOffset + 3] == EQUALS_SIGN) {
// Example: DkL=
int outBuff =
((decodabet[source[srcOffset]] << 24) >>> 6)
| ((decodabet[source[srcOffset + 1]] << 24) >>> 12)
| ((decodabet[source[srcOffset + 2]] << 24) >>> 18);
destination[destOffset] = (byte) (outBuff >>> 16);
destination[destOffset + 1] = (byte) (outBuff >>> 8);
return 2;
} else {
// Example: DkLE
int outBuff =
((decodabet[source[srcOffset]] << 24) >>> 6)
| ((decodabet[source[srcOffset + 1]] << 24) >>> 12)
| ((decodabet[source[srcOffset + 2]] << 24) >>> 18)
| ((decodabet[source[srcOffset + 3]] << 24) >>> 24);
destination[destOffset] = (byte) (outBuff >> 16);
destination[destOffset + 1] = (byte) (outBuff >> 8);
destination[destOffset + 2] = (byte) (outBuff);
return 3;
}
}
|
Decodes four bytes from array <var>source</var> and writes the resulting bytes (up to three
of them) to <var>destination</var>. The source and destination arrays can be manipulated
anywhere along their length by specifying <var>srcOffset</var> and <var>destOffset</var>.
This method does not check to make sure your arrays are large enough to accommodate
<var>srcOffset</var> + 4 for the <var>source</var> array or <var>destOffset</var> + 3 for the
<var>destination</var> array. This method returns the actual number of bytes that were
converted from the Base64 encoding.
@param source
the array to convert
@param srcOffset
the index where conversion begins
@param destination
the array to hold the conversion
@param destOffset
the index where output will be put
@param decodabet
the decodabet for decoding Base64 content
@return the number of decoded bytes converted
@since 1.3
|
decode4to3
|
java
|
javiersantos/PiracyChecker
|
library/src/main/java/com/github/javiersantos/licensing/util/Base64.java
|
https://github.com/javiersantos/PiracyChecker/blob/master/library/src/main/java/com/github/javiersantos/licensing/util/Base64.java
|
Apache-2.0
|
public static byte[] decode(String s) throws Base64DecoderException {
byte[] bytes = s.getBytes();
return decode(bytes, 0, bytes.length);
}
|
Decodes data from Base64 notation.
@param s
the string to decode (decoded in default encoding)
@return the decoded data
@since 1.4
|
decode
|
java
|
javiersantos/PiracyChecker
|
library/src/main/java/com/github/javiersantos/licensing/util/Base64.java
|
https://github.com/javiersantos/PiracyChecker/blob/master/library/src/main/java/com/github/javiersantos/licensing/util/Base64.java
|
Apache-2.0
|
public static byte[] decodeWebSafe(String s) throws Base64DecoderException {
byte[] bytes = s.getBytes();
return decodeWebSafe(bytes, 0, bytes.length);
}
|
Decodes data from web safe Base64 notation. Web safe encoding uses '-' instead of '+', '_'
instead of '/'
@param s
the string to decode (decoded in default encoding)
@return the decoded data
|
decodeWebSafe
|
java
|
javiersantos/PiracyChecker
|
library/src/main/java/com/github/javiersantos/licensing/util/Base64.java
|
https://github.com/javiersantos/PiracyChecker/blob/master/library/src/main/java/com/github/javiersantos/licensing/util/Base64.java
|
Apache-2.0
|
public static byte[] decode(byte[] source) throws Base64DecoderException {
return decode(source, 0, source.length);
}
|
Decodes Base64 content in byte array format and returns the decoded byte array.
@param source
The Base64 encoded data
@return decoded data
@since 1.3
|
decode
|
java
|
javiersantos/PiracyChecker
|
library/src/main/java/com/github/javiersantos/licensing/util/Base64.java
|
https://github.com/javiersantos/PiracyChecker/blob/master/library/src/main/java/com/github/javiersantos/licensing/util/Base64.java
|
Apache-2.0
|
public static byte[] decodeWebSafe(byte[] source)
throws Base64DecoderException {
return decodeWebSafe(source, 0, source.length);
}
|
Decodes web safe Base64 content in byte array format and returns the decoded data. Web safe
encoding uses '-' instead of '+', '_' instead of '/'
@param source
the string to decode (decoded in default encoding)
@return the decoded data
|
decodeWebSafe
|
java
|
javiersantos/PiracyChecker
|
library/src/main/java/com/github/javiersantos/licensing/util/Base64.java
|
https://github.com/javiersantos/PiracyChecker/blob/master/library/src/main/java/com/github/javiersantos/licensing/util/Base64.java
|
Apache-2.0
|
public static byte[] decode(byte[] source, int off, int len)
throws Base64DecoderException {
return decode(source, off, len, DECODABET);
}
|
Decodes Base64 content in byte array format and returns the decoded byte array.
@param source
The Base64 encoded data
@param off
The offset of where to begin decoding
@param len
The length of characters to decode
@return decoded data
@since 1.3
|
decode
|
java
|
javiersantos/PiracyChecker
|
library/src/main/java/com/github/javiersantos/licensing/util/Base64.java
|
https://github.com/javiersantos/PiracyChecker/blob/master/library/src/main/java/com/github/javiersantos/licensing/util/Base64.java
|
Apache-2.0
|
public static byte[] decodeWebSafe(byte[] source, int off, int len)
throws Base64DecoderException {
return decode(source, off, len, WEBSAFE_DECODABET);
}
|
Decodes web safe Base64 content in byte array format and returns the decoded byte array. Web
safe encoding uses '-' instead of '+', '_' instead of '/'
@param source
The Base64 encoded data
@param off
The offset of where to begin decoding
@param len
The length of characters to decode
@return decoded data
|
decodeWebSafe
|
java
|
javiersantos/PiracyChecker
|
library/src/main/java/com/github/javiersantos/licensing/util/Base64.java
|
https://github.com/javiersantos/PiracyChecker/blob/master/library/src/main/java/com/github/javiersantos/licensing/util/Base64.java
|
Apache-2.0
|
@SuppressWarnings("UnusedAssignment")
public static byte[] decode(byte[] source, int off, int len, byte[] decodabet)
throws Base64DecoderException {
int len34 = len * 3 / 4;
byte[] outBuff = new byte[2 + len34]; // Upper limit on size of output
int outBuffPosn = 0;
byte[] b4 = new byte[4];
int b4Posn = 0;
int i;
byte sbiCrop;
byte sbiDecode;
for (i = 0; i < len; i++) {
sbiCrop = (byte) (source[i + off] & 0x7f); // Only the low seven bits
sbiDecode = decodabet[sbiCrop];
if (sbiDecode >= WHITE_SPACE_ENC) { // White space Equals sign or better
if (sbiDecode >= EQUALS_SIGN_ENC) {
// An equals sign (for padding) must not occur at position 0 or 1
// and must be the last byte[s] in the encoded value
if (sbiCrop == EQUALS_SIGN) {
int bytesLeft = len - i;
byte lastByte = (byte) (source[len - 1 + off] & 0x7f);
if (b4Posn == 0 || b4Posn == 1) {
throw new Base64DecoderException(
"invalid padding byte '=' at byte offset " + i);
} else if ((b4Posn == 3 && bytesLeft > 2)
|| (b4Posn == 4 && bytesLeft > 1)) {
throw new Base64DecoderException(
"padding byte '=' falsely signals end of encoded value "
+ "at offset " + i);
} else if (lastByte != EQUALS_SIGN && lastByte != NEW_LINE) {
throw new Base64DecoderException(
"encoded value has invalid trailing byte");
}
break;
}
b4[b4Posn++] = sbiCrop;
if (b4Posn == 4) {
outBuffPosn += decode4to3(b4, 0, outBuff, outBuffPosn, decodabet);
b4Posn = 0;
}
}
} else {
throw new Base64DecoderException("Bad Base64 input character at " + i
+ ": " + source[i + off] + "(decimal)");
}
}
// Because web safe encoding allows non padding base64 encodes, we
// need to pad the rest of the b4 buffer with equal signs when
// b4Posn != 0. There can be at most 2 equal signs at the end of
// four characters, so the b4 buffer must have two or three
// characters. This also catches the case where the input is
// padded with EQUALS_SIGN
if (b4Posn != 0) {
if (b4Posn == 1) {
throw new Base64DecoderException("single trailing character at offset "
+ (len - 1));
}
b4[b4Posn++] = EQUALS_SIGN;
outBuffPosn += decode4to3(b4, 0, outBuff, outBuffPosn, decodabet);
}
byte[] out = new byte[outBuffPosn];
System.arraycopy(outBuff, 0, out, 0, outBuffPosn);
return out;
}
|
Decodes Base64 content using the supplied decodabet and returns the decoded byte array.
@param source
The Base64 encoded data
@param off
The offset of where to begin decoding
@param len
The length of characters to decode
@param decodabet
the decodabet for decoding Base64 content
@return decoded data
|
decode
|
java
|
javiersantos/PiracyChecker
|
library/src/main/java/com/github/javiersantos/licensing/util/Base64.java
|
https://github.com/javiersantos/PiracyChecker/blob/master/library/src/main/java/com/github/javiersantos/licensing/util/Base64.java
|
Apache-2.0
|
static public void DecodeQuery(URI encodedURI, Map<String, String> results) {
Scanner scanner = new Scanner(encodedURI.getRawQuery());
scanner.useDelimiter("&");
try {
while (scanner.hasNext()) {
String param = scanner.next();
String[] valuePair = param.split("=");
String name, value;
if (valuePair.length == 1) {
value = null;
} else if (valuePair.length == 2) {
value = URLDecoder.decode(valuePair[1], "UTF-8");
} else {
throw new IllegalArgumentException("query parameter invalid");
}
name = URLDecoder.decode(valuePair[0], "UTF-8");
results.put(name, value);
}
} catch (UnsupportedEncodingException e) {
// This should never happen.
Log.e(TAG, "UTF-8 Not Recognized as a charset. Device configuration Error.");
}
}
|
Decodes the query portion of the passed-in URI.
@param encodedURI
the URI containing the query to decode
@param results
a map containing all query parameters. Query parameters that do not have a value will
map to a null string
|
DecodeQuery
|
java
|
javiersantos/PiracyChecker
|
library/src/main/java/com/github/javiersantos/licensing/util/URIQueryDecoder.java
|
https://github.com/javiersantos/PiracyChecker/blob/master/library/src/main/java/com/github/javiersantos/licensing/util/URIQueryDecoder.java
|
Apache-2.0
|
public static String generatePassword(int passwordLength) {
if (passwordLength < 8) {
throw new IllegalArgumentException("Invalid password length. Minimum of 8 characters is required.");
}
// Split the classes of characters into separate buckets so we can be sure to use
// the correct amount of each type
final char[][] requiredCharacterBuckets = {
{'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'},
{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'},
{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}
};
Random random = new Random();
StringBuilder password = new StringBuilder(passwordLength);
// Randomly select one character from each of the required character types
for (char[] requiredCharacterBucket : requiredCharacterBuckets) {
password.append(requiredCharacterBucket[random.nextInt(requiredCharacterBucket.length)]);
}
// build the remaining password using Utils.randomString
return password.append(Utils.randomString(passwordLength - requiredCharacterBuckets.length)).toString();
}
|
Generate a random password that matches the password policy of the Cognito user pool
@return a random password that matches the password policy of the Cognito user pool
|
generatePassword
|
java
|
awslabs/aws-saas-boost
|
installer/src/main/java/com/amazon/aws/partners/saasfactory/saasboost/SaaSBoostInstall.java
|
https://github.com/awslabs/aws-saas-boost/blob/master/installer/src/main/java/com/amazon/aws/partners/saasfactory/saasboost/SaaSBoostInstall.java
|
Apache-2.0
|
public static Builder builder() {
return new Builder();
}
|
Retrieves a new empty instance of the {@link Environment.Builder}.
@return an empty {@link Environment.Builder}.
|
builder
|
java
|
awslabs/aws-saas-boost
|
installer/src/main/java/com/amazon/aws/partners/saasfactory/saasboost/model/Environment.java
|
https://github.com/awslabs/aws-saas-boost/blob/master/installer/src/main/java/com/amazon/aws/partners/saasfactory/saasboost/model/Environment.java
|
Apache-2.0
|
public static Builder builder(Environment baseEnvironment) {
return new Builder();
}
|
Constructs a {@link Environment.Builder} using the provided {@link Environment} as a baseline.
It will always be true that calling <code>build</code> on the {@link Environment.Builder} returned
by this function will create an {@link Environment} equal to the provided {@link Environment}. In other words:
<code>
myEnvironment.equals(Environment.builder(myEnvironment).build()) // <== always true
</code>
@param baseEnvironment the {@link Environment} to base this {@link Environment.Builder} on.
@return the prebuilt {@link Environment.Builder}
|
builder
|
java
|
awslabs/aws-saas-boost
|
installer/src/main/java/com/amazon/aws/partners/saasfactory/saasboost/model/Environment.java
|
https://github.com/awslabs/aws-saas-boost/blob/master/installer/src/main/java/com/amazon/aws/partners/saasfactory/saasboost/model/Environment.java
|
Apache-2.0
|
@Override
public void close() {
for (Map.Entry<String, String> hiddenProperty : hiddenProperties.entrySet()) {
System.setProperty(hiddenProperty.getKey(), hiddenProperty.getValue());
}
}
|
Hides the system property credentials when for the RefreshingDefaultCredentialsProviderTest to force
the profile credentials provider to be used by the DefaultCredentialsProvider.
For reference, the {@link DefaultCredentialsProvider} reads credentials in the following manner:
{@link SystemPropertyCredentialsProvider}
{@link EnvironmentVariableCredentialsProvider}
{@link WebIdentityTokenFileCredentialsProvider}
{@link ProfileCredentialsProvider}
{@link ContainerCredentialsProvider}
{@link InstanceProfileCredentialsProvider}
To force the underlying {@link DefaultCredentialsProvider} to use the {@link ProfileCredentialsProvider}, we need
to guarantee that the {@link SystemPropertyCredentialsProvider}, {@link EnvironmentVariableCredentialsProvider},
and {@link WebIdentityTokenFileCredentialsProvider} all will return no credentials. If any of these return
credentials then our test will fail, expecting configured Profile credentials but receiving some others.
Luckily for the {@link SystemPropertyCredentialsProvider} and {@link WebIdentityTokenFileCredentialsProvider},
whether any credentials are loaded is controllable via System properties, so this
NoSystemPropertyCredentialsTestEnvironment class caches and unsets any System properties (using
{@link System#getProperty(String)}, {@link System#clearProperty(String)}, and
{@link System#setProperty(String, String)}).
For the {@link EnvironmentVariableCredentialsProvider} however, because environment variables are not
controllable at runtime, we have no recourse. Adding environment variable credentials to this test will
currently cause this test to fail. If for some reason we need to add environment variable credentials to
tests in the installer, this test can be refactored (with the addition of PowerMock to our testing dependencies)
to statically mock responses to {@link System#getenv(String)} to return nothing for the credential environment
variable names.
|
close
|
java
|
awslabs/aws-saas-boost
|
installer/src/test/java/com/amazon/aws/partners/saasfactory/saasboost/clients/RefreshingProfileDefaultCredentialsProviderTest.java
|
https://github.com/awslabs/aws-saas-boost/blob/master/installer/src/test/java/com/amazon/aws/partners/saasfactory/saasboost/clients/RefreshingProfileDefaultCredentialsProviderTest.java
|
Apache-2.0
|
public void lock(RequestContext requestContext) {
boolean locked = false;
while (!locked) {
locked = tryLockUnlock(requestContext, true);
if (!locked) {
// self-throttle so we don't blow up DDB trying to attain the lock
try {
Thread.sleep(5 * 1000); // 5 seconds
} catch (InterruptedException ie) {
// do nothing, keep trying
}
}
}
}
|
Locks the distributed lock for reading/writing CapacityProviders.
This function blocks indefinitely until the operation is successful, relying on outside
timeouts to prevent us from actually blocking forever.
|
lock
|
java
|
awslabs/aws-saas-boost
|
resources/custom-resources/attach-ecs-capacity-provider/src/main/java/com/amazon/aws/partners/saasfactory/saasboost/CapacityProviderLock.java
|
https://github.com/awslabs/aws-saas-boost/blob/master/resources/custom-resources/attach-ecs-capacity-provider/src/main/java/com/amazon/aws/partners/saasfactory/saasboost/CapacityProviderLock.java
|
Apache-2.0
|
public final Object sendResponse(final Map<String, Object> event, final Context context, final String responseStatus, ObjectNode responseData) {
String responseUrl = (String) event.get("ResponseURL");
LOGGER.info("ResponseURL: " + responseUrl + "\n");
URL url;
try {
url = new URL(responseUrl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoOutput(true);
connection.setRequestProperty("Content-Type", "");
connection.setRequestMethod("PUT");
ObjectNode responseBody = JsonNodeFactory.instance.objectNode();
responseBody.put("Status", responseStatus);
responseBody.put("RequestId", (String) event.get("RequestId"));
responseBody.put("LogicalResourceId", (String) event.get("LogicalResourceId"));
responseBody.put("StackId", (String) event.get("StackId"));
responseBody.put("PhysicalResourceId", (String) event.get("LogicalResourceId"));
if (!"FAILED".equals(responseStatus)) {
responseBody.set("Data", responseData);
} else {
responseBody.put("Reason", responseData.get("Reason").asText());
}
LOGGER.info("Response Body: " + responseBody.toString());
try (OutputStreamWriter response = new OutputStreamWriter(connection.getOutputStream())) {
response.write(responseBody.toString());
} catch (IOException ioe) {
LOGGER.error("Failed to call back to CFN response URL");
LOGGER.error(Utils.getFullStackTrace(ioe));
}
LOGGER.info("Response Code: " + connection.getResponseCode());
connection.disconnect();
} catch (IOException e) {
LOGGER.error("Failed to open connection to CFN response URL");
LOGGER.error(Utils.getFullStackTrace(e));
}
return null;
}
|
Send a response to CloudFormation regarding progress in creating resource.
@param event
@param context
@param responseStatus
@param responseData
@return
|
sendResponse
|
java
|
awslabs/aws-saas-boost
|
resources/custom-resources/redshift-table/src/main/java/com/amazon/aws/partners/saasfactory/saasboost/RedshiftTable.java
|
https://github.com/awslabs/aws-saas-boost/blob/master/resources/custom-resources/redshift-table/src/main/java/com/amazon/aws/partners/saasfactory/saasboost/RedshiftTable.java
|
Apache-2.0
|
public APIGatewayProxyResponseEvent getOnboarding(Map<String, Object> event, Context context) {
if (Utils.warmup(event)) {
//LOGGER.info("Warming up");
return new APIGatewayProxyResponseEvent().withHeaders(CORS).withStatusCode(200);
}
//Utils.logRequestEvent(event);
APIGatewayProxyResponseEvent response;
Map<String, String> params = (Map<String, String>) event.get("pathParameters");
String onboardingId = params.get("id");
Onboarding onboarding = dal.getOnboarding(onboardingId);
if (onboarding != null) {
response = new APIGatewayProxyResponseEvent()
.withHeaders(CORS)
.withStatusCode(200)
.withBody(Utils.toJson(onboarding));
} else {
response = new APIGatewayProxyResponseEvent().withHeaders(CORS).withStatusCode(404);
}
return response;
}
|
Get an onboarding record by id. Integration for GET /onboarding/{id} endpoint.
@param event API Gateway proxy request event containing an id path parameter
@param context
@return Onboarding object for id or HTTP 404 if not found
|
getOnboarding
|
java
|
awslabs/aws-saas-boost
|
services/onboarding-service/src/main/java/com/amazon/aws/partners/saasfactory/saasboost/OnboardingService.java
|
https://github.com/awslabs/aws-saas-boost/blob/master/services/onboarding-service/src/main/java/com/amazon/aws/partners/saasfactory/saasboost/OnboardingService.java
|
Apache-2.0
|
public APIGatewayProxyResponseEvent getOnboardings(Map<String, Object> event, Context context) {
if (Utils.warmup(event)) {
//LOGGER.info("Warming up");
return new APIGatewayProxyResponseEvent().withHeaders(CORS).withStatusCode(200);
}
//Utils.logRequestEvent(event);
APIGatewayProxyResponseEvent response;
List<Onboarding> onboardings;
Map<String, String> queryParams = (Map<String, String>) event.get("queryStringParameters");
if (queryParams != null && queryParams.containsKey("tenantId")
&& Utils.isNotBlank(queryParams.get("tenantId"))) {
onboardings = Collections.singletonList(dal.getOnboardingByTenantId(queryParams.get("tenantId")));
} else {
onboardings = dal.getOnboardings();
}
response = new APIGatewayProxyResponseEvent()
.withHeaders(CORS)
.withStatusCode(200)
.withBody(Utils.toJson(onboardings));
return response;
}
|
Get all onboarding records. Integration for GET /onboarding endpoint
@param event API Gateway proxy request event
@param context
@return List of onboarding objects
|
getOnboardings
|
java
|
awslabs/aws-saas-boost
|
services/onboarding-service/src/main/java/com/amazon/aws/partners/saasfactory/saasboost/OnboardingService.java
|
https://github.com/awslabs/aws-saas-boost/blob/master/services/onboarding-service/src/main/java/com/amazon/aws/partners/saasfactory/saasboost/OnboardingService.java
|
Apache-2.0
|
public APIGatewayProxyResponseEvent updateOnboarding(Map<String, Object> event, Context context) {
if (Utils.warmup(event)) {
//LOGGER.info("Warming up");
return new APIGatewayProxyResponseEvent().withHeaders(CORS).withStatusCode(200);
}
//Utils.logRequestEvent(event);
APIGatewayProxyResponseEvent response;
Map<String, String> params = (Map<String, String>) event.get("pathParameters");
String onboardingId = params.get("id");
Onboarding onboarding = Utils.fromJson((String) event.get("body"), Onboarding.class);
if (onboarding == null) {
response = new APIGatewayProxyResponseEvent()
.withStatusCode(400)
.withHeaders(CORS)
.withBody(Utils.toJson(Map.of("message", "Invalid request body")));
} else {
if (onboarding.getId() == null || !onboarding.getId().toString().equals(onboardingId)) {
LOGGER.error("Can't update onboarding {} at resource {}", onboarding.getId(), onboardingId);
response = new APIGatewayProxyResponseEvent()
.withStatusCode(400)
.withHeaders(CORS)
.withBody(Utils.toJson(Map.of("message", "Request body must include id")));
} else {
onboarding = dal.updateOnboarding(onboarding);
response = new APIGatewayProxyResponseEvent()
.withStatusCode(200)
.withHeaders(CORS)
.withBody(Utils.toJson(onboarding));
}
}
return response;
}
|
Update an onboarding record by id. Integration for PUT /onboarding/{id} endpoint.
@param event API Gateway proxy request event containing an id path parameter
@param context
@return HTTP 200 if updated, HTTP 400 on failure
|
updateOnboarding
|
java
|
awslabs/aws-saas-boost
|
services/onboarding-service/src/main/java/com/amazon/aws/partners/saasfactory/saasboost/OnboardingService.java
|
https://github.com/awslabs/aws-saas-boost/blob/master/services/onboarding-service/src/main/java/com/amazon/aws/partners/saasfactory/saasboost/OnboardingService.java
|
Apache-2.0
|
public APIGatewayProxyResponseEvent deleteOnboarding(Map<String, Object> event, Context context) {
if (Utils.warmup(event)) {
//LOGGER.info("Warming up");
return new APIGatewayProxyResponseEvent().withHeaders(CORS).withStatusCode(200);
}
//Utils.logRequestEvent(event);
APIGatewayProxyResponseEvent response;
Map<String, String> params = (Map<String, String>) event.get("pathParameters");
String onboardingId = params.get("id");
try {
//dal.deleteOnboarding(onboardingId);
response = new APIGatewayProxyResponseEvent()
.withHeaders(CORS)
.withStatusCode(204); // No content
} catch (Exception e) {
response = new APIGatewayProxyResponseEvent()
.withHeaders(CORS)
.withStatusCode(400)
.withBody(Utils.toJson(Map.of("message", "Failed to delete onboarding record "
+ onboardingId)));
}
return response;
}
|
Delete an onboarding record by id. Integration for DELETE /onboarding/{id} endpoint.
@param event API Gateway proxy request event containing an id path parameter
@param context
@return HTTP 204 if deleted, HTTP 400 on failure
|
deleteOnboarding
|
java
|
awslabs/aws-saas-boost
|
services/onboarding-service/src/main/java/com/amazon/aws/partners/saasfactory/saasboost/OnboardingService.java
|
https://github.com/awslabs/aws-saas-boost/blob/master/services/onboarding-service/src/main/java/com/amazon/aws/partners/saasfactory/saasboost/OnboardingService.java
|
Apache-2.0
|
static ExternalTaskClientBuilder create() {
return new ExternalTaskClientBuilderImpl();
}
|
Creates a fluent builder to configure the Camunda client
@return builder to apply configurations on
|
create
|
java
|
camunda/camunda-bpm-platform
|
clients/java/client/src/main/java/org/camunda/bpm/client/ExternalTaskClient.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/clients/java/client/src/main/java/org/camunda/bpm/client/ExternalTaskClient.java
|
Apache-2.0
|
@Override
default void reconfigure(List<ExternalTask> externalTasks) {
reconfigure(externalTasks, null);
}
|
This is to provide compatibility with existing BackoffStrategy configurations.
Do not override. Implementations of ErrorAwareBackoffStrategy should override
{@link #reconfigure(List, ExternalTaskClientException)} instead.
@param externalTasks which have been fetched
|
reconfigure
|
java
|
camunda/camunda-bpm-platform
|
clients/java/client/src/main/java/org/camunda/bpm/client/backoff/ErrorAwareBackoffStrategy.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/clients/java/client/src/main/java/org/camunda/bpm/client/backoff/ErrorAwareBackoffStrategy.java
|
Apache-2.0
|
public void configureField(SortingField field) {
orderingProperties.add(OrderingProperty.of(field, null));
}
|
Configures the given field.
@param field the sorting field to configure
|
configureField
|
java
|
camunda/camunda-bpm-platform
|
clients/java/client/src/main/java/org/camunda/bpm/client/task/OrderingConfig.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/clients/java/client/src/main/java/org/camunda/bpm/client/task/OrderingConfig.java
|
Apache-2.0
|
public void configureDirectionOnLastField(Direction direction) {
OrderingProperty lastConfiguredProperty = validateAndGetLastConfiguredProperty();
if (lastConfiguredProperty.getDirection() != null) {
throw LOG.doubleDirectionConfigException();
}
lastConfiguredProperty.setDirection(direction);
orderingProperties.add(lastConfiguredProperty);
}
|
Configures the {@link Direction} for the last configured field on this {@link OrderingConfig}.
@param direction the given direction, nullable.
|
configureDirectionOnLastField
|
java
|
camunda/camunda-bpm-platform
|
clients/java/client/src/main/java/org/camunda/bpm/client/task/OrderingConfig.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/clients/java/client/src/main/java/org/camunda/bpm/client/task/OrderingConfig.java
|
Apache-2.0
|
protected OrderingProperty validateAndGetLastConfiguredProperty() {
OrderingProperty lastConfiguredProperty = getLastConfiguredProperty();
if (lastConfiguredProperty == null) {
throw LOG.unspecifiedOrderByMethodException();
}
return lastConfiguredProperty;
}
|
Validates the last configured field for its direction and retrieves it.
|
validateAndGetLastConfiguredProperty
|
java
|
camunda/camunda-bpm-platform
|
clients/java/client/src/main/java/org/camunda/bpm/client/task/OrderingConfig.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/clients/java/client/src/main/java/org/camunda/bpm/client/task/OrderingConfig.java
|
Apache-2.0
|
public void validateOrderingProperties() {
boolean hasMissingDirection = orderingProperties.stream()
.anyMatch(p -> p.getDirection() == null);
if (hasMissingDirection) {
throw LOG.missingDirectionException();
}
}
|
Validates ordering properties all have a non-null direction.
|
validateOrderingProperties
|
java
|
camunda/camunda-bpm-platform
|
clients/java/client/src/main/java/org/camunda/bpm/client/task/OrderingConfig.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/clients/java/client/src/main/java/org/camunda/bpm/client/task/OrderingConfig.java
|
Apache-2.0
|
public List<SortingDto> toSortingDtos() {
return orderingProperties.stream()
.map(SortingDto::fromOrderingProperty)
.collect(Collectors.toList());
}
|
Converts this {@link OrderingConfig} to a list of {@link SortingDto}s.
|
toSortingDtos
|
java
|
camunda/camunda-bpm-platform
|
clients/java/client/src/main/java/org/camunda/bpm/client/task/OrderingConfig.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/clients/java/client/src/main/java/org/camunda/bpm/client/task/OrderingConfig.java
|
Apache-2.0
|
protected OrderingProperty getLastConfiguredProperty() {
return !orderingProperties.isEmpty() ? orderingProperties.get(orderingProperties.size() - 1) : null;
}
|
Returns the last configured field in this {@link OrderingConfig}.
|
getLastConfiguredProperty
|
java
|
camunda/camunda-bpm-platform
|
clients/java/client/src/main/java/org/camunda/bpm/client/task/OrderingConfig.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/clients/java/client/src/main/java/org/camunda/bpm/client/task/OrderingConfig.java
|
Apache-2.0
|
public static SortingDto of(String sortBy, String sortOrder) {
SortingDto result = new SortingDto();
result.setSortBy(sortBy);
result.setSortOrder(sortOrder);
return result;
}
|
Static factory method to create a {@link SortingDto} from a field and its order.
@param sortBy the string representation of the given field
@param sortOrder the string representation of the given order to use for the associated field
@return the result {@link SortingDto}
|
of
|
java
|
camunda/camunda-bpm-platform
|
clients/java/client/src/main/java/org/camunda/bpm/client/task/SortingDto.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/clients/java/client/src/main/java/org/camunda/bpm/client/task/SortingDto.java
|
Apache-2.0
|
protected static SortingDto fromOrderingProperty(OrderingProperty property) {
String sortBy = property.getField().getName();
String sortOrder = property.getDirection() != null ? property.getDirection().asString() : null;
return SortingDto.of(sortBy, sortOrder);
}
|
Static factory method to create a {@link SortingDto} from a given {@link OrderingProperty}.
|
fromOrderingProperty
|
java
|
camunda/camunda-bpm-platform
|
clients/java/client/src/main/java/org/camunda/bpm/client/task/SortingDto.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/clients/java/client/src/main/java/org/camunda/bpm/client/task/SortingDto.java
|
Apache-2.0
|
public static <T extends BaseLogger> T createLogger(Class<T> loggerClass, String projectCode, String name, String componentId) {
try {
T logger = loggerClass.newInstance();
logger.projectCode = projectCode;
logger.componentId = componentId;
logger.delegateLogger = LoggerFactory.getLogger(name);
return logger;
} catch (InstantiationException e) {
throw new RuntimeException("Unable to instantiate logger '"+loggerClass.getName()+"'", e);
} catch (IllegalAccessException e) {
throw new RuntimeException("Unable to instantiate logger '"+loggerClass.getName()+"'", e);
}
}
|
Creates a new instance of the {@link BaseLogger Logger}.
@param loggerClass the type of the logger
@param projectCode the unique code for a complete project.
@param name the name of the slf4j logger to use.
@param componentId the unique id of the component.
|
createLogger
|
java
|
camunda/camunda-bpm-platform
|
commons/logging/src/main/java/org/camunda/commons/logging/BaseLogger.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/commons/logging/src/main/java/org/camunda/commons/logging/BaseLogger.java
|
Apache-2.0
|
protected void log(String level, String id, String messageTemplate, Object... parameters) {
log(level, Level.DEBUG, id, messageTemplate, parameters);
}
|
Logs a message with the specified log level. If the log level cannot be matched, it defaults to DEBUG.
@param level the log level
@param id the unique id of this log message
@param messageTemplate the message template to use
@param parameters a list of optional parameters
|
log
|
java
|
camunda/camunda-bpm-platform
|
commons/logging/src/main/java/org/camunda/commons/logging/BaseLogger.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/commons/logging/src/main/java/org/camunda/commons/logging/BaseLogger.java
|
Apache-2.0
|
protected void log(String level, Level defaultLevel, String id, String messageTemplate, Object... parameters) {
switch (Level.parse(level, defaultLevel)) {
case ERROR:
logError(id, messageTemplate, parameters);
break;
case WARN:
logWarn(id, messageTemplate, parameters);
break;
case INFO:
logInfo(id, messageTemplate, parameters);
break;
case DEBUG:
logDebug(id, messageTemplate, parameters);
break;
case TRACE:
logTrace(id, messageTemplate, parameters);
break;
}
}
|
Logs a message with the specified log level.
@param level the log level
@param defaultLevel the default log level to use when log level cannot be matched
@param id the unique id of this log message
@param messageTemplate the message template to use
@param parameters a list of optional parameters
|
log
|
java
|
camunda/camunda-bpm-platform
|
commons/logging/src/main/java/org/camunda/commons/logging/BaseLogger.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/commons/logging/src/main/java/org/camunda/commons/logging/BaseLogger.java
|
Apache-2.0
|
protected void logTrace(String id, String messageTemplate, Object... parameters) {
if (delegateLogger.isTraceEnabled()) {
String msg = formatMessageTemplate(id, messageTemplate);
delegateLogger.trace(msg, parameters);
}
}
|
Logs a 'TRACE' message
@param id the unique id of this log message
@param messageTemplate the message template to use
@param parameters a list of optional parameters
|
logTrace
|
java
|
camunda/camunda-bpm-platform
|
commons/logging/src/main/java/org/camunda/commons/logging/BaseLogger.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/commons/logging/src/main/java/org/camunda/commons/logging/BaseLogger.java
|
Apache-2.0
|
protected void logDebug(String id, String messageTemplate, Object... parameters) {
if(delegateLogger.isDebugEnabled()) {
String msg = formatMessageTemplate(id, messageTemplate);
delegateLogger.debug(msg, parameters);
}
}
|
Logs a 'DEBUG' message
@param id the unique id of this log message
@param messageTemplate the message template to use
@param parameters a list of optional parameters
|
logDebug
|
java
|
camunda/camunda-bpm-platform
|
commons/logging/src/main/java/org/camunda/commons/logging/BaseLogger.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/commons/logging/src/main/java/org/camunda/commons/logging/BaseLogger.java
|
Apache-2.0
|
protected void logInfo(String id, String messageTemplate, Object... parameters) {
if(delegateLogger.isInfoEnabled()) {
String msg = formatMessageTemplate(id, messageTemplate);
delegateLogger.info(msg, parameters);
}
}
|
Logs an 'INFO' message
@param id the unique id of this log message
@param messageTemplate the message template to use
@param parameters a list of optional parameters
|
logInfo
|
java
|
camunda/camunda-bpm-platform
|
commons/logging/src/main/java/org/camunda/commons/logging/BaseLogger.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/commons/logging/src/main/java/org/camunda/commons/logging/BaseLogger.java
|
Apache-2.0
|
protected void logWarn(String id, String messageTemplate, Object... parameters) {
if(delegateLogger.isWarnEnabled()) {
String msg = formatMessageTemplate(id, messageTemplate);
delegateLogger.warn(msg, parameters);
}
}
|
Logs an 'WARN' message
@param id the unique id of this log message
@param messageTemplate the message template to use
@param parameters a list of optional parameters
|
logWarn
|
java
|
camunda/camunda-bpm-platform
|
commons/logging/src/main/java/org/camunda/commons/logging/BaseLogger.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/commons/logging/src/main/java/org/camunda/commons/logging/BaseLogger.java
|
Apache-2.0
|
protected void logError(String id, String messageTemplate, Object... parameters) {
if(delegateLogger.isErrorEnabled()) {
String msg = formatMessageTemplate(id, messageTemplate);
delegateLogger.error(msg, parameters);
}
}
|
Logs an 'ERROR' message
@param id the unique id of this log message
@param messageTemplate the message template to use
@param parameters a list of optional parameters
|
logError
|
java
|
camunda/camunda-bpm-platform
|
commons/logging/src/main/java/org/camunda/commons/logging/BaseLogger.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/commons/logging/src/main/java/org/camunda/commons/logging/BaseLogger.java
|
Apache-2.0
|
public boolean isDebugEnabled() {
return delegateLogger.isDebugEnabled();
}
|
@return true if the logger will log 'DEBUG' messages
|
isDebugEnabled
|
java
|
camunda/camunda-bpm-platform
|
commons/logging/src/main/java/org/camunda/commons/logging/BaseLogger.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/commons/logging/src/main/java/org/camunda/commons/logging/BaseLogger.java
|
Apache-2.0
|
public boolean isInfoEnabled() {
return delegateLogger.isInfoEnabled();
}
|
@return true if the logger will log 'INFO' messages
|
isInfoEnabled
|
java
|
camunda/camunda-bpm-platform
|
commons/logging/src/main/java/org/camunda/commons/logging/BaseLogger.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/commons/logging/src/main/java/org/camunda/commons/logging/BaseLogger.java
|
Apache-2.0
|
public boolean isWarnEnabled() {
return delegateLogger.isWarnEnabled();
}
|
@return true if the logger will log 'WARN' messages
|
isWarnEnabled
|
java
|
camunda/camunda-bpm-platform
|
commons/logging/src/main/java/org/camunda/commons/logging/BaseLogger.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/commons/logging/src/main/java/org/camunda/commons/logging/BaseLogger.java
|
Apache-2.0
|
public boolean isErrorEnabled() {
return delegateLogger.isErrorEnabled();
}
|
@return true if the logger will log 'ERROR' messages
|
isErrorEnabled
|
java
|
camunda/camunda-bpm-platform
|
commons/logging/src/main/java/org/camunda/commons/logging/BaseLogger.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/commons/logging/src/main/java/org/camunda/commons/logging/BaseLogger.java
|
Apache-2.0
|
protected String formatMessageTemplate(String id, String messageTemplate) {
return projectCode + "-" + componentId + id + " " + messageTemplate;
}
|
Formats a message template
@param id the id of the message
@param messageTemplate the message template to use
@return the formatted template
|
formatMessageTemplate
|
java
|
camunda/camunda-bpm-platform
|
commons/logging/src/main/java/org/camunda/commons/logging/BaseLogger.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/commons/logging/src/main/java/org/camunda/commons/logging/BaseLogger.java
|
Apache-2.0
|
protected String exceptionMessage(String id, String messageTemplate, Object... parameters) {
String formattedTemplate = formatMessageTemplate(id, messageTemplate);
if(parameters == null || parameters.length == 0) {
return formattedTemplate;
} else {
return MessageFormatter.arrayFormat(formattedTemplate, parameters).getMessage();
}
}
|
Prepares an exception message
@param id the id of the message
@param messageTemplate the message template to use
@param parameters the parameters for the message (optional)
@return the prepared exception message
|
exceptionMessage
|
java
|
camunda/camunda-bpm-platform
|
commons/logging/src/main/java/org/camunda/commons/logging/BaseLogger.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/commons/logging/src/main/java/org/camunda/commons/logging/BaseLogger.java
|
Apache-2.0
|
public static Level parse(String value, Level defaultLevel) {
if (value == null) return defaultLevel;
try {
return valueOf(value.trim().toUpperCase());
} catch (IllegalArgumentException e) {
return defaultLevel;
}
}
|
Parse value or fallback to default level
@param value the value to parse
@param defaultLevel the fallback default value
@return the parsed log level
|
parse
|
java
|
camunda/camunda-bpm-platform
|
commons/logging/src/main/java/org/camunda/commons/logging/Level.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/commons/logging/src/main/java/org/camunda/commons/logging/Level.java
|
Apache-2.0
|
public String getValue() {
return value;
}
|
@return the string value of the level
|
getValue
|
java
|
camunda/camunda-bpm-platform
|
commons/logging/src/main/java/org/camunda/commons/logging/Level.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/commons/logging/src/main/java/org/camunda/commons/logging/Level.java
|
Apache-2.0
|
public static void put(String key, String value) {
MDC.put(key, value);
}
|
see {@link MDC#put(String, String)}
|
put
|
java
|
camunda/camunda-bpm-platform
|
commons/logging/src/main/java/org/camunda/commons/logging/MdcAccess.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/commons/logging/src/main/java/org/camunda/commons/logging/MdcAccess.java
|
Apache-2.0
|
public String getName() {
return name;
}
|
<p>The Xml Serialization Data format. If this data format is used for serializing an object,
the object is serialized as Xml text.</p>
<p><strong>NOTE:</strong> the process does NOT provide a serializer for this dataformat out of the box.
If you want to serialize objects using the Xml dataformat, you need to provide a serializer. The optinal
camunda Spin process engine plugin provides such a serializer.</p>
|
getName
|
java
|
camunda/camunda-bpm-platform
|
commons/typed-values/src/main/java/org/camunda/bpm/engine/variable/Variables.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/commons/typed-values/src/main/java/org/camunda/bpm/engine/variable/Variables.java
|
Apache-2.0
|
public static VariableMap fromMap(Map<String, Object> map) {
if(map instanceof VariableMap) {
return (VariableMap) map;
}
else {
return new VariableMapImpl(map);
}
}
|
If the given map is not a variable map, adds all its entries as untyped
values to a new {@link VariableMap}. If the given map is a {@link VariableMap},
it is returned as is.
|
fromMap
|
java
|
camunda/camunda-bpm-platform
|
commons/typed-values/src/main/java/org/camunda/bpm/engine/variable/Variables.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/commons/typed-values/src/main/java/org/camunda/bpm/engine/variable/Variables.java
|
Apache-2.0
|
public static VariableMap putValue(String name, Object value) {
return createVariables().putValue(name, value);
}
|
Shortcut for {@code Variables.createVariables().putValue(name, value)}
|
putValue
|
java
|
camunda/camunda-bpm-platform
|
commons/typed-values/src/main/java/org/camunda/bpm/engine/variable/Variables.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/commons/typed-values/src/main/java/org/camunda/bpm/engine/variable/Variables.java
|
Apache-2.0
|
public static VariableMap putValueTyped(String name, TypedValue value) {
return createVariables().putValueTyped(name, value);
}
|
Shortcut for {@code Variables.createVariables().putValueTyped(name, value)}
|
putValueTyped
|
java
|
camunda/camunda-bpm-platform
|
commons/typed-values/src/main/java/org/camunda/bpm/engine/variable/Variables.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/commons/typed-values/src/main/java/org/camunda/bpm/engine/variable/Variables.java
|
Apache-2.0
|
public static SerializedObjectValueBuilder serializedObjectValue() {
return new SerializedObjectValueBuilderImpl();
}
|
Returns a builder to create a new {@link ObjectValue} from a serialized
object representation.
|
serializedObjectValue
|
java
|
camunda/camunda-bpm-platform
|
commons/typed-values/src/main/java/org/camunda/bpm/engine/variable/Variables.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/commons/typed-values/src/main/java/org/camunda/bpm/engine/variable/Variables.java
|
Apache-2.0
|
public static SerializedObjectValueBuilder serializedObjectValue(String value) {
return serializedObjectValue().serializedValue(value);
}
|
Shortcut for {@code Variables.serializedObjectValue().serializedValue(value)}
|
serializedObjectValue
|
java
|
camunda/camunda-bpm-platform
|
commons/typed-values/src/main/java/org/camunda/bpm/engine/variable/Variables.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/commons/typed-values/src/main/java/org/camunda/bpm/engine/variable/Variables.java
|
Apache-2.0
|
public static SerializedObjectValueBuilder serializedObjectValue(String value, boolean isTransient) {
return (SerializedObjectValueBuilder) serializedObjectValue().serializedValue(value).setTransient(isTransient);
}
|
Shortcut for {@code Variables.serializedObjectValue().serializedValue(value).setTransient(isTransient)}
|
serializedObjectValue
|
java
|
camunda/camunda-bpm-platform
|
commons/typed-values/src/main/java/org/camunda/bpm/engine/variable/Variables.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/commons/typed-values/src/main/java/org/camunda/bpm/engine/variable/Variables.java
|
Apache-2.0
|
public static FileValue fileValue(File file){
String contentType = MimetypesFileTypeMap.getDefaultFileTypeMap().getContentType(file);
return new FileValueBuilderImpl(file.getName()).file(file).mimeType(contentType).create();
}
|
Shortcut for calling {@code Variables.fileValue(name).file(file).mimeType(type).create()}.
The name is set to the file name and the mime type is detected via {@link MimetypesFileTypeMap}.
|
fileValue
|
java
|
camunda/camunda-bpm-platform
|
commons/typed-values/src/main/java/org/camunda/bpm/engine/variable/Variables.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/commons/typed-values/src/main/java/org/camunda/bpm/engine/variable/Variables.java
|
Apache-2.0
|
public static FileValue fileValue(File file, boolean isTransient){
String contentType = MimetypesFileTypeMap.getDefaultFileTypeMap().getContentType(file);
return new FileValueBuilderImpl(file.getName()).file(file).mimeType(contentType).setTransient(isTransient).create();
}
|
Shortcut for calling {@code Variables.fileValue(name).file(file).mimeType(type).setTransient(isTransient).create()}.
The name is set to the file name and the mime type is detected via {@link MimetypesFileTypeMap}.
|
fileValue
|
java
|
camunda/camunda-bpm-platform
|
commons/typed-values/src/main/java/org/camunda/bpm/engine/variable/Variables.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/commons/typed-values/src/main/java/org/camunda/bpm/engine/variable/Variables.java
|
Apache-2.0
|
public static VariableContext emptyVariableContext() {
return EmptyVariableContext.INSTANCE;
}
|
@return an empty {@link VariableContext} (from which no variables can be resolved).
|
emptyVariableContext
|
java
|
camunda/camunda-bpm-platform
|
commons/typed-values/src/main/java/org/camunda/bpm/engine/variable/Variables.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/commons/typed-values/src/main/java/org/camunda/bpm/engine/variable/Variables.java
|
Apache-2.0
|
public static void ensureNotNull(String parameterName, Object value) {
if(value == null) {
throw LOG.parameterIsNullException(parameterName);
}
}
|
Ensures that the parameter is not null.
@param parameterName the parameter name
@param value the value to ensure to be not null
@throws IllegalArgumentException if the parameter value is null
|
ensureNotNull
|
java
|
camunda/camunda-bpm-platform
|
commons/utils/src/main/java/org/camunda/commons/utils/EnsureUtil.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/commons/utils/src/main/java/org/camunda/commons/utils/EnsureUtil.java
|
Apache-2.0
|
@SuppressWarnings("unchecked")
public static <T> T ensureParamInstanceOf(String objectName, Object object, Class<T> type) {
if(type.isAssignableFrom(object.getClass())) {
return (T) object;
} else {
throw LOG.unsupportedParameterType(objectName, object, type);
}
}
|
Ensure the object is of a given type and return the casted object
@param objectName the name of the parameter
@param object the parameter value
@param type the expected type
@return the parameter casted to the requested type
@throws IllegalArgumentException in case object cannot be casted to type
|
ensureParamInstanceOf
|
java
|
camunda/camunda-bpm-platform
|
commons/utils/src/main/java/org/camunda/commons/utils/EnsureUtil.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/commons/utils/src/main/java/org/camunda/commons/utils/EnsureUtil.java
|
Apache-2.0
|
public static String inputStreamAsString(InputStream inputStream) {
return new String(inputStreamAsByteArray(inputStream), ENCODING_CHARSET);
}
|
Returns the input stream as String.
@param inputStream the input stream
@return the input stream as String.
|
inputStreamAsString
|
java
|
camunda/camunda-bpm-platform
|
commons/utils/src/main/java/org/camunda/commons/utils/IoUtil.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/commons/utils/src/main/java/org/camunda/commons/utils/IoUtil.java
|
Apache-2.0
|
public static byte[] inputStreamAsByteArray(InputStream inputStream) {
ByteArrayOutputStream os = new ByteArrayOutputStream();
try {
byte[] buffer = new byte[16 * 1024];
int read;
while((read = inputStream.read(buffer)) > 0) {
os.write(buffer, 0, read);
}
return os.toByteArray();
} catch (IOException e) {
throw LOG.unableToReadInputStream(e);
}
finally {
closeSilently(inputStream);
}
}
|
Returns the input stream as byte[].
@param inputStream the input stream
@return the input stream as byte[].
|
inputStreamAsByteArray
|
java
|
camunda/camunda-bpm-platform
|
commons/utils/src/main/java/org/camunda/commons/utils/IoUtil.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/commons/utils/src/main/java/org/camunda/commons/utils/IoUtil.java
|
Apache-2.0
|
public static String readerAsString(Reader reader) {
StringBuilder buffer = new StringBuilder();
char[] chars = new char[16 * 1024];
int numCharsRead;
try {
while ((numCharsRead = reader.read(chars, 0, chars.length)) != -1) {
buffer.append(chars, 0, numCharsRead);
}
return buffer.toString();
} catch (IOException e) {
throw LOG.unableToReadFromReader(e);
}
finally {
closeSilently(reader);
}
}
|
Returns the Reader content as String.
@param reader the Reader
@return the Reader content as String
|
readerAsString
|
java
|
camunda/camunda-bpm-platform
|
commons/utils/src/main/java/org/camunda/commons/utils/IoUtil.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/commons/utils/src/main/java/org/camunda/commons/utils/IoUtil.java
|
Apache-2.0
|
public static InputStream stringAsInputStream(String string) {
return new ByteArrayInputStream(string.getBytes(ENCODING_CHARSET));
}
|
Returns the String as InputStream.
@param string the String to convert
@return the InputStream containing the String
|
stringAsInputStream
|
java
|
camunda/camunda-bpm-platform
|
commons/utils/src/main/java/org/camunda/commons/utils/IoUtil.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/commons/utils/src/main/java/org/camunda/commons/utils/IoUtil.java
|
Apache-2.0
|
public static void closeSilently(Closeable closeable) {
try {
if (closeable != null) {
closeable.close();
}
} catch (IOException e) {
// ignore
}
}
|
Close a closable ignoring any IO exception.
@param closeable the closable to close
|
closeSilently
|
java
|
camunda/camunda-bpm-platform
|
commons/utils/src/main/java/org/camunda/commons/utils/IoUtil.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/commons/utils/src/main/java/org/camunda/commons/utils/IoUtil.java
|
Apache-2.0
|
public static String fileAsString(String filename) {
File classpathFile = getClasspathFile(filename);
return fileAsString(classpathFile);
}
|
Returns the content of a file with specified filename
@param filename name of the file to load
@return Content of the file as String
|
fileAsString
|
java
|
camunda/camunda-bpm-platform
|
commons/utils/src/main/java/org/camunda/commons/utils/IoUtil.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/commons/utils/src/main/java/org/camunda/commons/utils/IoUtil.java
|
Apache-2.0
|
public static InputStream fileAsStream(String filename) {
File classpathFile = getClasspathFile(filename);
return fileAsStream(classpathFile);
}
|
Returns the input stream of a file with specified filename
@param filename the name of a File to load
@return the file content as input stream
@throws IoUtilException if the file cannot be loaded
|
fileAsStream
|
java
|
camunda/camunda-bpm-platform
|
commons/utils/src/main/java/org/camunda/commons/utils/IoUtil.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/commons/utils/src/main/java/org/camunda/commons/utils/IoUtil.java
|
Apache-2.0
|
public static InputStream fileAsStream(File file) {
try {
return new BufferedInputStream(new FileInputStream(file));
} catch(FileNotFoundException e) {
throw LOG.fileNotFoundException(file.getAbsolutePath(), e);
}
}
|
Returns the input stream of a file.
@param file the File to load
@return the file content as input stream
@throws IoUtilException if the file cannot be loaded
|
fileAsStream
|
java
|
camunda/camunda-bpm-platform
|
commons/utils/src/main/java/org/camunda/commons/utils/IoUtil.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/commons/utils/src/main/java/org/camunda/commons/utils/IoUtil.java
|
Apache-2.0
|
public static File getClasspathFile(String filename) {
if(filename == null) {
throw LOG.nullParameter("filename");
}
return getClasspathFile(filename, null);
}
|
Returns the File for a filename.
@param filename the filename to load
@return the file object
|
getClasspathFile
|
java
|
camunda/camunda-bpm-platform
|
commons/utils/src/main/java/org/camunda/commons/utils/IoUtil.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/commons/utils/src/main/java/org/camunda/commons/utils/IoUtil.java
|
Apache-2.0
|
public static File getClasspathFile(String filename, ClassLoader classLoader) {
if(filename == null) {
throw LOG.nullParameter("filename");
}
URL fileUrl = null;
if (classLoader != null) {
fileUrl = classLoader.getResource(filename);
}
if (fileUrl == null) {
// Try the current Thread context classloader
classLoader = Thread.currentThread().getContextClassLoader();
fileUrl = classLoader.getResource(filename);
if (fileUrl == null) {
// Finally, try the classloader for this class
classLoader = IoUtil.class.getClassLoader();
fileUrl = classLoader.getResource(filename);
}
}
if(fileUrl == null) {
throw LOG.fileNotFoundException(filename);
}
try {
return new File(fileUrl.toURI());
} catch(URISyntaxException e) {
throw LOG.fileNotFoundException(filename, e);
}
}
|
Returns the File for a filename.
@param filename the filename to load
@param classLoader the classLoader to load file with, if null falls back to TCCL and then this class's classloader
@return the file object
@throws IoUtilException if the file cannot be loaded
|
getClasspathFile
|
java
|
camunda/camunda-bpm-platform
|
commons/utils/src/main/java/org/camunda/commons/utils/IoUtil.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/commons/utils/src/main/java/org/camunda/commons/utils/IoUtil.java
|
Apache-2.0
|
public static boolean isExpression(String text) {
if (text == null) {
return false;
}
text = text.trim();
return text.startsWith("${") || text.startsWith("#{");
}
|
Checks whether a String seams to be an expression or not
@param text the text to check
@return true if the text seams to be an expression false otherwise
|
isExpression
|
java
|
camunda/camunda-bpm-platform
|
commons/utils/src/main/java/org/camunda/commons/utils/StringUtil.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/commons/utils/src/main/java/org/camunda/commons/utils/StringUtil.java
|
Apache-2.0
|
public static String[] split(String text, String regex) {
if (text == null) {
return null;
}
else if (regex == null) {
return new String[] { text };
}
else {
String[] result = text.split(regex);
for (int i = 0; i < result.length; i++) {
result[i] = result[i].trim();
}
return result;
}
}
|
Splits a String by an expression.
@param text the text to split
@param regex the regex to split by
@return the parts of the text or null if text was null
|
split
|
java
|
camunda/camunda-bpm-platform
|
commons/utils/src/main/java/org/camunda/commons/utils/StringUtil.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/commons/utils/src/main/java/org/camunda/commons/utils/StringUtil.java
|
Apache-2.0
|
public static String defaultString(String text) {
return text == null ? "" : text;
}
|
Returns either the passed in String, or if the String is <code>null</code>, an empty String ("").
<pre>
StringUtils.defaultString(null) = ""
StringUtils.defaultString("") = ""
StringUtils.defaultString("bat") = "bat"
</pre>
@param text the String to check, may be null
@return the passed in String, or the empty String if it was <code>null</code>
|
defaultString
|
java
|
camunda/camunda-bpm-platform
|
commons/utils/src/main/java/org/camunda/commons/utils/StringUtil.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/commons/utils/src/main/java/org/camunda/commons/utils/StringUtil.java
|
Apache-2.0
|
public static String getStackTrace(Throwable throwable) {
StringWriter sw = new StringWriter();
throwable.printStackTrace(new PrintWriter(sw, true));
return sw.toString();
}
|
Fetches the stack trace of an exception as a String.
@param throwable to get the stack trace from
@return the stack trace as String
|
getStackTrace
|
java
|
camunda/camunda-bpm-platform
|
commons/utils/src/main/java/org/camunda/commons/utils/StringUtil.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/commons/utils/src/main/java/org/camunda/commons/utils/StringUtil.java
|
Apache-2.0
|
protected void removeAll(K key) {
while (keys.remove(key)) {
}
}
|
Removes all instances of the given key within the keys queue.
|
removeAll
|
java
|
camunda/camunda-bpm-platform
|
commons/utils/src/main/java/org/camunda/commons/utils/cache/ConcurrentLruCache.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/commons/utils/src/main/java/org/camunda/commons/utils/cache/ConcurrentLruCache.java
|
Apache-2.0
|
public static Connectors getInstance() {
return INSTANCE;
}
|
Provides the global instance of the Connectors manager.
@return the global instance
|
getInstance
|
java
|
camunda/camunda-bpm-platform
|
connect/core/src/main/java/org/camunda/connect/Connectors.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/connect/core/src/main/java/org/camunda/connect/Connectors.java
|
Apache-2.0
|
@SuppressWarnings("unchecked")
public static <C extends Connector<? extends ConnectorRequest<?>>> C http() {
return (C) INSTANCE.getConnectorById(HTTP_CONNECTOR_ID);
}
|
@return the connector for the default http connector id or null if
no connector is registered for this id
|
http
|
java
|
camunda/camunda-bpm-platform
|
connect/core/src/main/java/org/camunda/connect/Connectors.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/connect/core/src/main/java/org/camunda/connect/Connectors.java
|
Apache-2.0
|
@SuppressWarnings("unchecked")
public static <C extends Connector<? extends ConnectorRequest<?>>> C soap() {
return (C) INSTANCE.getConnectorById(SOAP_HTTP_CONNECTOR_ID);
}
|
@return the connector for the default soap http connector id or null
if no connector is registered for this id
|
soap
|
java
|
camunda/camunda-bpm-platform
|
connect/core/src/main/java/org/camunda/connect/Connectors.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/connect/core/src/main/java/org/camunda/connect/Connectors.java
|
Apache-2.0
|
protected static void registerConnector(String connectorId, Connector<?> connector) {
INSTANCE.registerConnectorInstance(connectorId, connector);
}
|
Register a new connector under the given connector id.
|
registerConnector
|
java
|
camunda/camunda-bpm-platform
|
connect/core/src/main/java/org/camunda/connect/Connectors.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/connect/core/src/main/java/org/camunda/connect/Connectors.java
|
Apache-2.0
|
public void setRequestParameter(String name, Object value) {
requestParameters.put(name, value);
}
|
Sets a request parameter on the request
@param name the name of the parameter
@param value the value of the parameter
|
setRequestParameter
|
java
|
camunda/camunda-bpm-platform
|
connect/core/src/main/java/org/camunda/connect/impl/AbstractConnectorRequest.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/connect/core/src/main/java/org/camunda/connect/impl/AbstractConnectorRequest.java
|
Apache-2.0
|
@Test
public void shouldRespondWithAccessControlHeaders() {
// given
// preflight request
String origin = "http://other.origin";
HttpHeaders headers = new HttpHeaders();
headers.add(HttpHeaders.HOST, "localhost");
headers.add(HttpHeaders.ORIGIN, origin);
headers.add(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, HttpMethod.PUT.name());
headers.add(HttpHeaders.ACCESS_CONTROL_REQUEST_HEADERS, HttpHeaders.ORIGIN);
// when
ResponseEntity<String> response = testRestTemplate.exchange(CONTEXT_PATH + "/task", HttpMethod.OPTIONS, new HttpEntity<>(headers), String.class);
// then
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(response.getHeaders().getAccessControlAllowMethods()).containsExactlyInAnyOrder(HttpMethod.GET, HttpMethod.POST, HttpMethod.HEAD,
HttpMethod.OPTIONS, HttpMethod.PUT, HttpMethod.DELETE);
assertThat(response.getHeaders().getAccessControlAllowHeaders()).containsExactlyInAnyOrder("origin", "accept", "x-requested-with", "content-type",
"access-control-request-method", "access-control-request-headers");
}
|
Note: To run this test via an IDE you must set the system property
{@code sun.net.http.allowRestrictedHeaders} to {@code true}. (e.g.
System.setProperty("sun.net.http.allowRestrictedHeaders", "true");)
@see https://jira.camunda.com/browse/CAM-11290
|
shouldRespondWithAccessControlHeaders
|
java
|
camunda/camunda-bpm-platform
|
distro/run/core/src/test/java/org/camunda/bpm/run/test/config/cors/CorsAccessControlHeadersTest.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/distro/run/core/src/test/java/org/camunda/bpm/run/test/config/cors/CorsAccessControlHeadersTest.java
|
Apache-2.0
|
@Override
public void run() {
final InputStream stream = startupProcess.getInputStream();
final BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
String line = null;
try {
while ((line = reader.readLine()) != null) {
System.out.println(line);
}
} catch (final IOException e) {
// ignore
}
}
|
Runnable that consumes the output of the startupProcess. If nothing
consumes the output the AS will hang on some platforms
|
run
|
java
|
camunda/camunda-bpm-platform
|
distro/run/qa/integration-tests/src/test/java/org/camunda/bpm/run/qa/util/SpringBootManagedContainer.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/distro/run/qa/integration-tests/src/test/java/org/camunda/bpm/run/qa/util/SpringBootManagedContainer.java
|
Apache-2.0
|
protected ManagedProcessEngineMetadata transformConfiguration(ProcessEngineXml processEngineXml) {
return new ManagedProcessEngineMetadata(
processEngineXml.getName().equals("default"),
processEngineXml.getName(),
processEngineXml.getDatasource(),
processEngineXml.getProperties().get("history"),
processEngineXml.getConfigurationClass(),
processEngineXml.getProperties(),
processEngineXml.getPlugins());
}
|
transforms the configuration as provided via the {@link ProcessEngineXml}
into a {@link ManagedProcessEngineMetadata}
|
transformConfiguration
|
java
|
camunda/camunda-bpm-platform
|
distro/wildfly/subsystem/src/main/java/org/camunda/bpm/container/impl/jboss/deployment/processor/ProcessEngineStartProcessor.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/distro/wildfly/subsystem/src/main/java/org/camunda/bpm/container/impl/jboss/deployment/processor/ProcessEngineStartProcessor.java
|
Apache-2.0
|
@SuppressWarnings({ "unchecked", "rawtypes" })
protected ManagedProcessEngineMetadata transformConfiguration(ProcessEngineXml processEngineXml) {
return new ManagedProcessEngineMetadata(
processEngineXml.getName().equals("default"),
processEngineXml.getName(),
processEngineXml.getDatasource(),
processEngineXml.getProperties().get("history"),
processEngineXml.getConfigurationClass(),
(Map) processEngineXml.getProperties(),
processEngineXml.getPlugins());
}
|
transforms the configuration as provided via the {@link ProcessEngineXml}
into a {@link ManagedProcessEngineMetadata}
|
transformConfiguration
|
java
|
camunda/camunda-bpm-platform
|
distro/wildfly26/subsystem/src/main/java/org/camunda/bpm/container/impl/jboss/deployment/processor/ProcessEngineStartProcessor.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/distro/wildfly26/subsystem/src/main/java/org/camunda/bpm/container/impl/jboss/deployment/processor/ProcessEngineStartProcessor.java
|
Apache-2.0
|
@Test
public void reflectionAccessOnFieldValueTypesWorks() {
// prepare test setup
ModelNode testModel = ModelNode.fromJSONString(
"{" +
"\"type\" : \"LIST\", " +
"\"description\" : \"Extend the process engine through various plugins.\"," +
"\"expressions-allowed\" : false," +
"\"nillable\" : true," +
"\"requires\" : [\"class\"]," +
"\"allowed\" : [" +
"\"class\"," +
"\"properties\"" +
"]" +
"}"
);
StandardResourceDescriptionResolver testStandardResourceDescriptionResolver = new StandardResourceDescriptionResolver("camunda-bpm-platform", BpmPlatformExtension.class.getPackage().getName() + ".TestLocalDescriptions", BpmPlatformExtension.class.getClassLoader());
SimpleMapAttributeDefinition simpleMapAttributeDefinition = new SimpleMapAttributeDefinition.Builder("test-map", false).build();
FixedObjectTypeAttributeDefinition fixedObjectTypeAttributeDefinition = FixedObjectTypeAttributeDefinition.Builder.of("test-fixed-object", simpleMapAttributeDefinition).build();
ResourceBundle resourceBundle = testStandardResourceDescriptionResolver.getResourceBundle(null);
// test addValueTypeDescription for MapAttributeDefinitions
fixedObjectTypeAttributeDefinition.addValueTypeDescription(testModel, "plugins", resourceBundle, testStandardResourceDescriptionResolver, null);
}
|
This class must be in package 'org.camunda.bpm.container.impl.jboss.util' because of protected method test.
|
reflectionAccessOnFieldValueTypesWorks
|
java
|
camunda/camunda-bpm-platform
|
distro/wildfly26/subsystem/src/test/java/org/camunda/bpm/container/impl/jboss/util/ReflectionCompatibilityTest.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/distro/wildfly26/subsystem/src/test/java/org/camunda/bpm/container/impl/jboss/util/ReflectionCompatibilityTest.java
|
Apache-2.0
|
public ScriptEngine getScriptEngineForName(String name, boolean cache) {
return getProcessApplicationScriptEnvironment().getScriptEngineForName(name, cache);
}
|
see {@link ProcessApplicationScriptEnvironment#getScriptEngineForName(String, boolean)}
|
getScriptEngineForName
|
java
|
camunda/camunda-bpm-platform
|
engine/src/main/java/org/camunda/bpm/application/AbstractProcessApplication.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/application/AbstractProcessApplication.java
|
Apache-2.0
|
public String getDefaultDeployToEngineName() {
return defaultDeployToEngineName;
}
|
<p>Provides the default Process Engine name to deploy to, if no Process Engine
was defined in <code>processes.xml</code>.</p>
@return the default deploy-to Process Engine name.
The default value is "default".
|
getDefaultDeployToEngineName
|
java
|
camunda/camunda-bpm-platform
|
engine/src/main/java/org/camunda/bpm/application/AbstractProcessApplication.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/application/AbstractProcessApplication.java
|
Apache-2.0
|
protected void setDefaultDeployToEngineName(String defaultDeployToEngineName) {
this.defaultDeployToEngineName = defaultDeployToEngineName;
}
|
<p>Programmatically set the name of the Process Engine to deploy to if no Process Engine
is defined in <code>processes.xml</code>. This allows to circumvent the "default" Process
Engine name and set a custom one.</p>
@param defaultDeployToEngineName
|
setDefaultDeployToEngineName
|
java
|
camunda/camunda-bpm-platform
|
engine/src/main/java/org/camunda/bpm/application/AbstractProcessApplication.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/application/AbstractProcessApplication.java
|
Apache-2.0
|
public static void setCurrentProcessApplication(String processApplicationName) {
ProcessApplicationContextImpl.set(new ProcessApplicationIdentifier(processApplicationName));
}
|
Declares the context process application for all subsequent engine API invocations
until {@link #clear()} is called. The context is bound to the current thread.
This method should always be used in a try-finally block to ensure that {@link #clear()}
is called under any circumstances.
@param processApplicationName the name of the process application to switch into
|
setCurrentProcessApplication
|
java
|
camunda/camunda-bpm-platform
|
engine/src/main/java/org/camunda/bpm/application/ProcessApplicationContext.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/application/ProcessApplicationContext.java
|
Apache-2.0
|
public static void setCurrentProcessApplication(ProcessApplicationReference reference) {
ProcessApplicationContextImpl.set(new ProcessApplicationIdentifier(reference));
}
|
Declares the context process application for all subsequent engine API invocations
until {@link #clear()} is called. The context is bound to the current thread.
This method should always be used in a try-finally block to ensure that {@link #clear()}
is called under any circumstances.
@param reference a reference to the process application to switch into
|
setCurrentProcessApplication
|
java
|
camunda/camunda-bpm-platform
|
engine/src/main/java/org/camunda/bpm/application/ProcessApplicationContext.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/application/ProcessApplicationContext.java
|
Apache-2.0
|
public static void setCurrentProcessApplication(ProcessApplicationInterface processApplication) {
ProcessApplicationContextImpl.set(new ProcessApplicationIdentifier(processApplication));
}
|
Declares the context process application for all subsequent engine API invocations
until {@link #clear()} is called. The context is bound to the current thread.
This method should always be used in a try-finally block to ensure that {@link #clear()}
is called under any circumstances.
@param processApplication the process application to switch into
|
setCurrentProcessApplication
|
java
|
camunda/camunda-bpm-platform
|
engine/src/main/java/org/camunda/bpm/application/ProcessApplicationContext.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/application/ProcessApplicationContext.java
|
Apache-2.0
|
public static <T> T withProcessApplicationContext(Callable<T> callable, String processApplicationName) throws Exception {
try {
setCurrentProcessApplication(processApplicationName);
return callable.call();
}
finally {
clear();
}
}
|
<p>Takes a callable and executes all engine API invocations within that callable in the context
of the given process application
<p>Equivalent to
<pre>
try {
ProcessApplicationContext.setCurrentProcessApplication("someProcessApplication");
callable.call();
} finally {
ProcessApplicationContext.clear();
}
</pre>
@param callable the callable to execute
@param name the name of the process application to switch into
|
withProcessApplicationContext
|
java
|
camunda/camunda-bpm-platform
|
engine/src/main/java/org/camunda/bpm/application/ProcessApplicationContext.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/application/ProcessApplicationContext.java
|
Apache-2.0
|
public static <T> T withProcessApplicationContext(Callable<T> callable, ProcessApplicationReference reference) throws Exception {
try {
setCurrentProcessApplication(reference);
return callable.call();
}
finally {
clear();
}
}
|
<p>Takes a callable and executes all engine API invocations within that callable in the context
of the given process application
<p>Equivalent to
<pre>
try {
ProcessApplicationContext.setCurrentProcessApplication("someProcessApplication");
callable.call();
} finally {
ProcessApplicationContext.clear();
}
</pre>
@param callable the callable to execute
@param reference a reference of the process application to switch into
|
withProcessApplicationContext
|
java
|
camunda/camunda-bpm-platform
|
engine/src/main/java/org/camunda/bpm/application/ProcessApplicationContext.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/application/ProcessApplicationContext.java
|
Apache-2.0
|
public static <T> T withProcessApplicationContext(Callable<T> callable, ProcessApplicationInterface processApplication) throws Exception {
try {
setCurrentProcessApplication(processApplication);
return callable.call();
}
finally {
clear();
}
}
|
<p>Takes a callable and executes all engine API invocations within that callable in the context
of the given process application
<p>Equivalent to
<pre>
try {
ProcessApplicationContext.setCurrentProcessApplication("someProcessApplication");
callable.call();
} finally {
ProcessApplicationContext.clear();
}
</pre>
@param callable the callable to execute
@param processApplication the process application to switch into
|
withProcessApplicationContext
|
java
|
camunda/camunda-bpm-platform
|
engine/src/main/java/org/camunda/bpm/application/ProcessApplicationContext.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/application/ProcessApplicationContext.java
|
Apache-2.0
|
public int compare(ProcessApplicationElResolver o1, ProcessApplicationElResolver o2) {
return (-1) * o1.getPrecedence().compareTo(o2.getPrecedence());
}
|
Comparator used for sorting providers
@see ProcessApplicationElResolver#getPrecedence()
|
compare
|
java
|
camunda/camunda-bpm-platform
|
engine/src/main/java/org/camunda/bpm/application/ProcessApplicationElResolver.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/application/ProcessApplicationElResolver.java
|
Apache-2.0
|
protected String lookupEeApplicationName() {
try {
InitialContext initialContext = new InitialContext();
String appName = (String) initialContext.lookup(JAVA_APP_APP_NAME_PATH);
String moduleName = (String) initialContext.lookup(MODULE_NAME_PATH);
// make sure that if an EAR carries multiple PAs, they are correctly
// identified by appName + moduleName
if (moduleName != null && !moduleName.equals(appName)) {
return appName + "/" + moduleName;
} else {
return appName;
}
}
catch (NamingException e) {
throw LOG.ejbPaCannotAutodetectName(e);
}
}
|
determine the ee application name based on information obtained from JNDI.
|
lookupEeApplicationName
|
java
|
camunda/camunda-bpm-platform
|
engine/src/main/java/org/camunda/bpm/application/impl/AbstractEjbProcessApplication.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/application/impl/AbstractEjbProcessApplication.java
|
Apache-2.0
|
protected void onStartUp(Set<Class<?>> c, String contextPath, Class<?> servletProcessApplicationClass, Consumer<String> processApplicationClassNameConsumer) throws Exception {
if (c == null || c.isEmpty()) {
// skip deployments that do not carry a PA
return;
}
if (c.contains(ProcessApplication.class)) {
// copy into a fresh Set as we don't know if the original Set is mutable or immutable
c = new HashSet<>(c);
// and now remove the annotation itself
c.remove(ProcessApplication.class);
}
if (c.size() > 1) {
// a deployment must only contain a single PA
throw getServletException(LOG.multiplePasException(c, contextPath));
} else if (c.size() == 1) {
Class<?> paClass = c.iterator().next();
// validate whether it is a legal Process Application
if (!AbstractProcessApplication.class.isAssignableFrom(paClass)) {
throw getServletException(LOG.paWrongTypeException(paClass));
}
// add it as listener if it's a servlet process application
if (servletProcessApplicationClass.isAssignableFrom(paClass)) {
LOG.detectedPa(paClass);
processApplicationClassNameConsumer.accept(paClass.getName());
}
} else {
LOG.servletDeployerNoPaFound(contextPath);
}
}
|
This base class provides a template method to handle servlet applications annotated
with the {@link ProcessApplication}.
@author Daniel Meyer
|
onStartUp
|
java
|
camunda/camunda-bpm-platform
|
engine/src/main/java/org/camunda/bpm/application/impl/AbstractServletProcessApplicationDeployer.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/application/impl/AbstractServletProcessApplicationDeployer.java
|
Apache-2.0
|
public <T> T execute(Callable<T> callable) throws ProcessApplicationExecutionException {
try {
return callable.call();
}
catch (Exception e) {
throw LOG.processApplicationExecutionException(e);
}
}
|
Since the process engine is loaded by the same classloader
as the process application, nothing needs to be done.
|
execute
|
java
|
camunda/camunda-bpm-platform
|
engine/src/main/java/org/camunda/bpm/application/impl/EmbeddedProcessApplication.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/application/impl/EmbeddedProcessApplication.java
|
Apache-2.0
|
public ScriptEngine getScriptEngineForName(String scriptEngineName, boolean cache) {
if(processApplicationScriptEngineResolver == null) {
synchronized (this) {
if(processApplicationScriptEngineResolver == null) {
processApplicationScriptEngineResolver = new DefaultScriptEngineResolver(new ScriptEngineManager(getProcessApplicationClassloader()));
}
}
}
return processApplicationScriptEngineResolver.getScriptEngine(scriptEngineName, cache);
}
|
<p>Returns an instance of {@link ScriptEngine} for the given <code>scriptEngineName</code>.</p>
<p>Iff the given parameter <code>cache</code> is set <code>true</code>,
then the instance {@link ScriptEngine} will be cached.</p>
@param scriptEngineName the name of the {@link ScriptEngine} to return
@param cache a boolean value which indicates whether the {@link ScriptEngine} should
be cached or not.
@return a {@link ScriptEngine}
|
getScriptEngineForName
|
java
|
camunda/camunda-bpm-platform
|
engine/src/main/java/org/camunda/bpm/application/impl/ProcessApplicationScriptEnvironment.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/application/impl/ProcessApplicationScriptEnvironment.java
|
Apache-2.0
|
public void preInit(ProcessEngineConfigurationImpl processEngineConfiguration) {
List<BpmnParseListener> preParseListeners = processEngineConfiguration.getCustomPreBPMNParseListeners();
if(preParseListeners == null) {
preParseListeners = new ArrayList<BpmnParseListener>();
processEngineConfiguration.setCustomPreBPMNParseListeners(preParseListeners);
}
preParseListeners.add(new ProcessApplicationEventParseListener());
}
|
<p>{@link ProcessEnginePlugin} enabling the process application event listener support.</p>
@author Daniel Meyer
|
preInit
|
java
|
camunda/camunda-bpm-platform
|
engine/src/main/java/org/camunda/bpm/application/impl/event/ProcessApplicationEventListenerPlugin.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/application/impl/event/ProcessApplicationEventListenerPlugin.java
|
Apache-2.0
|
@Override
protected void parseRootElement() {
List<ProcessEngineXml> processEngines = new ArrayList<ProcessEngineXml>();
List<ProcessArchiveXml> processArchives = new ArrayList<ProcessArchiveXml>();
for (Element element : rootElement.elements()) {
if(PROCESS_ENGINE.equals(element.getTagName())) {
parseProcessEngine(element, processEngines);
} else if(PROCESS_ARCHIVE.equals(element.getTagName())) {
parseProcessArchive(element, processArchives);
}
}
processesXml = new ProcessesXmlImpl(processEngines, processArchives);
}
|
we know this is a <code><process-application ... /></code> structure.
|
parseRootElement
|
java
|
camunda/camunda-bpm-platform
|
engine/src/main/java/org/camunda/bpm/application/impl/metadata/ProcessesXmlParse.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/application/impl/metadata/ProcessesXmlParse.java
|
Apache-2.0
|
protected void stopProcessApplication(ProcessApplicationReference processApplicationReference) {
try {
// unless the user has overridden the stop behavior,
// this causes the process application to remove its services
// (triggers nested undeployment operation)
ProcessApplicationInterface processApplication = processApplicationReference.getProcessApplication();
processApplication.undeploy();
}
catch(Throwable t) {
LOG.exceptionWhileStopping("Process Application", processApplicationReference.getName(), t);
}
}
|
<p> Stops a process application. Exceptions are logged but not re-thrown).
@param processApplicationReference
|
stopProcessApplication
|
java
|
camunda/camunda-bpm-platform
|
engine/src/main/java/org/camunda/bpm/container/impl/deployment/StopProcessApplicationsStep.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/container/impl/deployment/StopProcessApplicationsStep.java
|
Apache-2.0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.