本文整理了Java中org.datatransferproject.api.launcher.Monitor.debug()
方法的一些代码示例,展示了Monitor.debug()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Monitor.debug()
方法的具体详情如下:
包路径:org.datatransferproject.api.launcher.Monitor
类名称:Monitor
方法名:debug
[英]Records a debug level event.
[中]记录调试级别的事件。
代码示例来源:origin: google/data-transfer-project
@Override
public void debug(Supplier<String> supplier, Object... data) {
for (Monitor delegate : delegates) {
delegate.debug(supplier, data);
}
}
}
代码示例来源:origin: google/data-transfer-project
public void debug(String msg, long value) {
DELEGATE.debug(() -> msg);
}
代码示例来源:origin: google/data-transfer-project
public void debug(Throwable thrown) {
DELEGATE.debug(() -> "Error processing request", thrown);
}
代码示例来源:origin: google/data-transfer-project
public void debug(String msg, Object... args) {
DELEGATE.debug(() -> msg);
}
代码示例来源:origin: google/data-transfer-project
/**
* Removes the {@link PortabilityJob} keyed by {@code jobId} in the map.
*
* @throws IOException if the job doesn't exist, or there was a different problem deleting it.
*/
@Override
public void remove(UUID jobId) throws IOException {
monitor.debug(() -> format("Remove job %s from local storage", jobId));
Map<String, Object> previous = JOB_MAP.remove(jobId);
if (previous == null) {
throw new IOException("jobId: " + jobId + " didn't exist in the map");
}
}
代码示例来源:origin: google/data-transfer-project
@Override
public boolean verifyToken(String token) {
try {
verifier.verify(token);
return true;
} catch (JWTVerificationException exception) {
monitor.debug(() -> "Error verifying token", exception);
return false;
}
}
代码示例来源:origin: google/data-transfer-project
private String lookupKey(String keyName) {
String keyLocation = KEYS_DIR + keyName + KEY_EXTENSION;
monitor.debug(
() -> format("Getting app key for %s (blob %s) from bucket", keyName, keyLocation));
byte[] rawKeyBytes = getRawBytes(keyLocation);
checkState(rawKeyBytes != null, "Couldn't look up: " + keyName);
return new String(rawKeyBytes).trim();
}
代码示例来源:origin: google/data-transfer-project
private String lookupSecret(String secretName) throws IOException {
String secretLocation = SECRETS_DIR + secretName + SECRET_EXTENSION;
monitor.debug(()->format("Getting app secret for %s (blob %s)", secretName, secretLocation));
byte[] encryptedSecret = getRawBytes(secretLocation);
checkState(encryptedSecret != null, "Couldn't look up: " + secretName);
String secret = new String(appSecretDecrypter.decryptAppSecret(encryptedSecret)).trim();
checkState(!Strings.isNullOrEmpty(secret), "Couldn't decrypt: " + secretName);
return secret;
}
}
代码示例来源:origin: google/data-transfer-project
/**
* Inserts a new {@link PortabilityJob} keyed by its job ID in the store.
*
* <p>To update an existing {@link PortabilityJob} instead, use {@link JobStore#update}.
*
* @throws IOException if a job already exists for {@code job}'s ID, or if there was a different
* problem inserting the job.
*/
@Override
public void createJob(UUID jobId, PortabilityJob job) throws IOException {
Preconditions.checkNotNull(jobId);
monitor.debug(() -> format("Creating job %s in local storage", jobId));
if (JOB_MAP.get(jobId) != null) {
throw new IOException("An entry already exists for jobId: " + jobId);
}
JOB_MAP.put(jobId, job.toMap());
}
代码示例来源:origin: google/data-transfer-project
/**
* Finds the ID of the first {@link PortabilityJob} in state {@code jobState} in the map, or null
* if none found.
*/
@Override
public synchronized UUID findFirst(JobAuthorization.State jobState) {
// Mimic an index lookup
for (Entry<UUID, Map<String, Object>> job : JOB_MAP.entrySet()) {
Map<String, Object> properties = job.getValue();
State state = State.valueOf(properties.get(PortabilityJob.AUTHORIZATION_STATE).toString());
UUID jobKey = job.getKey();
monitor.debug(
() ->
format(
"Looking up first job in state %s: found job %s (state %s)",
jobState, jobKey, state));
if (state == jobState) {
return jobKey;
}
}
return null;
}
代码示例来源:origin: google/data-transfer-project
monitor.debug(() -> "Polling for a job in state CREDS_AVAILABLE");
if (jobId == null) {
return;
monitor.debug(() -> format("Polled job %s", jobId));
Preconditions.checkState(!JobMetadata.isInitialized());
KeyPair keyPair = asymmetricKeyGenerator.generate();
monitor.debug(
() ->
format(
代码示例来源:origin: google/data-transfer-project
@Override
public UUID getJobIdFromToken(String token) {
try {
DecodedJWT jwt = verifier.verify(token);
// Token is verified, get claim
Claim claim = jwt.getClaim(JWTTokenManager.ID_CLAIM_KEY);
if (claim.isNull()) {
return null;
}
return claim.isNull() ? null : UUID.fromString(claim.asString());
} catch (JWTVerificationException exception) {
monitor.debug(() -> "Error verifying token", exception);
throw new RuntimeException("Error verifying token: " + token);
}
}
代码示例来源:origin: google/data-transfer-project
PortabilityJob job = store.findJob(jobId);
if (job == null) {
monitor.debug(
() -> format("Could not poll job %s, it was not present in the key-value store", jobId));
} else if (job.jobAuthorization().state() == JobAuthorization.State.CREDS_STORED) {
monitor.debug(() -> format("Polled job %s in state CREDS_STORED", jobId));
JobAuthorization jobAuthorization = job.jobAuthorization();
if (!Strings.isNullOrEmpty(jobAuthorization.encryptedAuthData())) {
monitor.debug(
() -> format("Polled job %s has auth data as expected. Done polling.", jobId));
} else {
monitor.debug(
() ->
format(
代码示例来源:origin: google/data-transfer-project
private void markJobFinished(UUID jobId, boolean success) {
State state = success ? State.COMPLETE : State.ERROR;
PortabilityJob existingJob = store.findJob(jobId);
PortabilityJob updatedJob = existingJob.toBuilder().setState(state).build();
try {
store.updateJob(jobId, updatedJob);
} catch (IOException e) {
monitor.debug(() -> format("Could not mark job %s as finished.", jobId));
}
}
}
代码示例来源:origin: google/data-transfer-project
/**
* Encrypt the export and import credentials with a new {@link SecretKey} and {@link PublicKey}
* assigned to this job then update the data store to {@link JobAuthorization.State#CREDS_STORED}
* state.
*/
private PortabilityJob updateJobWithCredentials(UUID jobId, PortabilityJob job, String authData) {
// Populate job with encrypted auth data
JobAuthorization updatedJobAuthorization =
job.jobAuthorization()
.toBuilder()
.setEncryptedAuthData(authData)
.setState(CREDS_STORED)
.build();
job = job.toBuilder().setAndValidateJobAuthorization(updatedJobAuthorization).build();
monitor.debug(
() -> format("Updating job %s from CREDS_ENCRYPTION_KEY_GENERATED to CREDS_STORED", jobId));
try {
jobStore.updateJob(jobId, job);
monitor.debug(() -> format("Updated job %s to CREDS_STORED", jobId));
} catch (IOException e) {
throw new RuntimeException("Unable to update job", e);
}
return job;
}
}
代码示例来源:origin: google/data-transfer-project
@Override
public ReservedWorker handle(GetReservedWorker workerRequest) {
String id = workerRequest.getId();
UUID jobId = decodeJobId(id);
PortabilityJob job = jobStore.findJob(jobId);
Preconditions.checkNotNull(
job, "Couldn't lookup worker for job " + id + " because the job doesn't exist");
if (job.jobAuthorization().state() != CREDS_ENCRYPTION_KEY_GENERATED) {
monitor.debug(
() -> format("Job %s has not entered state CREDS_ENCRYPTION_KEY_GENERATED yet", jobId));
return new ReservedWorker(null);
}
monitor.debug(
() ->
format(
"Got job %s in state CREDS_ENCRYPTION_KEY_GENERATED, returning its public key",
jobId));
return new ReservedWorker(job.jobAuthorization().authPublicKey());
}
}
代码示例来源:origin: google/data-transfer-project
/**
* Update the job to state to {@code State.CREDS_AVAILABLE} in the store. This indicates to the
* pool of workers that this job is available for processing.
*/
private void updateStateToCredsAvailable(UUID jobId) {
PortabilityJob job = jobStore.findJob(jobId);
validateJob(job);
// Set update job auth data
JobAuthorization jobAuthorization =
job.jobAuthorization().toBuilder().setState(CREDS_AVAILABLE).build();
job = job.toBuilder().setAndValidateJobAuthorization(jobAuthorization).build();
try {
jobStore.updateJob(
jobId,
job,
(previous, updated) ->
Preconditions.checkState(
previous.jobAuthorization().state() == JobAuthorization.State.INITIAL));
monitor.debug(() -> format("Updated job %s to CREDS_AVAILABLE", jobId));
} catch (IOException e) {
throw new RuntimeException("Unable to update job", e);
}
}
代码示例来源:origin: google/data-transfer-project
@Override
public void initialize(ExtensionContext context) {
Monitor monitor = context.getMonitor();
monitor.debug(() -> "Starting Twitter initialization");
if (initialized) {
monitor.severe(() -> "TwitterTransferExtension already initialized.");
return;
}
AppCredentials appCredentials;
try {
appCredentials =
context
.getService(AppCredentialStore.class)
.getAppCredentials(TWITTER_KEY, TWITTER_SECRET);
} catch (IOException e) {
monitor.info(
() ->
format(
"Unable to retrieve Twitter AppCredentials. Did you set %s and %s?",
TWITTER_KEY, TWITTER_SECRET),
e);
return;
}
exporter = new TwitterPhotosExporter(appCredentials, monitor);
importer = new TwitterPhotosImporter(appCredentials, monitor);
initialized = true;
}
}
代码示例来源:origin: google/data-transfer-project
importedLabelIds.add(exportedLabelIdOrName);
} else {
monitor.debug(
() ->
"labels should have been added prior to importing messages"); // TODO remove after
代码示例来源:origin: google/data-transfer-project
checkNotNull(mapping, "No mapping found for %s", data.getId());
String finalParentId = parentId;
monitor.debug(()->format("Got parent id %s for old Id %s named: %s", finalParentId, data.getId(), data.getName()));
parentId = mapping.getNewId();
内容来源于网络,如有侵权,请联系作者删除!