Back to index

nordugrid-arc-nox  1.1.0~rc6
DataPointDirect.cpp
Go to the documentation of this file.
00001 // -*- indent-tabs-mode: nil -*-
00002 
00003 #ifdef HAVE_CONFIG_H
00004 #include <config.h>
00005 #endif
00006 
00007 #include <arc/StringConv.h>
00008 #include <arc/data/DataPointDirect.h>
00009 
00010 namespace Arc {
00011 
00012   DataPointDirect::DataPointDirect(const URL& url, const UserConfig& usercfg)
00013     : DataPoint(url, usercfg),
00014       buffer(NULL),
00015       bufsize(-1),
00016       bufnum(1),
00017       local(false),
00018       readonly(true),
00019       linkable(false),
00020       is_secure(false),
00021       force_secure(true),
00022       force_passive(false),
00023       additional_checks(true),
00024       allow_out_of_order(false),
00025       range_start(0),
00026       range_end(0) {
00027     std::string optval;
00028 
00029     optval = url.Option("threads");
00030     if (!optval.empty())
00031       bufnum = stringtoi(optval);
00032     if (bufnum < 1)
00033       bufnum = 1;
00034     if (bufnum > MAX_PARALLEL_STREAMS)
00035       bufnum = MAX_PARALLEL_STREAMS;
00036 
00037     optval = url.Option("blocksize");
00038     if (!optval.empty())
00039       bufsize = stringtoull(optval);
00040     if (bufsize > MAX_BLOCK_SIZE)
00041       bufsize = MAX_BLOCK_SIZE;
00042 
00043     readonly = (url.Option("readonly", "yes") == "yes");
00044   }
00045 
00046   DataPointDirect::~DataPointDirect() {}
00047 
00048   bool DataPointDirect::IsIndex() const {
00049     return false;
00050   }
00051 
00052   long long int DataPointDirect::BufSize() const {
00053     return bufsize;
00054   }
00055 
00056   int DataPointDirect::BufNum() const {
00057     return bufnum;
00058   }
00059 
00060   bool DataPointDirect::Local() const {
00061     return local;
00062   }
00063 
00064   bool DataPointDirect::ReadOnly() const {
00065     return readonly;
00066   }
00067 
00068   void DataPointDirect::ReadOutOfOrder(bool val) {
00069     allow_out_of_order = val;
00070   }
00071 
00072   bool DataPointDirect::WriteOutOfOrder() {
00073     return false;
00074   }
00075 
00076   void DataPointDirect::SetAdditionalChecks(bool val) {
00077     additional_checks = val;
00078   }
00079 
00080   bool DataPointDirect::GetAdditionalChecks() const {
00081     return additional_checks;
00082   }
00083 
00084   void DataPointDirect::SetSecure(bool val) {
00085     force_secure = val;
00086   }
00087 
00088   bool DataPointDirect::GetSecure() const {
00089     return is_secure;
00090   }
00091 
00092   void DataPointDirect::Passive(bool val) {
00093     force_passive = val;
00094   }
00095 
00096   void DataPointDirect::Range(unsigned long long int start,
00097                               unsigned long long int end) {
00098     range_start = start;
00099     range_end = end;
00100   }
00101 
00102   DataStatus DataPointDirect::Resolve(bool) {
00103     return DataStatus::NotSupportedForDirectDataPointsError;
00104   }
00105 
00106   DataStatus DataPointDirect::PreRegister(bool, bool) {
00107     return DataStatus::NotSupportedForDirectDataPointsError;
00108   }
00109 
00110   DataStatus DataPointDirect::PostRegister(bool) {
00111     return DataStatus::NotSupportedForDirectDataPointsError;
00112   }
00113 
00114   DataStatus DataPointDirect::PreUnregister(bool) {
00115     return DataStatus::NotSupportedForDirectDataPointsError;
00116   }
00117 
00118   DataStatus DataPointDirect::Unregister(bool) {
00119     return DataStatus::NotSupportedForDirectDataPointsError;
00120   }
00121 
00122   bool DataPointDirect::AcceptsMeta() {
00123     return false;
00124   }
00125 
00126   bool DataPointDirect::ProvidesMeta() {
00127     return false;
00128   }
00129 
00130   bool DataPointDirect::Registered() const {
00131     return false;
00132   }
00133 
00134   const URL& DataPointDirect::CurrentLocation() const {
00135     return url;
00136   }
00137 
00138   const std::string& DataPointDirect::CurrentLocationMetadata() const {
00139     static const std::string empty;
00140     return empty;
00141   }
00142   
00143   DataStatus DataPointDirect::CompareLocationMetadata() const {
00144     return DataStatus::NotSupportedForDirectDataPointsError;
00145   }
00146 
00147   bool DataPointDirect::NextLocation() {
00148     if (triesleft > 0)
00149       --triesleft;
00150     return (triesleft > 0);
00151   }
00152 
00153   bool DataPointDirect::LocationValid() const {
00154     return (triesleft > 0);
00155   }
00156 
00157   bool DataPointDirect::HaveLocations() const {
00158     return true;
00159   }
00160 
00161   DataStatus DataPointDirect::AddLocation(const URL&, const std::string&) {
00162     return DataStatus::NotSupportedForDirectDataPointsError;
00163   }
00164 
00165   DataStatus DataPointDirect::RemoveLocation() {
00166     return DataStatus::NotSupportedForDirectDataPointsError;
00167   }
00168 
00169   DataStatus DataPointDirect::RemoveLocations(const DataPoint&) {
00170     return DataStatus::NotSupportedForDirectDataPointsError;
00171   }
00172 
00173 } // namespace Arc