Tabnine Logo
BaseCredentialsService
Code IndexAdd Tabnine to your IDE (free)

How to use
BaseCredentialsService
in
org.eclipse.hono.service.credentials

Best Java code snippets using org.eclipse.hono.service.credentials.BaseCredentialsService (Showing top 12 results out of 315)

origin: eclipse/hono

@Override
public final void get(final String tenantId, final String type, final String authId, final JsonObject clientContext,
        final Handler<AsyncResult<CredentialsResult<JsonObject>>> resultHandler) {
  get(tenantId, type, authId, clientContext, NoopSpan.INSTANCE, resultHandler);
}
origin: org.eclipse.hono/hono-service-base

/**
 * {@inheritDoc}
 *
 * This default implementation simply returns an empty result with status code 501 (Not Implemented).
 * Subclasses should override this method in order to provide a reasonable implementation.
 */
@Override
public void get(final String tenantId, final String type, final String authId, final JsonObject clientContext, final Handler<AsyncResult<CredentialsResult<JsonObject>>> resultHandler) {
  handleUnimplementedOperation(resultHandler);
}
origin: eclipse/hono

final JsonObject payload = request.getJsonPayload();
final Span span = newChildSpan(SPAN_NAME_GET_CREDENTIALS, request.getSpanContext(), tenantId);
final Future<EventBusMessage> resultFuture;
if (tenantId == null || payload == null) {
  resultFuture = Future.failedFuture(new ClientErrorException(HttpURLConnection.HTTP_BAD_REQUEST));
} else {
  final String type = removeTypesafeValueForField(String.class, payload, CredentialsConstants.FIELD_TYPE);
  final String authId = removeTypesafeValueForField(String.class, payload,
      CredentialsConstants.FIELD_AUTH_ID);
  final String deviceId = removeTypesafeValueForField(String.class, payload,
      CredentialsConstants.FIELD_PAYLOAD_DEVICE_ID);
    resultFuture = Future.failedFuture(new ClientErrorException(HttpURLConnection.HTTP_BAD_REQUEST));
  } else if (authId != null && deviceId == null) {
    resultFuture = processGetByAuthIdRequest(request, tenantId, payload, type, authId, span);
  } else if (deviceId != null && authId == null) {
    resultFuture = processGetByDeviceIdRequest(request, tenantId, type, deviceId, span);
  } else {
    TracingHelper.logError(span, String.format(
return finishSpanOnFutureCompletion(span, resultFuture);
origin: org.eclipse.hono/hono-service-base

  return Future.failedFuture(new ClientErrorException(HttpURLConnection.HTTP_BAD_REQUEST));
} else {
  final String type = removeTypesafeValueForField(String.class, payload, CredentialsConstants.FIELD_TYPE);
  final String authId = removeTypesafeValueForField(String.class, payload,
      CredentialsConstants.FIELD_AUTH_ID);
  final String deviceId = removeTypesafeValueForField(String.class, payload,
      CredentialsConstants.FIELD_PAYLOAD_DEVICE_ID);
    log.debug("getting credentials [tenant: {}, type: {}, auth-id: {}]", tenantId, type, authId);
    final Future<CredentialsResult<JsonObject>> result = Future.future();
    get(tenantId, type, authId, payload, result.completer());
    return result.map(res -> {
      final String deviceIdFromPayload = Optional.ofNullable(res.getPayload())
          .map(p -> getTypesafeValueForField(String.class, p,
              TenantConstants.FIELD_PAYLOAD_DEVICE_ID))
          .orElse(null);
    log.debug("getting credentials for device [tenant: {}, device-id: {}]", tenantId, deviceId);
    final Future<CredentialsResult<JsonObject>> result = Future.future();
    getAll(tenantId, deviceId, result.completer());
    return result.map(res -> {
      return request.getResponse(res.getStatus())
origin: org.eclipse.hono/hono-service-base

/**
 * Processes a Credentials API request received via the vert.x event bus.
 * <p>
 * This method validates the request parameters against the Credentials API
 * specification before invoking the corresponding {@code CredentialsService} methods.
 *
 * @param request The request message.
 * @return A future indicating the outcome of the service invocation.
 * @throws NullPointerException If the request message is {@code null}.
 */
@Override
public Future<EventBusMessage> processRequest(final EventBusMessage request) {
  Objects.requireNonNull(request);
  final String operation = request.getOperation();
  switch (CredentialsConstants.CredentialsAction.from(operation)) {
    case get:
      return processGetRequest(request);
    default:
      return processCustomCredentialsMessage(request);
  }
}
origin: eclipse/hono

private Future<EventBusMessage> processGetByAuthIdRequest(final EventBusMessage request, final String tenantId,
    final JsonObject payload, final String type, final String authId, final Span span) {
  log.debug("getting credentials [tenant: {}, type: {}, auth-id: {}]", tenantId, type, authId);
  span.setTag(TAG_CREDENTIALS_TYPE, type);
  span.setTag(TAG_AUTH_ID, authId);
  final Future<CredentialsResult<JsonObject>> result = Future.future();
  get(tenantId, type, authId, payload, span, result.completer());
  return result.map(res -> {
    final String deviceIdFromPayload = Optional.ofNullable(res.getPayload())
        .map(p -> getTypesafeValueForField(String.class, p,
            TenantConstants.FIELD_PAYLOAD_DEVICE_ID))
        .orElse(null);
    if (deviceIdFromPayload != null) {
      span.setTag(MessageHelper.APP_PROPERTY_DEVICE_ID, deviceIdFromPayload);
    }
    return request.getResponse(res.getStatus())
        .setDeviceId(deviceIdFromPayload)
        .setJsonPayload(res.getPayload())
        .setCacheDirective(res.getCacheDirective());
  });
}
origin: eclipse/hono

private Future<EventBusMessage> processGetByDeviceIdRequest(final EventBusMessage request, final String tenantId,
    final String type, final String deviceId, final Span span) {
  log.debug("getting credentials for device [tenant: {}, device-id: {}]", tenantId, deviceId);
  span.setTag(TAG_CREDENTIALS_TYPE, type);
  span.setTag(MessageHelper.APP_PROPERTY_DEVICE_ID, deviceId);
  final Future<CredentialsResult<JsonObject>> result = Future.future();
  getAll(tenantId, deviceId, span, result.completer());
  return result.map(res -> {
    return request.getResponse(res.getStatus())
        .setDeviceId(deviceId)
        .setJsonPayload(res.getPayload())
        .setCacheDirective(res.getCacheDirective());
  });
}
origin: eclipse/hono

/**
 * Processes a Credentials API request received via the vert.x event bus.
 * <p>
 * This method validates the request parameters against the Credentials API
 * specification before invoking the corresponding {@code CredentialsService} methods.
 *
 * @param request The request message.
 * @return A future indicating the outcome of the service invocation.
 * @throws NullPointerException If the request message is {@code null}.
 */
@Override
public Future<EventBusMessage> processRequest(final EventBusMessage request) {
  Objects.requireNonNull(request);
  final String operation = request.getOperation();
  switch (CredentialsConstants.CredentialsAction.from(operation)) {
    case get:
      return processGetRequest(request);
    default:
      return processCustomCredentialsMessage(request);
  }
}
origin: eclipse/hono

/**
 * {@inheritDoc}
 *
 * This default implementation simply returns an empty result with status code 501 (Not Implemented).
 * Subclasses should override this method in order to provide a reasonable implementation.
 */
@Override
public void get(final String tenantId, final String type, final String authId, final Span span,
    final Handler<AsyncResult<CredentialsResult<JsonObject>>> resultHandler) {
  handleUnimplementedOperation(resultHandler);
}
origin: eclipse/hono

@Override
public final void get(final String tenantId, final String type, final String authId,
        final Handler<AsyncResult<CredentialsResult<JsonObject>>> resultHandler) {
  get(tenantId, type, authId, NoopSpan.INSTANCE, resultHandler);
}
origin: eclipse/hono

/**
 * {@inheritDoc}
 *
 * This default implementation simply returns an empty result with status code 501 (Not Implemented).
 * Subclasses should override this method in order to provide a reasonable implementation.
 */
@Override
public void get(final String tenantId, final String type, final String authId, final JsonObject clientContext,
    final Span span, final Handler<AsyncResult<CredentialsResult<JsonObject>>> resultHandler) {
  handleUnimplementedOperation(resultHandler);
}
origin: org.eclipse.hono/hono-service-base

/**
 * {@inheritDoc}
 *
 * This default implementation simply returns an empty result with status code 501 (Not Implemented).
 * Subclasses should override this method in order to provide a reasonable implementation.
 */
@Override
public void get(final String tenantId, final String type, final String authId, final Handler<AsyncResult<CredentialsResult<JsonObject>>> resultHandler) {
  handleUnimplementedOperation(resultHandler);
}
org.eclipse.hono.service.credentialsBaseCredentialsService

Javadoc

A base class for implementing CredentialsServices.

This base class provides support for receiving Get request messages via vert.x' event bus and routing them to specific methods accepting the query parameters contained in the request message.

Most used methods

  • finishSpanOnFutureCompletion
  • get
    This default implementation simply returns an empty result with status code 501 (Not Implemented). S
  • getAll
    Gets all credentials on record for a device.
  • getTypesafeValueForField
  • handleUnimplementedOperation
    Handles an unimplemented operation by failing the given handler with a ClientErrorException having a
  • newChildSpan
    Creates a new OpenTracing span for tracing the execution of a credentials service operation. The ret
  • processCustomCredentialsMessage
    Processes a request for a non-standard operation. Subclasses should override this method in order to
  • processGetByAuthIdRequest
  • processGetByDeviceIdRequest
  • processGetRequest
    Processes a get Credentials request message.
  • processRequest
    Processes a Credentials API request received via the vert.x event bus. This method validates the req
  • removeTypesafeValueForField
  • processRequest,
  • removeTypesafeValueForField

Popular in Java

  • Start an intent from android
  • getExternalFilesDir (Context)
  • scheduleAtFixedRate (Timer)
  • setContentView (Activity)
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now