本文整理汇总了Java中com.vmware.xenon.common.Operation.complete方法的典型用法代码示例。如果您正苦于以下问题:Java Operation.complete方法的具体用法?Java Operation.complete怎么用?Java Operation.complete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vmware.xenon.common.Operation
的用法示例。
在下文中一共展示了Operation.complete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleGet
import com.vmware.xenon.common.Operation; //导入方法依赖的package包/类
@RouteDocumentation(description = "@CAR_ENGINE",
path = "?engine",
produces = { "application/json" },
responses = {
@ApiResponse(statusCode = Operation.STATUS_CODE_OK, description = "OK", response = EngineInfo.class)
})
@RouteDocumentation(description = "@CAR",
produces = { "application/json" },
responses = {
@ApiResponse(statusCode = Operation.STATUS_CODE_OK, description = "OK", response = Car.class),
@ApiResponse(statusCode = Operation.STATUS_CODE_NOT_FOUND, description = "Not Found"),
})
@Override
public void handleGet(Operation get) {
Map<String,String> queryParams = UriUtils.parseUriQueryParams(get.getUri());
boolean engineInfo = Boolean.parseBoolean(queryParams.get("engine"));
if (engineInfo) {
Car car = this.getState(get);
get.setBody(car.engineInfo);
get.complete();
} else {
super.handleGet(get);
}
}
示例2: handlePatch
import com.vmware.xenon.common.Operation; //导入方法依赖的package包/类
@Override
public void handlePatch(Operation op) {
if (!op.hasBody()) {
op.fail(new IllegalArgumentException("body is required"));
return;
}
DiskInstanceRequest request = op.getBody(DiskInstanceRequest.class);
if (request.resourceReference == null) {
op.fail(new IllegalArgumentException("Disk description cannot be empty"));
return;
}
//initialize context
AWSDiskContext ctx = new AWSDiskContext(this, request);
op.complete();
handleStages(ctx, AwsDiskStage.DISK_STATE);
}
示例3: handleRequest
import com.vmware.xenon.common.Operation; //导入方法依赖的package包/类
@Override
public void handleRequest(Operation op) {
if (!op.hasBody()) {
op.fail(new IllegalArgumentException("body is required"));
return;
}
switch (op.getAction()) {
case PATCH:
ComputeEnumerateResourceRequest request = op
.getBody(ComputeEnumerateResourceRequest.class);
if (!request.preserveMissing) {
op.fail(new IllegalArgumentException("preserveMissing must be set to true"));
return;
}
op.complete();
ResourceEnumerationTaskService.ResourceEnumerationTaskState patchState = new ResourceEnumerationTaskService.ResourceEnumerationTaskState();
patchState.taskInfo = new TaskState();
patchState.taskInfo.stage = TaskState.TaskStage.FINISHED;
sendRequest(Operation.createPatch(
request.taskReference).setBody(patchState));
break;
default:
super.handleRequest(op);
}
}
示例4: handleStart
import com.vmware.xenon.common.Operation; //导入方法依赖的package包/类
@Override
public void handleStart(Operation start) {
State state = validateStartState(start);
if (state == null) {
return;
}
start.setBody(state);
start.complete();
}
示例5: handlePatch
import com.vmware.xenon.common.Operation; //导入方法依赖的package包/类
@Override
public void handlePatch(Operation patch) {
State body = validateUpdateState(patch);
if (body == null) {
return;
}
State currentState = getState(patch);
updateState(currentState, body);
patch.setBody(currentState);
patch.complete();
}
示例6: handlePut
import com.vmware.xenon.common.Operation; //导入方法依赖的package包/类
@Override
public void handlePut(Operation put) {
State body = validateUpdateState(put);
if (body == null) {
return;
}
State currentState = getState(put);
updateState(currentState, body);
setState(put, currentState);
put.complete();
}
示例7: handleDelete
import com.vmware.xenon.common.Operation; //导入方法依赖的package包/类
/**
* DELETE on the GatewayService self-link are not-allowed.
* This would otherwise cause the GatewayService to stop.
*/
@Override
public void handleDelete(Operation op) {
long startTimeMicros = Utils.getSystemNowMicrosUtc();
if (!op.hasPragmaDirective(Operation.PRAGMA_DIRECTIVE_NO_INDEX_UPDATE)) {
failRequest(op, startTimeMicros, Operation.STATUS_CODE_BAD_METHOD,
"DELETE not supported on Gateway endpoint.");
return;
}
op.complete();
}
示例8: handleStart
import com.vmware.xenon.common.Operation; //导入方法依赖的package包/类
@Override
public void handleStart(Operation start) {
State state = validateStartState(start);
if (state == null) {
return;
}
start.setBody(state);
start.complete();
}
示例9: handlePut
import com.vmware.xenon.common.Operation; //导入方法依赖的package包/类
@Override
public void handlePut(Operation put) {
State body = validateUpdateState(put);
if (body == null) {
return;
}
State currentState = getState(put);
updateState(currentState, body);
setState(put, currentState);
put.complete();
}
示例10: handlePost
import com.vmware.xenon.common.Operation; //导入方法依赖的package包/类
@Override
public void handlePost(Operation post) {
UserToken body = post.getBody(UserToken.class);
body.internalId = UUID.randomUUID().toString();
log(Level.INFO, "user:%s token:%s internal", body.user, body.token);
post.complete();
}
示例11: handleGet
import com.vmware.xenon.common.Operation; //导入方法依赖的package包/类
@Override
public void handleGet(Operation get) {
if (get.getContentType().equalsIgnoreCase(MEDIA_TYPE_APPLICATION_OCTET_STREAM)) {
ContentState state = this.getState(get);
get.setBody(state.binaryData);
get.complete();
} else {
super.handleGet(get);
}
}
示例12: handlePatch
import com.vmware.xenon.common.Operation; //导入方法依赖的package包/类
@Override
public void handlePatch(Operation op) {
if (!op.hasBody()) {
op.fail(new IllegalArgumentException("body is required"));
return;
}
NetworkEnumContext ctx = new NetworkEnumContext(
op.getBody(ComputeEnumerateAdapterRequest.class), op);
AdapterUtils.validateEnumRequest(ctx.request);
if (ctx.request.isMockRequest) {
op.complete();
return;
}
handleEnumeration(ctx);
}
示例13: handlePatch
import com.vmware.xenon.common.Operation; //导入方法依赖的package包/类
@Override
public void handlePatch(Operation op) {
setOperationHandlerInvokeTimeStat(op);
if (!op.hasBody()) {
op.fail(new IllegalArgumentException("body is required"));
return;
}
ComputeEnumerateResourceRequest request = op.getBody(ComputeEnumerateResourceRequest.class);
try {
AdapterUtils.validateEnumRequest(request);
op.complete();
} catch (Exception e) {
op.fail(e);
}
EnumerationContext context = new EnumerationContext(this, request, op);
if (request.isMockRequest) {
// patch status to parent task
context.taskManager.finishTask();
return;
}
context.populateBaseContext(BaseAdapterStage.PARENTDESC)
.whenComplete((ignoreCtx, t) -> {
// NOTE: In case of error 'ignoreCtx' is null so use passed context!
if (t != null) {
context.error = t;
context.stage = AzureEnumerationStages.ERROR;
handleEnumerationRequest(context);
return;
}
handleEnumerationRequest(context);
});
}
示例14: handleStart
import com.vmware.xenon.common.Operation; //导入方法依赖的package包/类
@Override
public void handleStart(Operation start) {
try {
processInput(start);
start.complete();
} catch (Throwable t) {
start.fail(t);
}
}
示例15: handlePut
import com.vmware.xenon.common.Operation; //导入方法依赖的package包/类
@Override
public void handlePut(Operation put) {
try {
TagState currentState = getState(put);
TagState newTagState = put.getBody(TagState.class);
if (!ServiceDocument.equals(getStateDescription(), currentState, newTagState)) {
put.fail(new UnsupportedOperationException("Tags may not be modified"));
return;
}
// check if the tag has to be turned from external to local
boolean modified = false;
if (newTagState.external != null) {
if (currentState.external == null || (Boolean.TRUE.equals(currentState.external)
&& Boolean.FALSE.equals(newTagState.external))) {
currentState.external = newTagState.external;
modified = true;
}
}
// update the deleted property accordingly
if (newTagState.deleted != null) {
currentState.deleted = newTagState.deleted;
modified = true;
}
if (!modified) {
put.addPragmaDirective(Operation.PRAGMA_DIRECTIVE_STATE_NOT_MODIFIED);
}
put.setBody(currentState);
put.complete();
} catch (Throwable t) {
put.fail(t);
}
}