当前位置: 首页>>代码示例>>Java>>正文


Java Operation.complete方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:vmware,项目名称:xenon-utils,代码行数:25,代码来源:CarService.java

示例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);
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:22,代码来源:AWSDiskService.java

示例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);
    }
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:26,代码来源:MockAdapter.java

示例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();
}
 
开发者ID:vmware,项目名称:xenon-utils,代码行数:11,代码来源:GatewayConfigService.java

示例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();
}
 
开发者ID:vmware,项目名称:xenon-utils,代码行数:13,代码来源:GatewayConfigService.java

示例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();
}
 
开发者ID:vmware,项目名称:xenon-utils,代码行数:14,代码来源:GatewayConfigService.java

示例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();
}
 
开发者ID:vmware,项目名称:xenon-utils,代码行数:15,代码来源:GatewayService.java

示例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();
}
 
开发者ID:vmware,项目名称:xenon-utils,代码行数:10,代码来源:GatewayPathService.java

示例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();
}
 
开发者ID:vmware,项目名称:xenon-utils,代码行数:13,代码来源:GatewayPathService.java

示例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();
}
 
开发者ID:vmware,项目名称:xenon-utils,代码行数:8,代码来源:TokenService.java

示例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);
    }
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:11,代码来源:ContentService.java

示例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);
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:16,代码来源:AzureNetworkEnumerationAdapterService.java

示例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);
            });
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:34,代码来源:AzureEnumerationAdapterService.java

示例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);
    }
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:10,代码来源:IPAddressService.java

示例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);
    }
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:37,代码来源:TagService.java


注:本文中的com.vmware.xenon.common.Operation.complete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。