code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
public void setInteractive(final boolean INTERACTIVE) {
if (null == interactive) {
_interactive = INTERACTIVE;
fireUpdateEvent(INTERACTIVITY_EVENT);
} else {
interactive.set(INTERACTIVE);
}
} | java |
public void setButtonTooltipText(final String TEXT) {
if (null == buttonTooltipText) {
_buttonTooltipText = TEXT;
fireUpdateEvent(REDRAW_EVENT);
} else {
buttonTooltipText.set(TEXT);
}
} | java |
public void setAlertMessage(final String MESSAGE) {
if (null == alertMessage) {
_alertMessage = MESSAGE;
fireUpdateEvent(ALERT_EVENT);
} else {
alertMessage.set(MESSAGE);
}
} | java |
public void stop() {
setLedOn(false);
if (null != blinkFuture) { blinkFuture.cancel(true); }
if (null != blinkService) { blinkService.shutdownNow(); }
} | java |
public void setValue(final double VALUE) {
if (null == value) {
_value = VALUE;
} else {
value.set(VALUE);
}
fireMarkerEvent(VALUE_CHANGED_EVENT);
} | java |
public void setText(final String TEXT) {
if (null == text) {
_text = TEXT;
} else {
text.set(TEXT);
}
fireMarkerEvent(TEXT_CHANGED_EVENT);
} | java |
public void setColor(final Color COLOR) {
if (null == color) {
_color = COLOR;
} else {
color.set(COLOR);
}
fireMarkerEvent(COLOR_CHANGED_EVENT);
} | java |
public void setMarkerType(final MarkerType TYPE) {
if (null == markerType) {
_markerType = null == TYPE ? MarkerType.STANDARD : TYPE;
} else {
markerType.set(TYPE);
}
fireMarkerEvent(TYPE_CHANGED_EVENT);
} | java |
@SuppressWarnings("unused")
@Override
public void onPaymentSuccess(String razorpayPaymentID) {
try {
Toast.makeText(this, "Payment Successful: " + razorpayPaymentID, Toast.LENGTH_SHORT).show();
} catch (Exception e) {
Log.e(TAG, "Exception in onPaymentSuccess", e);
... | java |
@SuppressWarnings("unused")
@Override
public void onPaymentError(int code, String response) {
try {
Toast.makeText(this, "Payment failed: " + code + " " + response, Toast.LENGTH_SHORT).show();
} catch (Exception e) {
Log.e(TAG, "Exception in onPaymentError", e);
}... | java |
public static <T extends View> T mount(T v, Renderable r) {
Mount m = new Mount(v, r);
mounts.put(v, m);
render(v);
return v;
} | java |
@SuppressWarnings("unchecked")
public static <T extends View> T currentView() {
if (currentMount == null) {
return null;
}
return (T) currentMount.iterator.currentView();
} | java |
static
public List<?> getContent(NDArray array){
Object content = array.getContent();
return asJavaList(array, (List<?>)content);
} | java |
static
public List<?> getContent(NDArray array, String key){
Map<String, ?> content = (Map<String, ?>)array.getContent();
return asJavaList(array, (List<?>)content.get(key));
} | java |
private void launchServer() {
try {
log.info("Configuring Android SDK");
if (config.getAndroidHome() != null) {
AndroidSdk.setAndroidHome(config.getAndroidHome());
}
if (config.getAndroidSdkVersion() != null) {
AndroidSdk.setAndroidSdkVersion(config.getAndroidSdkVersion());
... | java |
public void launchSelendroid() {
launchServer();
if (config.isGrid()) {
// Longer timeout to allow for grid registration
HttpClientUtil.waitForServer(server.getPort(), 3, TimeUnit.MINUTES);
} else {
HttpClientUtil.waitForServer(server.getPort(), 20, TimeUnit.SECONDS);
}
} | java |
public AndroidElement get(String elementId) {
AndroidElement element = cache.get(elementId);
if (element instanceof AndroidNativeElement) {
if (!ViewHierarchyAnalyzer.getDefaultInstance().isViewChieldOfCurrentRootView(
((AndroidNativeElement) element).getView())) {
return null;
}
... | java |
public static List<CallLogEntry> getAllLogsOfDuration(List<CallLogEntry> logs, int duration, boolean greaterthan) {
List<CallLogEntry> list = new ArrayList<CallLogEntry>();
for(CallLogEntry log : logs) {
if(log.duration<duration ^ greaterthan) {
list.add(log);
}
}
return list;
} | java |
public static boolean containsLogFromNumber(List<CallLogEntry> logs, String number) {
for(CallLogEntry log : logs) {
if(log.number.equals(number)) {
return true;
}
}
return false;
} | java |
private InputStream getResourceAsStream(String resource) {
InputStream is = getClass().getResourceAsStream(resource);
// switch needed for testability
if (is == null) {
try {
is = new FileInputStream(new File(resource));
} catch (FileNotFoundException e) {
// do nothing
}
... | java |
@Override
public void setSystemProperty(String propertyName, String value) {
if (Strings.isNullOrEmpty(propertyName)) {
throw new IllegalArgumentException("Property name can't be empty.");
}
execute(
"-selendroid-setAndroidOsSystemProperty",
ImmutableMap.of(
"propertyNam... | java |
private JSONObject getNodeConfig() {
JSONObject res = new JSONObject();
try {
res.put("class", "org.openqa.grid.common.RegistrationRequest");
res.put("configuration", getConfiguration());
JSONArray caps = new JSONArray();
JSONArray devices = driver.getSupportedDevices();
for (int i... | java |
private JSONObject getConfiguration() throws JSONException {
JSONObject configuration = new JSONObject();
configuration.put("port", config.getPort());
configuration.put("register", true);
if (config.getProxy() != null) {
configuration.put("proxy", config.getProxy());
} else {
configura... | java |
protected void startServerImpl() {
SelendroidLogger.info("*** ServerInstrumentation#startServerImpl() ***");
if (serverThread != null && serverThread.isAlive()) {
return;
}
if (serverThread != null) {
stopServer();
}
serverThread = new HttpdThrea... | java |
public TouchActionBuilder pointerDown(WebElement element, int x, int y) {
Preconditions.checkState(!isDown);
Map<String, Object> params = getTouchParameters(element, x, y);
addAction(TouchActionName.POINTER_DOWN, params);
isDown = true;
return this;
} | java |
public TouchActionBuilder pointerMove(WebElement element, int x, int y) {
Preconditions.checkState(isDown);
Map<String, Object> params = getTouchParameters(element, x, y);
addAction(TouchActionName.POINTER_MOVE, params);
return this;
} | java |
protected void sleep() {
try {
Thread.sleep(sleepIntervalInMillis);
} catch (InterruptedException exception) {
Thread.currentThread().interrupt();
throw new SelendroidException(exception);
}
} | java |
public void addToAppsStore(File file) throws AndroidSdkException {
AndroidApp app = null;
try {
app = selendroidApkBuilder.resignApp(file);
} catch (Exception e) {
throw new SessionNotCreatedException(
"An error occurred while resigning the app '" + file.getName()
+ "'. "... | java |
private void startFolderMonitor() {
if (serverConfiguration.getAppFolderToMonitor() != null) {
try {
folderMonitor = new FolderMonitor(this, serverConfiguration);
folderMonitor.start();
} catch (IOException e) {
log.warning("Could not monitor the given folder: "
+ ser... | java |
private String readFile(File file) {
BufferedReader reader = null;
try {
reader = new BufferedReader(new FileReader(file));
String line = null;
StringBuilder sb = new StringBuilder();
String separator = System.getProperty("line.separator");
while ((line = reader.readLine()) != null... | java |
public static Intent createStartActivityIntent(Context context, String mainActivityName) {
Intent intent = new Intent();
intent.setClassName(context, mainActivityName);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT
| Intent.FLAG_ACTIVITY_SI... | java |
public static Intent createUriIntent(String intentAction, String intentUri) {
if (intentAction == null) {
intentAction = Intent.ACTION_VIEW;
}
return new Intent(intentAction, Uri.parse(intentUri))
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_REORDER_... | java |
public static Intent createStartServiceIntent(
Context context, String serviceClassName, String intentAction) {
Intent intent = intentAction != null ? new Intent(intentAction) : new Intent();
return intent.setClassName(context, serviceClassName);
} | java |
private List<String> getDomainsFromUrl(URL url) {
String host = url.getHost();
String[] paths = new String[] {};
if (url.getPath() != null) {
paths = url.getPath().split("/");
}
List<String> domains = new ArrayList<String>(paths.length + 1);
StringBuilder rela... | java |
public static SelendroidResponse forCatchAllError(String sessionId, Throwable e) {
try {
return new SelendroidResponse(sessionId, StatusCode.UNKNOWN_ERROR.getCode(), e, CATCH_ALL_ERROR_MESSAGE_PREFIX);
} catch (JSONException err) {
return new SelendroidResponse(sessionId, StatusCode.UNKNOWN_ERROR.ge... | java |
public void release(AndroidDevice device, AndroidApp aut) {
log.info("Releasing device " + device);
if (devicesInUse.contains(device)) {
if (aut != null) {
// stop the app anyway - better in case people do use snapshots
try {
device.kill(aut);
} catch (Exception e) {
... | java |
protected synchronized void addDeviceToStore(AndroidDevice device) throws AndroidDeviceException {
if (androidDevices.containsKey(device.getTargetPlatform())) {
List<AndroidDevice> platformDevices = androidDevices.get(device.getTargetPlatform());
if (!platformDevices.contains(device)) {
platform... | java |
@Override
public void send(final CharSequence text) {
final KeyCharacterMap characterMap = KeyCharacterMap.load(KeyCharacterMap.VIRTUAL_KEYBOARD);
long timeout =
System.currentTimeMillis()
+ serverInstrumentation.getAndroidWait().getTimeoutInMillis();
SelendroidLogger.info("Using time... | java |
public SelendroidCapabilities addBootstrapClass(String className) {
String currentClassNames = getBootstrapClassNames();
if (currentClassNames == null || currentClassNames.isEmpty()) {
setCapability(BOOTSTRAP_CLASS_NAMES, className);
} else {
setCapability(BOOTSTRAP_CLASS_NAMES, currentClassName... | java |
private String getDefaultVersion(Set<String> keys, String appName) {
SortedSet<String> listOfApps = new TreeSet<String>();
for (String key : keys) {
if (key.split(":")[0].contentEquals(appName)) {
listOfApps.add(key);
}
}
return listOfApps.size() > 0 ? listOfApps.last() : null;
} | java |
private Boolean getBooleanCapability(String key) {
Object o = getRawCapabilities().get(key);
if (o == null) {
return null;
} else if (o instanceof Boolean) {
return (Boolean) o;
} else if (o instanceof String
&& ("true".equalsIgnoreCase((String) o)
|| "false".equalsIg... | java |
public Point getLocation() {
JSONObject result =
(JSONObject) driver.executeAtom(AndroidAtoms.GET_TOP_LEFT_COORDINATES, null, this);
try {
return new Point(result.getInt("x"), result.getInt("y"));
} catch (JSONException e) {
throw new SelendroidException(e);
}
} | java |
protected void initializeAdbConnection() {
// Get a device bridge instance. Initialize, create and restart.
try {
AndroidDebugBridge.init(false);
} catch (IllegalStateException e) {
if (!shouldKeepAdbAlive) {
log.log(
Level.WARNING,
"AndroidDebugBridge may have be... | java |
public void shutdown() {
log.info("Notifying device listener about shutdown");
for (HardwareDeviceListener listener : deviceListeners) {
for (AndroidDevice device : connectedDevices.values()) {
listener.onDeviceDisconnected(connectedDevices.get(device));
}
}
log.info("Removing Device... | java |
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
canvas.drawOval(rectF, backgroundPaint);
float realProgress = progress * DEFAULT_MAX_VALUE / progressMax;
float angle = (rightToLeft ? 360 : -360) * realProgress / 100;
canvas.drawArc(rectF, startAngle, an... | java |
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
final int height = getDefaultSize(getSuggestedMinimumHeight(), heightMeasureSpec);
final int width = getDefaultSize(getSuggestedMinimumWidth(), widthMeasureSpec);
final int min = Math.min(width, height);
... | java |
public void setProgressWithAnimation(float progress, int duration) {
if (progressAnimator != null) {
progressAnimator.cancel();
}
progressAnimator = ValueAnimator.ofFloat(this.progress, progress);
progressAnimator.setDuration(duration);
progressAnimator.addUpdateListe... | java |
private int adjustAlpha(int color, float factor) {
int alpha = Math.round(Color.alpha(color) * factor);
int red = Color.red(color);
int green = Color.green(color);
int blue = Color.blue(color);
return Color.argb(alpha, red, green, blue);
} | java |
private JsonObject callGet(final String urlString) {
return RetryUtils.retry(new Callable<JsonObject>() {
@Override
public JsonObject call() {
return Json
.parse(RestClient.create(urlString).withHeader("Authorization", String.format("Bearer %s", ap... | java |
private SSLSocketFactory buildSslSocketFactory() {
try {
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
keyStore.load(null, null);
keyStore.setCertificateEntry("ca", generateCertificate());
TrustManagerFactory tmf = TrustManagerFactory.getIn... | java |
private Certificate generateCertificate()
throws IOException, CertificateException {
InputStream caInput = null;
try {
CertificateFactory cf = CertificateFactory.getInstance("X.509");
caInput = new ByteArrayInputStream(caCertificate.getBytes("UTF-8"));
ret... | java |
public boolean isOK(PublicKey key) {
try {
final var digester = MessageDigest.getInstance(get(DIGEST_KEY).getString());
final var ser = unsigned();
final var digestValue = digester.digest(ser);
final var cipher = Cipher.getInstance(key.getAlgorithm());
... | java |
private Feature[] featuresSorted(Set<String> excluded) {
return this.features.values().stream().filter(f -> !excluded.contains(f.name()))
.sorted(Comparator.comparing(Feature::name)).toArray(Feature[]::new);
} | java |
public byte[] serialized() {
final var nameBuffer = name.getBytes(StandardCharsets.UTF_8);
final var typeLength = Integer.BYTES;
final var nameLength = Integer.BYTES + nameBuffer.length;
final var valueLength = type.fixedSize == VARIABLE_LENGTH ? Integer.BYTES + value.length : type.fixed... | java |
public License read(IOFormat format) throws IOException {
switch (format) {
case BINARY:
return License.Create.from(ByteArrayReader.readInput(is));
case BASE64:
return License.Create.from(Base64.getDecoder().decode(ByteArrayReader.readInput(is)));
... | java |
public void write(LicenseKeyPair pair, IOFormat format) throws IOException {
switch (format) {
case BINARY:
osPrivate.write(pair.getPrivate());
osPublic.write(pair.getPublic());
return;
case BASE64:
osPrivate.write(Base64.ge... | java |
public void write(License license, IOFormat format) throws IOException {
switch (format) {
case BINARY:
os.write(license.serialized());
return;
case BASE64:
os.write(Base64.getEncoder().encode(license.serialized()));
return;... | java |
public byte[] getPrivate() {
keyNotNull(pair.getPrivate());
Key key = pair.getPrivate();
return getKeyBytes(key);
} | java |
public byte[] getPublic() {
keyNotNull(pair.getPublic());
Key key = pair.getPublic();
return getKeyBytes(key);
} | java |
public String getMachineIdString() throws NoSuchAlgorithmException,
SocketException, UnknownHostException {
return calculator.getMachineIdString(useNetwork, useHostName, useArchitecture);
} | java |
public boolean assertUUID(final UUID uuid)
throws NoSuchAlgorithmException, SocketException,
UnknownHostException {
return calculator.assertUUID(uuid, useNetwork, useHostName, useArchitecture);
} | java |
@Nonnull
public String createSessionId( @Nonnull final String sessionId ) {
return isEncodeNodeIdInSessionId() ? _sessionIdFormat.createSessionId(sessionId, _nodeIdService.getMemcachedNodeId() ) : sessionId;
} | java |
public void setNodeAvailable(@Nullable final String nodeId, final boolean available) {
if ( _nodeIdService != null ) {
_nodeIdService.setNodeAvailable(nodeId, available);
}
} | java |
public boolean isValidForMemcached(final String sessionId) {
if ( isEncodeNodeIdInSessionId() ) {
final String nodeId = _sessionIdFormat.extractMemcachedId( sessionId );
if ( nodeId == null ) {
LOG.debug( "The sessionId does not contain a nodeId so that the memcached node could not be i... | java |
public boolean canHitMemcached(final String sessionId) {
if ( isEncodeNodeIdInSessionId() ) {
final String nodeId = _sessionIdFormat.extractMemcachedId( sessionId );
if ( nodeId == null ) {
LOG.debug( "The sessionId does not contain a nodeId so that the memcached node could not be ident... | java |
public String setNodeAvailableForSessionId(final String sessionId, final boolean available) {
if ( _nodeIdService != null && isEncodeNodeIdInSessionId() ) {
final String nodeId = _sessionIdFormat.extractMemcachedId(sessionId);
if ( nodeId != null ) {
_nodeIdService.setNodeAvailable(nodeId, available);
r... | java |
public String changeSessionIdForTomcatFailover( @Nonnull final String sessionId, final String jvmRoute ) {
final String newSessionId = jvmRoute != null && !jvmRoute.trim().isEmpty()
? _sessionIdFormat.changeJvmRoute( sessionId, jvmRoute )
: _sessionIdFormat.stripJvmRoute(sessionI... | java |
public List<URI> getCouchbaseBucketURIs() {
if(!isCouchbaseBucketConfig())
throw new IllegalStateException("This is not a couchbase bucket configuration.");
final List<URI> result = new ArrayList<URI>(_address2Ids.size());
final Matcher matcher = COUCHBASE_BUCKET_NODE_PATTERN.matcher... | java |
public void setMaxActiveSessions( final int max ) {
final int oldMaxActiveSessions = _maxActiveSessions;
_maxActiveSessions = max;
support.firePropertyChange( "maxActiveSessions",
Integer.valueOf( oldMaxActiveSessions ),
Integer.valueOf( _maxActiveSessions ) );
... | java |
public void modifyingRequest( final String requestId ) {
if ( _log.isDebugEnabled() ) {
_log.debug( "Registering modifying request: " + requestId );
}
incrementOrPut( _blacklist, requestId );
_readOnlyRequests.remove( requestId );
} | java |
public boolean isReadOnlyRequest( final String requestId ) {
if ( _log.isDebugEnabled() ) {
_log.debug( "Asked for readonly request: " + requestId + " ("+ _readOnlyRequests.containsKey( requestId ) +")" );
}
// TODO: add some threshold
return _readOnlyRequests.containsKey( re... | java |
@Override
public ConcurrentMap<String, Object> deserializeAttributes(final byte[] in) {
final InputStreamReader inputStream = new InputStreamReader( new ByteArrayInputStream( in ) );
if (LOG.isDebugEnabled()) {
LOG.debug("deserialize the stream");
}
try {
return deserializer.deserializeInto(inp... | java |
protected void onBackupWithoutLoadedSession( @Nonnull final String sessionId, @Nonnull final String requestId,
@Nonnull final BackupSessionService backupSessionService ) {
if ( !_sessionIdFormat.isValid( sessionId ) ) {
return;
}
try {
final long start = Sy... | java |
protected void onAfterBackupSession( @Nonnull final MemcachedBackupSession session, final boolean backupWasForced,
@Nonnull final Future<BackupResult> result, @Nonnull final String requestId,
@Nonnull final BackupSessionService backupSessionService ) {
if ( !_sessionIdFormat.isValid( se... | java |
protected void onAfterDeleteFromMemcached( @Nonnull final String sessionId ) {
final long start = System.currentTimeMillis();
final String validityInfoKey = _sessionIdFormat.createValidityInfoKeyName( sessionId );
_storage.delete( validityInfoKey );
if (_storeSecondaryBackup) {
... | java |
void startInternal() throws LifecycleException {
_log.info( getClass().getSimpleName() + " starts initialization... (configured" +
" nodes definition " + _memcachedNodes + ", failover nodes " + _failoverNodes + ")" );
_statistics = Statistics.create( _enableStatistics );
_memca... | java |
public Future<BackupResult> backupSession( final String sessionId, final boolean sessionIdChanged, final String requestId ) {
if ( !_enabled.get() ) {
return new SimpleFuture<BackupResult>( BackupResult.SKIPPED );
}
final MemcachedBackupSession msmSession = _manager.getSessionIntern... | java |
@Nonnull
public String createSessionId(@Nonnull final String sessionId, @Nullable final String memcachedId) {
if ( LOG.isDebugEnabled() ) {
LOG.debug( "Creating new session id with orig id '" + sessionId + "' and memcached id '" + memcachedId + "'." );
}
if ( memcachedId == null ... | java |
@CheckForNull
public String extractMemcachedId( @Nonnull final String sessionId ) {
final int idxDash = sessionId.indexOf( '-' );
if ( idxDash < 0 ) {
return null;
}
final int idxDot = sessionId.indexOf( '.' );
if ( idxDot < 0 ) {
return sessionId.subs... | java |
@CheckForNull
public String extractJvmRoute( @Nonnull final String sessionId ) {
final int idxDot = sessionId.indexOf( '.' );
return idxDot < 0 ? null : sessionId.substring( idxDot + 1 );
} | java |
@Nonnull
public String stripJvmRoute( @Nonnull final String sessionId ) {
final int idxDot = sessionId.indexOf( '.' );
return idxDot < 0 ? sessionId : sessionId.substring( 0, idxDot );
} | java |
public Future<BackupResult> backupSession( final String sessionId, final boolean sessionIdChanged, final String requestId ) {
final MemcachedBackupSession session = _manager.getSessionInternal( sessionId );
if ( session == null ) {
if(_log.isDebugEnabled())
_log.deb... | java |
private boolean filterAttribute( final String name ) {
if ( this.manager == null ) {
throw new IllegalStateException( "There's no manager set." );
}
final Pattern pattern = ((SessionManager)manager).getMemcachedSessionService().getSessionAttributePattern();
if ( pattern == nu... | java |
int getMemcachedExpirationTime() {
if ( !_sticky ) {
throw new IllegalStateException( "The memcached expiration time cannot be determined in non-sticky mode." );
}
if ( _lastMemcachedExpirationTime == 0 ) {
return 0;
}
final long timeIdleInMillis = _lastB... | java |
public ConcurrentMap<String, Object> getAttributesFiltered() {
if ( this.manager == null ) {
throw new IllegalStateException( "There's no manager set." );
}
final Pattern pattern = ((SessionManager)manager).getMemcachedSessionService().getSessionAttributePattern();
final Conc... | java |
public V put( final K key, final V value ) {
synchronized ( _map ) {
final ManagedItem<V> previous = _map.put( key, new ManagedItem<V>( value, System.currentTimeMillis() ) );
while ( _map.size() > _size ) {
_map.remove( _map.keySet().iterator().next() );
}
... | java |
public V get( final K key ) {
synchronized ( _map ) {
final ManagedItem<V> item = _map.get( key );
if ( item == null ) {
return null;
}
if ( _ttl > -1 && System.currentTimeMillis() - item._insertionTime > _ttl ) {
_map.remove( key )... | java |
public List<K> getKeys() {
synchronized ( _map ) {
return new java.util.ArrayList<K>( _map.keySet() );
}
} | java |
public List<K> getKeysSortedByValue( final Comparator<V> comparator ) {
synchronized ( _map ) {
@SuppressWarnings( "unchecked" )
final
Entry<K, ManagedItem<V>>[] a = _map.entrySet().toArray( new Map.Entry[_map.size()] );
final Comparator<Entry<K, ManagedItem<V>>> ... | java |
public boolean isNodeAvailable( @Nonnull final K key ) {
final ManagedItem<Boolean> item = _map.get( key );
if ( item == null ) {
return updateIsNodeAvailable( key );
} else if ( isExpired( item ) ) {
_map.remove( key );
return updateIsNodeAvailable( key );
... | java |
public Set<K> getUnavailableNodes() {
final Set<K> result = new HashSet<K>();
for ( final Map.Entry<K, ManagedItem<Boolean>> entry : _map.entrySet() ) {
if ( !entry.getValue()._value.booleanValue() && !isExpired( entry.getValue() ) ) {
result.add( entry.getKey() );
... | java |
@GET
@Path("/health")
@Produces(MediaType.APPLICATION_JSON)
public HealthStatus health() throws ExecutionException, InterruptedException {
final HealthStatus status = new HealthStatus();
final Future<HealthDetails> dbStatus = healthDBService.dbStatus();
final Future<List<HealthDetai... | java |
@Produces
@LoggedIn
public String extractUsername() {
final KeycloakPrincipal principal = (KeycloakPrincipal) httpServletRequest.getUserPrincipal();
if (principal != null) {
logger.debug("Running with Keycloak context");
KeycloakSecurityContext kcSecurityContext = princi... | java |
public static String extractAeroGearSenderInformation(final HttpServletRequest request) {
String client = request.getHeader("aerogear-sender");
if (hasValue(client)) {
return client;
}
// if there was no usage of our custom header, we simply return the user-agent value
... | java |
@PUT
@Path("/{androidID}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response updateAndroidVariant(
@PathParam("pushAppID") String id,
@PathParam("androidID") String androidID,
AndroidVariant updatedAndroidApplication) {
... | java |
public static boolean isValidDeviceTokenForVariant(final String deviceToken, final VariantType type) {
switch (type) {
case IOS:
return IOS_DEVICE_TOKEN.matcher(deviceToken).matches();
case ANDROID:
return ANDROID_DEVICE_TOKEN.matcher(deviceToken).matches(... | java |
private boolean tryToDispatchTokens(MessageHolderWithTokens msg) {
try {
dispatchTokensEvent.fire(msg);
return true;
} catch (MessageDeliveryException e) {
Throwable cause = e.getCause();
if (isQueueFullException(cause)) {
return false;
... | java |
private int delete(String urlS) throws IOException {
URL url = new URL(urlS);
HttpURLConnection conn = prepareAuthorizedConnection(url);
conn.setRequestMethod("DELETE");
conn.connect();
return conn.getResponseCode();
} | java |
private String get(String urlS) throws IOException {
URL url = new URL(urlS);
HttpURLConnection conn = prepareAuthorizedConnection(url);
conn.setRequestMethod("GET");
// Read response
StringBuilder result = new StringBuilder();
try (BufferedReader rd = new BufferedReader(... | java |
public static boolean isCategoryOnlyCriteria(final Criteria criteria) {
return isEmpty(criteria.getAliases()) && // we are not subscribing to alias topic (yet)
isEmpty(criteria.getDeviceTypes()) && // we are not subscribing to device type topic (yet)
!isEmpty(criteria.get... | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.