00001 /*---------------------------------------------------------------------\ 00002 | | 00003 | __ __ ____ _____ ____ | 00004 | \ \ / /_ _/ ___|_ _|___ \ | 00005 | \ V / _` \___ \ | | __) | | 00006 | | | (_| |___) || | / __/ | 00007 | |_|\__,_|____/ |_| |_____| | 00008 | | 00009 | core system | 00010 | (C) SuSE Linux AG | 00011 \----------------------------------------------------------------------/ 00012 00013 Author: Cornelius Schumacher <cschum@suse.de> 00014 Maintainer: Cornelius Schumacher <cschum@suse.de> 00015 00016 Purpose: Class providing path information for YOU patches. 00017 00018 /-*/ 00019 #ifndef PMYOUSETTINGS_H 00020 #define PMYOUSETTINGS_H 00021 00022 #include <list> 00023 #include <string> 00024 00025 #include <y2util/Url.h> 00026 #include <y2util/Pathname.h> 00027 #include <y2util/LangCode.h> 00028 00029 #include <y2pm/PMError.h> 00030 #include <y2pm/PMPackagePtr.h> 00031 #include <y2pm/PkgArch.h> 00032 00033 #include <y2pm/PMYouServers.h> 00034 #include <y2pm/PMYouProductPtr.h> 00035 #include <y2pm/PMYouMediaPtr.h> 00036 00037 #include <y2pm/PMYouSettingsPtr.h> 00038 00039 class SysConfig; 00040 00044 class PMYouSettings : public CountedRep 00045 { 00046 REP_BODY(PMYouSettings); 00047 00048 public: 00052 PMYouSettings(); 00057 PMYouSettings( const std::string &product, const std::string &version, 00058 const std::string &baseArch ); 00059 00063 ~PMYouSettings(); 00064 00068 void init( const std::string &product, const std::string &version, 00069 const std::string &baseArch ); 00070 00076 PMError initProduct(); 00077 00082 void setMasterMedia( const PMYouMediaPtr & ); 00086 PMYouMediaPtr masterMedia(); 00087 00092 void setPathPrefix( const Pathname & ); 00093 00097 Pathname pathPrefix(); 00098 00103 void filterExclusiveProducts( const std::list<std::string> & ); 00104 00108 void setPatchServer( const PMYouServer & ); 00112 PMYouServer patchServer(); 00113 00117 void setUsernamePassword( const std::string &username, 00118 const std::string &password ); 00119 00124 Url patchUrl(); 00125 00129 Pathname mediaPatchesFile(); 00130 00134 Pathname localDir(); 00135 00141 Pathname localWriteDir(); 00142 00148 Pathname attachPoint(); 00149 00155 Pathname rootAttachPoint(); 00156 00160 Pathname installDir(); 00161 00165 Pathname externalRpmDir(); 00166 00170 Pathname filesDir(); 00171 00176 std::string directoryFileName(); 00177 00181 std::string mediaMapFileName(); 00182 00186 Pathname cookiesFile(); 00187 00191 Pathname configFile(); 00192 00196 Pathname passwordFile(); 00197 00201 Pathname logFile(); 00202 00206 SysConfig *config(); 00207 00212 void setLangCode( const LangCode & ); 00213 00217 LangCode langCode() const { return _lang; } 00218 00222 std::string locale() const; 00223 00227 std::string defaultLocale() const; 00228 00233 static std::string translateLangCode( const LangCode &lang ); 00234 00238 std::list<PMYouProductPtr> products() const; 00239 00243 PMYouProductPtr primaryProduct() const; 00244 00248 void setCheckSignatures( bool ); 00252 bool checkSignatures() const; 00253 00257 void setReloadPatches( bool ); 00262 bool reloadPatches(); 00263 00267 void setNoExternalPackages( bool ); 00272 bool noExternalPackages() const; 00273 00278 void setDryRun( bool ); 00283 bool dryRun() const; 00284 00289 void setGetAll( bool ); 00294 bool getAll() const; 00295 00299 void setGetOnly( bool ); 00300 00304 bool getOnly() const; 00305 00309 void setLogEnabled( bool ); 00313 bool isLogEnabled() const; 00314 00315 protected: 00316 void init(); 00317 00318 private: 00319 PMYouMediaPtr _masterMedia; 00320 Pathname _pathPrefix; 00321 00322 PMYouServer _patchServer; 00323 00324 SysConfig *_config; 00325 00326 LangCode _lang; 00327 00328 std::list<PMYouProductPtr> _products; 00329 00330 bool _checkSignatures; 00331 bool _reloadPatches; 00332 bool _noExternalPackages; 00333 bool _dryRun; 00334 bool _getAll; 00335 bool _getOnly; 00336 bool _isLogEnabled; 00337 }; 00338 00339 #endif