atom and script implementation
authorDuncan Mac-Vicar P <dmacvicar@suse.de>
Tue, 12 Jun 2007 11:48:09 +0000 (11:48 +0000)
committerDuncan Mac-Vicar P <dmacvicar@suse.de>
Tue, 12 Jun 2007 11:48:09 +0000 (11:48 +0000)
zypp/CMakeLists.txt
zypp/detail/ScriptImplIf.cc
zypp/detail/ScriptImplIf.h
zypp/repo/cached/AtomImpl.cc [new file with mode: 0644]
zypp/repo/cached/AtomImpl.h [new file with mode: 0644]
zypp/repo/cached/ScriptImpl.cc [new file with mode: 0644]
zypp/repo/cached/ScriptImpl.h [new file with mode: 0644]

index 24aab7ecf28ce671d2708e4b0731100f5d8b63d4..5e217f7c8d6d490db036677835d0e8a6fba5a007 100644 (file)
@@ -1085,6 +1085,8 @@ SET( zypp_repository_cached_SRCS
   repo/cached/PatternImpl.cc
   repo/cached/ProductImpl.cc
   repo/cached/MessageImpl.cc
+  repo/cached/ScriptImpl.cc
+  repo/cached/AtomImpl.cc
 )
 
 SET( zypp_repository_cached_HEADERS
@@ -1094,6 +1096,8 @@ SET( zypp_repository_cached_HEADERS
   repo/cached/PatternImpl.h
   repo/cached/ProductImpl.h
   repo/cached/MessageImpl.h
+  repo/cached/ScriptImpl.h
+  repo/cached/AtomImpl.h
 )
 
 SET( zypp_repository_data_SRCS
index 73b6d6a1475e2fb96cd5e45d96160c7b439cc933..d17c619358018d1576c0f06ffc8ab24715680b6e 100644 (file)
@@ -32,9 +32,6 @@ namespace zypp
       bool ScriptImplIf::undo_available() const
       { return false; }
 
-      ByteCount ScriptImplIf::size() const
-      { return ResObjectImplIf::size(); }
-
     /////////////////////////////////////////////////////////////////
   } // namespace detail
   ///////////////////////////////////////////////////////////////////
index fe1ff541973991883447d0ff84aff7bc05288e65..6e5fbf10b2549223a67599719bd40e31be3ab784 100644 (file)
@@ -43,8 +43,6 @@ namespace zypp
       virtual Pathname undo_script() const PURE_VIRTUAL;
       /** Check whether script to undo the change is available */
       virtual bool undo_available() const PURE_VIRTUAL;
-      /** */
-      virtual ByteCount size() const;
     };
     ///////////////////////////////////////////////////////////////////
 
diff --git a/zypp/repo/cached/AtomImpl.cc b/zypp/repo/cached/AtomImpl.cc
new file mode 100644 (file)
index 0000000..43c33e8
--- /dev/null
@@ -0,0 +1,120 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+
+#include "zypp/TranslatedText.h"
+#include "zypp/base/String.h"
+#include "zypp/base/Logger.h"
+#include "zypp/repo/RepositoryImpl.h"
+#include "AtomImpl.h"
+
+
+using namespace std;
+using namespace zypp::detail;
+using namespace::zypp::repo;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp { namespace repo { namespace cached {
+
+///////////////////////////////////////////////////////////////////
+//
+//        CLASS NAME : AtomImpl
+//
+///////////////////////////////////////////////////////////////////
+
+/** Default ctor
+*/
+AtomImpl::AtomImpl (const data::RecordId &id, cached::RepoImpl::Ptr repository_r)
+    : _repository (repository_r),
+      _id(id)
+{}
+
+Repository
+AtomImpl::repository() const
+{
+  return _repository->selfRepository();
+}
+
+///////////////////////////////////////////////////
+// ResObject Attributes
+///////////////////////////////////////////////////
+
+TranslatedText AtomImpl::summary() const
+{
+  return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "summary" );
+}
+
+TranslatedText AtomImpl::description() const
+{
+  return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "description" );
+}
+
+TranslatedText AtomImpl::insnotify() const
+{
+  return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "insnotify" );
+}
+
+TranslatedText AtomImpl::delnotify() const
+{
+  return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "delnotify" );
+}
+
+TranslatedText AtomImpl::licenseToConfirm() const
+{
+  return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "licenseToConfirm" );
+}
+
+Vendor AtomImpl::vendor() const
+{
+  return _repository->resolvableQuery().queryStringAttribute( _id, "ResObject", "vendor" );
+}
+
+
+ByteCount AtomImpl::size() const
+{
+  return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "size" );
+}
+
+ByteCount AtomImpl::archivesize() const
+{
+  return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "archivesize" );
+}
+
+bool AtomImpl::installOnly() const
+{
+  return _repository->resolvableQuery().queryBooleanAttribute( _id, "ResObject", "installOnly" );
+}
+
+Date AtomImpl::buildtime() const
+{
+  return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "buildtime" );
+}
+
+Date AtomImpl::installtime() const
+{
+  return Date();
+}
+
+//////////////////////////////////////////
+// DEPRECATED
+//////////////////////////////////////////
+
+Source_Ref AtomImpl::source() const
+{
+  return Source_Ref::noSource;
+}
+
+unsigned AtomImpl::sourceMediaNr() const
+{
+  return 1;
+}
+
+/////////////////////////////////////////////////////////////////
+} } } // namespace zypp::repo::cached
+///////////////////////////////////////////////////////////////////
+
diff --git a/zypp/repo/cached/AtomImpl.h b/zypp/repo/cached/AtomImpl.h
new file mode 100644 (file)
index 0000000..d4e73be
--- /dev/null
@@ -0,0 +1,61 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+
+#ifndef zypp_repo_cached_AtomImpl_H
+#define zypp_repo_cached_AtomImpl_H
+
+#include "zypp/detail/AtomImpl.h"
+#include "zypp/repo/cached/RepoImpl.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+namespace repo
+{ /////////////////////////////////////////////////////////////////
+namespace cached
+{ /////////////////////////////////////////////////////////////////
+
+  ///////////////////////////////////////////////////////////////////
+  //
+  //        CLASS NAME : AtomImpl
+  //
+  class AtomImpl : public detail::AtomImplIf
+  {
+  public:
+
+    AtomImpl( const data::RecordId &id, repo::cached::RepoImpl::Ptr repository_r );
+    
+    virtual TranslatedText summary() const;
+    virtual TranslatedText description() const;
+    virtual TranslatedText insnotify() const;
+    virtual TranslatedText delnotify() const;
+    virtual TranslatedText licenseToConfirm() const;
+    virtual Vendor vendor() const;
+    virtual ByteCount size() const;
+    virtual ByteCount archivesize() const;
+    virtual bool installOnly() const;
+    virtual Date buildtime() const;
+    virtual Date installtime() const;
+    
+    virtual Source_Ref source() const;
+    virtual unsigned sourceMediaNr() const;
+
+    virtual Repository repository() const;
+    
+  protected:
+    repo::cached::RepoImpl::Ptr _repository;
+    data::RecordId _id;
+  };
+  /////////////////////////////////////////////////////////////////
+} // namespace cached
+} // namespace repository
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZMD_BACKEND_DBSOURCE_DBPACKAGEIMPL_H
+
diff --git a/zypp/repo/cached/ScriptImpl.cc b/zypp/repo/cached/ScriptImpl.cc
new file mode 100644 (file)
index 0000000..d2a415b
--- /dev/null
@@ -0,0 +1,140 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+
+#include "zypp/TranslatedText.h"
+#include "zypp/base/String.h"
+#include "zypp/base/Logger.h"
+#include "zypp/repo/RepositoryImpl.h"
+#include "ScriptImpl.h"
+
+
+using namespace std;
+using namespace zypp::detail;
+using namespace::zypp::repo;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp { namespace repo { namespace cached {
+
+///////////////////////////////////////////////////////////////////
+//
+//        CLASS NAME : ScriptImpl
+//
+///////////////////////////////////////////////////////////////////
+
+/** Default ctor
+*/
+ScriptImpl::ScriptImpl (const data::RecordId &id, cached::RepoImpl::Ptr repository_r)
+    : _repository (repository_r),
+      _id(id)
+{}
+
+Repository
+ScriptImpl::repository() const
+{
+  return _repository->selfRepository();
+}
+
+///////////////////////////////////////////////////
+// ResObject Attributes
+///////////////////////////////////////////////////
+
+TranslatedText ScriptImpl::summary() const
+{
+  return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "summary" );
+}
+
+TranslatedText ScriptImpl::description() const
+{
+  return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "description" );
+}
+
+TranslatedText ScriptImpl::insnotify() const
+{
+  return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "insnotify" );
+}
+
+TranslatedText ScriptImpl::delnotify() const
+{
+  return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "delnotify" );
+}
+
+TranslatedText ScriptImpl::licenseToConfirm() const
+{
+  return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "licenseToConfirm" );
+}
+
+Vendor ScriptImpl::vendor() const
+{
+  return _repository->resolvableQuery().queryStringAttribute( _id, "ResObject", "vendor" );
+}
+
+
+ByteCount ScriptImpl::size() const
+{
+  return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "size" );
+}
+
+ByteCount ScriptImpl::archivesize() const
+{
+  return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "archivesize" );
+}
+
+bool ScriptImpl::installOnly() const
+{
+  return _repository->resolvableQuery().queryBooleanAttribute( _id, "ResObject", "installOnly" );
+}
+
+Date ScriptImpl::buildtime() const
+{
+  return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "buildtime" );
+}
+
+Date ScriptImpl::installtime() const
+{
+  return Date();
+}
+
+//////////////////////////////////////////
+// DEPRECATED
+//////////////////////////////////////////
+
+Source_Ref ScriptImpl::source() const
+{
+  return Source_Ref::noSource;
+}
+
+unsigned ScriptImpl::sourceMediaNr() const
+{
+  return 1;
+}
+
+//////////////////////////////////////////
+// MESSAGE
+/////////////////////////////////////////
+
+Pathname ScriptImpl::do_script() const
+{
+  return _repository->resolvableQuery().queryStringAttribute( _id, "Script", "doScript" );
+}
+
+Pathname ScriptImpl::undo_script() const
+{
+  return _repository->resolvableQuery().queryStringAttribute( _id, "Script", "undoScript" );
+}
+
+bool ScriptImpl::undo_available() const
+{
+  return _repository->resolvableQuery().queryBooleanAttribute( _id, "Script", "undoAvailable", false );
+}
+    
+
+/////////////////////////////////////////////////////////////////
+} } } // namespace zypp::repo::cached
+///////////////////////////////////////////////////////////////////
+
diff --git a/zypp/repo/cached/ScriptImpl.h b/zypp/repo/cached/ScriptImpl.h
new file mode 100644 (file)
index 0000000..e1cf2dc
--- /dev/null
@@ -0,0 +1,66 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+
+#ifndef zypp_repo_cached_ScriptImpl_H
+#define zypp_repo_cached_ScriptImpl_H
+
+#include "zypp/detail/ScriptImpl.h"
+#include "zypp/repo/cached/RepoImpl.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+namespace repo
+{ /////////////////////////////////////////////////////////////////
+namespace cached
+{ /////////////////////////////////////////////////////////////////
+
+  ///////////////////////////////////////////////////////////////////
+  //
+  //        CLASS NAME : ScriptImpl
+  //
+  class ScriptImpl : public detail::ScriptImplIf
+  {
+  public:
+
+    ScriptImpl( const data::RecordId &id, repo::cached::RepoImpl::Ptr repository_r );
+    
+    virtual TranslatedText summary() const;
+    virtual TranslatedText description() const;
+    virtual TranslatedText insnotify() const;
+    virtual TranslatedText delnotify() const;
+    virtual TranslatedText licenseToConfirm() const;
+    virtual Vendor vendor() const;
+    virtual ByteCount size() const;
+    virtual ByteCount archivesize() const;
+    virtual bool installOnly() const;
+    virtual Date buildtime() const;
+    virtual Date installtime() const;
+    
+    virtual Source_Ref source() const;
+    virtual unsigned sourceMediaNr() const;
+    
+    // SCRIPT
+    virtual Pathname do_script() const;
+    virtual Pathname undo_script() const;
+    virtual bool undo_available() const;
+      
+    virtual Repository repository() const;
+    
+  protected:
+    repo::cached::RepoImpl::Ptr _repository;
+    data::RecordId _id;
+  };
+  /////////////////////////////////////////////////////////////////
+} // namespace cached
+} // namespace repository
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZMD_BACKEND_DBSOURCE_DBPACKAGEIMPL_H
+