@Override protected final List<HostUpdateResult<?>> receiveResponse(final InputStream input) throws IOException { final Unmarshaller unmarshaller = getUnmarshaller(); unmarshaller.start(createByteInput(input)); expectHeader(unmarshaller, DomainClientProtocol.RETURN_APPLY_UPDATES_RESULT_COUNT); final int updateCount = unmarshaller.readInt(); final List<HostUpdateResult<?>> results = new ArrayList<HostUpdateResult<?>>(updateCount); for (int i = 0; i < updateCount; i++) { expectHeader(unmarshaller, DomainClientProtocol.RETURN_APPLY_HOST_UPDATE); HostUpdateResult<?> updateResult = unmarshal(unmarshaller, HostUpdateResult.class); results.add(updateResult); } unmarshaller.finish(); return results; } }
@Override protected final byte[] receiveResponse(final InputStream inputStream) throws IOException { ByteDataInput input = null; try { input = new SimpleByteDataInput(inputStream); expectHeader(input, DomainClientProtocol.RETURN_DEPLOYMENT_HASH_LENGTH); int length = input.readInt(); byte[] hash = new byte[length]; expectHeader(input, DomainClientProtocol.RETURN_DEPLOYMENT_HASH); input.readFully(hash); return hash; } finally { safeClose(input); } } }
@Override protected final List<String> receiveResponse(final InputStream input) throws IOException { final Unmarshaller unmarshaller = getUnmarshaller(); unmarshaller.start(createByteInput(input)); expectHeader(unmarshaller, DomainClientProtocol.RETURN_SERVER_MANAGER_COUNT); final int count = unmarshaller.readInt(); final List<String> results = new ArrayList<String>(count); for (int i = 0; i < count; i++) { expectHeader(unmarshaller, DomainClientProtocol.RETURN_HOST_NAME); results.add(unmarshaller.readUTF()); } unmarshaller.finish(); return results; } }
/** {@inheritDoc} */ @Override protected final byte[] receiveResponse(final InputStream inputStream) throws IOException { ByteDataInput input = null; try { input = new SimpleByteDataInput(inputStream); expectHeader(input, StandaloneClientProtocol.PARAM_DEPLOYMENT_HASH_LENGTH); int length = input.readInt(); byte[] hash = new byte[length]; expectHeader(input, StandaloneClientProtocol.PARAM_DEPLOYMENT_HASH); input.readFully(hash); return hash; } finally { safeClose(input); } } }
@Override protected final Map<ServerIdentity, ServerStatus> receiveResponse(final InputStream input) throws IOException { final Unmarshaller unmarshaller = getUnmarshaller(); unmarshaller.start(createByteInput(input)); expectHeader(unmarshaller, DomainClientProtocol.RETURN_SERVER_STATUS_COUNT); final int count = unmarshaller.readInt(); final Map<ServerIdentity, ServerStatus> results = new HashMap<ServerIdentity, ServerStatus>(count); for (int i = 0; i < count; i++) { expectHeader(unmarshaller, DomainClientProtocol.RETURN_HOST_NAME); final String hostName = unmarshaller.readUTF(); expectHeader(unmarshaller, DomainClientProtocol.RETURN_SERVER_GROUP_NAME); final String groupName = unmarshaller.readUTF(); expectHeader(unmarshaller, DomainClientProtocol.RETURN_SERVER_NAME); final String serverName = unmarshaller.readUTF(); expectHeader(unmarshaller, DomainClientProtocol.RETURN_SERVER_STATUS); final ServerStatus serverStatus = unmarshal(unmarshaller, ServerStatus.class); results.put(new ServerIdentity(hostName, groupName, serverName), serverStatus); } unmarshaller.finish(); return results; } }
@Override protected final List<DomainUpdateResult<?>> receiveResponse(final InputStream input) throws IOException { final Unmarshaller unmarshaller = getUnmarshaller(); unmarshaller.start(createByteInput(input)); expectHeader(unmarshaller, DomainClientProtocol.RETURN_APPLY_UPDATES_RESULT_COUNT); final int updateCount = unmarshaller.readInt(); final List<DomainUpdateResult<?>> results = new ArrayList<DomainUpdateResult<?>>(updateCount); for (int i = 0; i < updateCount; i++) { expectHeader(unmarshaller, DomainClientProtocol.RETURN_APPLY_UPDATE); DomainUpdateResult<?> updateResult = unmarshal(unmarshaller, DomainUpdateResult.class); results.add(updateResult); } unmarshaller.finish(); return results; } }
@Override protected final Boolean receiveResponse(final InputStream inputStream) throws IOException { ByteDataInput input = null; try { input = new SimpleByteDataInput(inputStream); expectHeader(input, DomainClientProtocol.PARAM_DEPLOYMENT_NAME_UNIQUE); return input.readBoolean(); } finally { safeClose(input); } } }
/** {@inheritDoc} */ @Override protected final Boolean receiveResponse(final InputStream inputStream) throws IOException { ByteDataInput input = null; try { input = new SimpleByteDataInput(inputStream); expectHeader(input, StandaloneClientProtocol.PARAM_DEPLOYMENT_NAME_UNIQUE); return input.readBoolean(); } finally { safeClose(input); } } }
/** {@inheritDoc} */ @Override protected List<StandaloneUpdateResult<?>> receiveResponse(InputStream input) throws IOException { final Unmarshaller unmarshaller = getUnmarshaller(); unmarshaller.start(createByteInput(input)); expectHeader(unmarshaller, StandaloneClientProtocol.PARAM_APPLY_UPDATES_RESULT_COUNT); final int updateCount = unmarshaller.readInt(); List<StandaloneUpdateResult<?>> results = new ArrayList<StandaloneUpdateResult<?>>(); for (int i = 0; i < updateCount; i++) { expectHeader(unmarshaller, StandaloneClientProtocol.PARAM_APPLY_UPDATE_RESULT); byte resultCode = unmarshaller.readByte(); if (resultCode == (byte) StandaloneClientProtocol.PARAM_APPLY_UPDATE_RESULT_EXCEPTION) { final UpdateFailedException failure = unmarshal(unmarshaller, UpdateFailedException.class); results.add(new StandaloneUpdateResult<Object>(null, failure)); } else { final Object result = unmarshal(unmarshaller, Object.class); results.add(new StandaloneUpdateResult<Object>(result, null)); } } return results; } }
@Override protected final DomainUpdateApplierResponse receiveResponse(final InputStream input) throws IOException { final Unmarshaller unmarshaller = getUnmarshaller(); unmarshaller.start(createByteInput(input)); expectHeader(unmarshaller, DomainClientProtocol.RETURN_APPLY_UPDATE); DomainUpdateApplierResponse rsp = unmarshal(unmarshaller, DomainUpdateApplierResponse.class); unmarshaller.finish(); return rsp; } }
@Override protected final HostModel receiveResponse(final InputStream input) throws IOException { final Unmarshaller unmarshaller = getUnmarshaller(); unmarshaller.start(createByteInput(input)); expectHeader(unmarshaller, DomainClientProtocol.RETURN_HOST_MODEL); final HostModel hostModel = unmarshal(unmarshaller, HostModel.class); unmarshaller.finish(); return hostModel; } }
@Override protected final ServerStatus receiveResponse(final InputStream input) throws IOException { final Unmarshaller unmarshaller = getUnmarshaller(); unmarshaller.start(createByteInput(input)); expectHeader(unmarshaller, DomainClientProtocol.RETURN_SERVER_STATUS); final ServerStatus serverStatus = unmarshal(unmarshaller, ServerStatus.class); unmarshaller.finish(); return serverStatus; } }
/** {@inheritDoc} */ @Override protected final ServerDeploymentPlanResult receiveResponse(final InputStream input) throws IOException { final Unmarshaller unmarshaller = getUnmarshaller(); unmarshaller.start(createByteInput(input)); expectHeader(unmarshaller, StandaloneClientProtocol.PARAM_DEPLOYMENT_PLAN_RESULT); final ServerDeploymentPlanResult result = unmarshal(unmarshaller, ServerDeploymentPlanResult.class); unmarshaller.finish(); return result; } }
@Override protected final DomainModel receiveResponse(final InputStream input) throws IOException { final Unmarshaller unmarshaller = getUnmarshaller(); unmarshaller.start(createByteInput(input)); expectHeader(unmarshaller, DomainClientProtocol.RETURN_DOMAIN_MODEL); final DomainModel domainModel = unmarshal(unmarshaller, DomainModel.class); unmarshaller.finish(); return domainModel; } }
@Override protected final ServerModel receiveResponse(final InputStream input) throws IOException { final Unmarshaller unmarshaller = getUnmarshaller(); unmarshaller.start(createByteInput(input)); expectHeader(unmarshaller, DomainClientProtocol.RETURN_SERVER_MODEL); final ServerModel serverModel = unmarshal(unmarshaller, ServerModel.class); unmarshaller.finish(); return serverModel; } }
/** {@inheritDoc} */ @Override protected ServerModel receiveResponse(InputStream input) throws IOException { final Unmarshaller unmarshaller = getUnmarshaller(); unmarshaller.start(createByteInput(input)); expectHeader(unmarshaller, StandaloneClientProtocol.PARAM_SERVER_MODEL); final ServerModel serverModel = unmarshal(unmarshaller, ServerModel.class); unmarshaller.finish(); return serverModel; } }
@Override protected final Void receiveResponse(final InputStream input) throws IOException { final Unmarshaller unmarshaller = getUnmarshaller(); unmarshaller.start(createByteInput(input)); expectHeader(unmarshaller, DomainClientProtocol.RETURN_APPLY_SERVER_MODEL_UPDATE); @SuppressWarnings("unchecked") final UpdateResultHandlerResponse<R> result = unmarshal(unmarshaller, UpdateResultHandlerResponse.class); unmarshaller.finish(); if (resultHandler != null) { if (result.isCancelled()) { resultHandler.handleCancellation(param); } else if (result.isRolledBack()) { resultHandler.handleRollbackSuccess(param); } else if (result.isTimedOut()) { resultHandler.handleTimeout(param); } else if (result.getFailureResult() != null) { resultHandler.handleFailure(result.getFailureResult(), param); } else { resultHandler.handleSuccess(result.getSuccessResult(), param); } } unmarshaller.finish(); return null; } }