xrootd
Loading...
Searching...
No Matches
XrdClClassicCopyJob.hh
Go to the documentation of this file.
1//------------------------------------------------------------------------------
2// Copyright (c) 2011-2012 by European Organization for Nuclear Research (CERN)
3// Author: Lukasz Janyst <ljanyst@cern.ch>
4//------------------------------------------------------------------------------
5// XRootD is free software: you can redistribute it and/or modify
6// it under the terms of the GNU Lesser General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// XRootD is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU Lesser General Public License
16// along with XRootD. If not, see <http://www.gnu.org/licenses/>.
17//------------------------------------------------------------------------------
18
19#ifndef __XRD_CL_CLASSIC_COPY_JOB_HH__
20#define __XRD_CL_CLASSIC_COPY_JOB_HH__
21
23#include "XrdCl/XrdClCopyJob.hh"
24
25namespace XrdCl
26{
27 class ClassicCopyJob: public CopyJob
28 {
29 public:
30 //------------------------------------------------------------------------
31 // Constructor
32 //------------------------------------------------------------------------
33 ClassicCopyJob( uint16_t jobId,
34 PropertyList *jobProperties,
35 PropertyList *jobResults );
36
37 //------------------------------------------------------------------------
42 //------------------------------------------------------------------------
43 virtual XRootDStatus Run( CopyProgressHandler *progress = 0 );
44
45 //------------------------------------------------------------------------
46 // Get the final result
47 //------------------------------------------------------------------------
48 inline const XRootDStatus& GetResult() const
49 {
50 return result;
51 }
52
53 private:
54
55 //------------------------------------------------------------------------
56 // Update the final result so it is clear that it is a source error
57 //------------------------------------------------------------------------
59 {
60 std::string msg = status.GetErrorMessage();
61 msg += " (source)";
62 status.SetErrorMessage( msg );
63 result = status;
64 return status;
65 }
66
67 //------------------------------------------------------------------------
68 // Update the final result do it is clear that it is a destination error
69 //------------------------------------------------------------------------
71 {
72 std::string msg = status.GetErrorMessage();
73 msg += " (destination)";
74 status.SetErrorMessage( msg );
75 result = status;
76 return status;
77 }
78
79 //------------------------------------------------------------------------
80 // Set the final result
81 //------------------------------------------------------------------------
82 template<typename ... Args>
83 inline XRootDStatus& SetResult( Args&&... args )
84 {
85 result = XrdCl::XRootDStatus( std::forward<Args>(args)... );
86 return result;
87 }
88
89 //------------------------------------------------------------------------
90 // The final result
91 //------------------------------------------------------------------------
93 };
94}
95
96#endif // __XRD_CL_CLASSIC_COPY_JOB_HH__
Definition XrdClClassicCopyJob.hh:28
XRootDStatus result
Definition XrdClClassicCopyJob.hh:92
XrdCl::XRootDStatus & DestinationError(XrdCl::XRootDStatus &status)
Definition XrdClClassicCopyJob.hh:70
XrdCl::XRootDStatus & SourceError(XrdCl::XRootDStatus &status)
Definition XrdClClassicCopyJob.hh:58
XRootDStatus & SetResult(Args &&... args)
Definition XrdClClassicCopyJob.hh:83
const XRootDStatus & GetResult() const
Definition XrdClClassicCopyJob.hh:48
ClassicCopyJob(uint16_t jobId, PropertyList *jobProperties, PropertyList *jobResults)
virtual XRootDStatus Run(CopyProgressHandler *progress=0)
Copy job.
Definition XrdClCopyJob.hh:36
Interface for copy progress notification.
Definition XrdClCopyProcess.hh:42
A key-value pair map storing both keys and values as strings.
Definition XrdClPropertyList.hh:41
Request status.
Definition XrdClXRootDResponses.hh:219
const std::string & GetErrorMessage() const
Get error message.
Definition XrdClXRootDResponses.hh:242
void SetErrorMessage(const std::string &message)
Set the error message.
Definition XrdClXRootDResponses.hh:250
Definition XrdClAction.hh:34