4 // Copyright (C) 2006 Debajyoti Bera <dbera.web@gmail.com>
8 // Permission is hereby granted, free of charge, to any person obtaining a
9 // copy of this software and associated documentation files (the "Software"),
10 // to deal in the Software without restriction, including without limitation
11 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 // and/or sell copies of the Software, and to permit persons to whom the
13 // Software is furnished to do so, subject to the following conditions:
15 // The above copyright notice and this permission notice shall be included in
16 // all copies or substantial portions of the Software.
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24 // DEALINGS IN THE SOFTWARE.
31 namespace Beagle
.Filters
{
33 public abstract class FilterPackage
: Beagle
.Daemon
.Filter
{
35 public FilterPackage ()
40 protected virtual void PullPackageProperties () { }
42 private string package_name
, package_version
, category
;
43 private string homepage
, summary
, packager_name
, packager_email
, size
;
45 /* Some of the metadata common in all packages.
46 * Use them to display general package information in beagle frontends.
47 * - PackageName - name of the package
48 * - PackageVersion - package version
49 * - Summary - short description of the package (if available)
50 * - Category - category of the package (if available)
51 * - Homepage - Homepage URL of the package/project (if available)
52 * - Packager - Packager information of the package (if available)
53 * - Size - Size of the package (in bytes)
56 // Name of the package
57 protected string PackageName
{
58 get { return package_name; }
59 set { package_name = value; }
63 protected string PackageVersion
{
64 get { return package_version; }
65 set { package_version = value; }
68 // A short summary. Some packages might not have this.
69 // The longer description stored as AppendText. When you request snippet, it is fetched from the description.
70 // It is not possible to retrieve the whole of description from frontends. Use summary for a short description.
71 protected string Summary
{
72 get { return summary; }
73 set { summary = value; }
76 // Category/section to which the package might belong. Not all packages might have this.
77 protected string Category
{
78 get { return category; }
79 set { category = value; }
82 // Homepage of the package
83 protected string Homepage
{
84 get { return homepage; }
85 set { homepage = value; }
89 // Use either the homepage or packager to provide a external link for more information
90 // Not all packages have both set; however most have at least one
91 protected string PackagerName
{
92 get { return packager_name; }
93 set { packager_name = value; }
96 protected string PackagerEmail
{
97 get { return packager_email; }
98 set { packager_email = value; }
101 // Size of the package - in bytes.
102 // Depending on package, its either the installed size or the size of the package.
103 protected string Size
{
105 set { size = value; }
108 protected override void DoPullProperties ()
110 PullPackageProperties ();
112 AddProperty (Beagle
.Property
.New ("dc:title", package_name
));
113 AddProperty (Beagle
.Property
.NewKeyword ("fixme:version", package_version
));
114 AddProperty (Beagle
.Property
.New ("dc:subject", summary
));
115 AddProperty (Beagle
.Property
.New ("fixme:category", category
));
116 AddProperty (Beagle
.Property
.NewUnsearched ("dc:source", homepage
));
117 AddProperty (Beagle
.Property
.New ("fixme:packager_name", packager_name
));
118 AddProperty (Beagle
.Property
.New ("fixme:packager_email", packager_email
));
119 AddProperty (Beagle
.Property
.NewUnsearched ("fixme:size", size
));