@Override public void handleRequest(DataInput input, ActiveOperation.ResultHandler<File> resultHandler, ManagementRequestContext<Void> context) throws IOException { try { File first = new File(localDeploymentFolder, hash.substring(0,2)); File localPath = new File(first, hash.substring(2)); ServerToHostRemoteFileRequestAndHandler.INSTANCE.handleResponse(input, localPath, ServerLogger.ROOT_LOGGER, resultHandler, context); resultHandler.done(null); } catch (RemoteFileRequestAndHandler.CannotCreateLocalDirectoryException e) { resultHandler.failed(ServerLogger.ROOT_LOGGER.cannotCreateLocalDirectory(e.getDir())); } catch (RemoteFileRequestAndHandler.DidNotReadEntireFileException e) { resultHandler.failed(ServerLogger.ROOT_LOGGER.didNotReadEntireFile(e.getMissing())); } } }
throw new CannotCreateLocalDirectoryException(localPath); final File file = new File(localPath, path); if (!file.getParentFile().exists() && !file.getParentFile().mkdirs()) { throw new CannotCreateLocalDirectoryException(localPath.getParentFile());
throw new CannotCreateLocalDirectoryException(localPath); final File file = new File(localPath, path); if (!file.getParentFile().exists() && !file.getParentFile().mkdirs()) { throw new CannotCreateLocalDirectoryException(localPath.getParentFile());
@Override public void handleRequest(DataInput input, ActiveOperation.ResultHandler<File> resultHandler, ManagementRequestContext<Void> context) throws IOException { final File localPath; switch (rootId) { case DomainControllerProtocol.PARAM_ROOT_ID_FILE: { localPath = localFileRepository.getFile(filePath); break; } case DomainControllerProtocol.PARAM_ROOT_ID_CONFIGURATION: { localPath = localFileRepository.getConfigurationFile(filePath); break; } case DomainControllerProtocol.PARAM_ROOT_ID_DEPLOYMENT: { byte[] hash = HashUtil.hexStringToByteArray(filePath); localPath = localFileRepository.getDeploymentRoot(new ContentReference(filePath, hash)); break; } default: { localPath = null; } } try { DomainRemoteFileRequestAndHandler.INSTANCE.handleResponse(input, localPath, ROOT_LOGGER, resultHandler, context); } catch (CannotCreateLocalDirectoryException e) { throw HostControllerLogger.ROOT_LOGGER.cannotCreateLocalDirectory(e.getDir()); } catch (DidNotReadEntireFileException e) { throw HostControllerLogger.ROOT_LOGGER.didNotReadEntireFile(e.getMissing()); } } }
@Override public void handleRequest(DataInput input, ActiveOperation.ResultHandler<File> resultHandler, ManagementRequestContext<Void> context) throws IOException { final File localPath; switch (rootId) { case DomainControllerProtocol.PARAM_ROOT_ID_FILE: { localPath = localFileRepository.getFile(filePath); break; } case DomainControllerProtocol.PARAM_ROOT_ID_CONFIGURATION: { localPath = localFileRepository.getConfigurationFile(filePath); break; } case DomainControllerProtocol.PARAM_ROOT_ID_DEPLOYMENT: { byte[] hash = HashUtil.hexStringToByteArray(filePath); localPath = localFileRepository.getDeploymentRoot(new ContentReference(filePath, hash)); break; } default: { localPath = null; } } try { DomainRemoteFileRequestAndHandler.INSTANCE.handleResponse(input, localPath, ROOT_LOGGER, resultHandler, context); } catch (CannotCreateLocalDirectoryException e) { throw HostControllerLogger.ROOT_LOGGER.cannotCreateLocalDirectory(e.getDir()); } catch (DidNotReadEntireFileException e) { throw HostControllerLogger.ROOT_LOGGER.didNotReadEntireFile(e.getMissing()); } } }
@Override public void handleRequest(DataInput input, ActiveOperation.ResultHandler<File> resultHandler, ManagementRequestContext<Void> context) throws IOException { final File localPath; switch (rootId) { case DomainControllerProtocol.PARAM_ROOT_ID_FILE: { localPath = localFileRepository.getFile(filePath); break; } case DomainControllerProtocol.PARAM_ROOT_ID_CONFIGURATION: { localPath = localFileRepository.getConfigurationFile(filePath); break; } case DomainControllerProtocol.PARAM_ROOT_ID_DEPLOYMENT: { byte[] hash = HashUtil.hexStringToByteArray(filePath); localPath = localFileRepository.getDeploymentRoot(hash); break; } default: { localPath = null; } } try { DomainRemoteFileRequestAndHandler.INSTANCE.handleResponse(input, localPath, ROOT_LOGGER, resultHandler, context); } catch (CannotCreateLocalDirectoryException e) { throw MESSAGES.cannotCreateLocalDirectory(e.getDir()); } catch (DidNotReadEntireFileException e) { throw MESSAGES.didNotReadEntireFile(e.getMissing()); } } }
@Override public void handleRequest(DataInput input, ActiveOperation.ResultHandler<File> resultHandler, ManagementRequestContext<Void> context) throws IOException { try { File first = new File(localDeploymentFolder, hash.substring(0,2)); File localPath = new File(first, hash.substring(2)); ServerToHostRemoteFileRequestAndHandler.INSTANCE.handleResponse(input, localPath, ServerLogger.ROOT_LOGGER, resultHandler, context); resultHandler.done(null); } catch (RemoteFileRequestAndHandler.CannotCreateLocalDirectoryException e) { resultHandler.failed(ServerMessages.MESSAGES.cannotCreateLocalDirectory(e.getDir())); } catch (RemoteFileRequestAndHandler.DidNotReadEntireFileException e) { resultHandler.failed(ServerMessages.MESSAGES.didNotReadEntireFile(e.getMissing())); } } }
@Override public void handleRequest(DataInput input, ActiveOperation.ResultHandler<File> resultHandler, ManagementRequestContext<Void> context) throws IOException { try { File first = new File(localDeploymentFolder, hash.substring(0,2)); File localPath = new File(first, hash.substring(2)); ServerToHostRemoteFileRequestAndHandler.INSTANCE.handleResponse(input, localPath, ServerLogger.ROOT_LOGGER, resultHandler, context); resultHandler.done(null); } catch (RemoteFileRequestAndHandler.CannotCreateLocalDirectoryException e) { resultHandler.failed(ServerLogger.ROOT_LOGGER.cannotCreateLocalDirectory(e.getDir())); } catch (RemoteFileRequestAndHandler.DidNotReadEntireFileException e) { resultHandler.failed(ServerLogger.ROOT_LOGGER.didNotReadEntireFile(e.getMissing())); } } }
@Override public void handleRequest(DataInput input, ActiveOperation.ResultHandler<File> resultHandler, ManagementRequestContext<Void> context) throws IOException { try { File first = new File(localDeploymentFolder, hash.substring(0,2)); File localPath = new File(first, hash.substring(2)); ServerToHostRemoteFileRequestAndHandler.INSTANCE.handleResponse(input, localPath, ServerLogger.ROOT_LOGGER, resultHandler, context); resultHandler.done(null); } catch (RemoteFileRequestAndHandler.CannotCreateLocalDirectoryException e) { resultHandler.failed(ServerMessages.MESSAGES.cannotCreateLocalDirectory(e.getDir())); } catch (RemoteFileRequestAndHandler.DidNotReadEntireFileException e) { resultHandler.failed(ServerMessages.MESSAGES.didNotReadEntireFile(e.getMissing())); } } }