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.
49 // Name of the package
50 protected string PackageName
{
51 get { return package_name; }
52 set { package_name = value; }
56 protected string PackageVersion
{
57 get { return package_version; }
58 set { package_version = value; }
61 // A short summary. Some packages might not have this.
62 // The longer description stored as AppendText. When you request snippet, it is fetched from the description.
63 // It is not possible to retrieve the whole of description from frontends. Use summary for a short description.
64 protected string Summary
{
65 get { return summary; }
66 set { summary = value; }
69 // Category/section to which the package might belong. Not all packages might have this.
70 protected string Category
{
71 get { return category; }
72 set { category = value; }
75 /* Use either the homepage or packager to provide a external link for more information
76 * Not all packages have both set; however most have at least one
79 // Homepage of the package
80 protected string Homepage
{
81 get { return homepage; }
82 set { homepage = value; }
86 protected string PackagerName
{
87 get { return packager_name; }
88 set { packager_name = value; }
91 protected string PackagerEmail
{
92 get { return packager_email; }
93 set { packager_email = value; }
96 // Size of the package - in bytes.
97 // Depending on package, its either the installed size or the size of the package.
98 protected string Size
{
100 set { size = value; }
103 protected override void DoPullProperties ()
105 PullPackageProperties ();
107 AddProperty (Beagle
.Property
.New ("dc:title", package_name
));
108 AddProperty (Beagle
.Property
.NewKeyword ("fixme:version", package_version
));
109 AddProperty (Beagle
.Property
.New ("dc:subject", summary
));
110 AddProperty (Beagle
.Property
.New ("fixme:category", category
));
111 AddProperty (Beagle
.Property
.NewUnsearched ("dc:source", homepage
));
112 AddProperty (Beagle
.Property
.New ("fixme:packager_name", packager_name
));
113 AddProperty (Beagle
.Property
.New ("fixme:packager_email", packager_email
));
114 AddProperty (Beagle
.Property
.NewUnsearched ("fixme:size", size
));