sbSongkickDBService.h
Go to the documentation of this file.
1 /*
2  *=BEGIN SONGBIRD GPL
3  *
4  * This file is part of the Songbird web player.
5  *
6  * Copyright(c) 2005-2010 POTI, Inc.
7  * http://www.songbirdnest.com
8  *
9  * This file may be licensed under the terms of of the
10  * GNU General Public License Version 2 (the ``GPL'').
11  *
12  * Software distributed under the License is distributed
13  * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
14  * express or implied. See the GPL for the specific language
15  * governing rights and limitations.
16  *
17  * You should have received a copy of the GPL along with this
18  * program. If not, go to http://www.gnu.org/licenses/gpl.html
19  * or write to the Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  *
22  *=END SONGBIRD GPL
23  */
24 
25 #ifndef sbSongkickDBService_h_
26 #define sbSongkickDBService_h_
27 
28 #include <ISongkick.h>
29 
30 #include <sbIDatabaseQuery.h>
31 
32 #include <nsAutoPtr.h>
33 #include <nsStringAPI.h>
34 #include <nsCOMPtr.h>
35 #include <nsIArray.h>
36 #include <nsIComponentManager.h>
37 #include <nsIGenericFactory.h>
38 #include <nsIFile.h>
39 #include <nsIObserver.h>
40 #include <prlock.h>
41 
42 class sbSongkickQuery;
44 class sbSongkickDBInfo;
45 
46 //------------------------------------------------------------------------------
47 
49  public nsIObserver
50 {
51 public:
53  virtual ~sbSongkickDBService();
54 
56  NS_DECL_SBPISONGKICKDBSERVICE
57  NS_DECL_NSIOBSERVER
58 
59  static NS_METHOD RegisterSelf(nsIComponentManager* aCompMgr,
60  nsIFile* aPath,
61  const char* aLoaderStr,
62  const char* aType,
63  const nsModuleComponentInfo *aInfo);
64 
65  nsresult Init();
66 
67  nsresult GetDatabaseQuery(sbIDatabaseQuery **aOutDBQuery);
68 
69  // Shared resource, any query that starts to run will use this lock to
70  // prevent the database from getting locked up.
72 
73 protected:
74  nsresult LookupDBInfo();
75 
76 private:
77  nsRefPtr<sbSongkickDBInfo> mDBInfo;
78 };
79 
80 #define SONGBIRD_SONGKICKDBSERVICE_CONTRACTID \
81  "@songbirdnest.com/songkick/dbservice;1"
82 #define SONGBIRD_SONGKICKDBSERVICE_CLASSNAME \
83  "Songkick DB Service"
84 #define SONGBIRD_SONGKICKDBSERVICE_CID \
85  {0xe81479c8, 0x1dd1, 0x11b2, {0xa9, 0xa1, 0xae, 0x97, 0x1f, 0x22, 0xf7, 0xfc}}
86 
87 
88 //------------------------------------------------------------------------------
89 
91 {
93 
94 public:
96  virtual ~sbSongkickConcertInfo();
97 
99  NS_DECL_SBISONGKICKCONCERTINFO
100 
101  nsresult Init(const nsAString & aArtistname,
102  const nsAString & aArtistURL,
103  const nsAString & aID,
104  const nsAString & aTS,
105  const nsAString & aVenue,
106  const nsAString & aCity,
107  const nsAString & aTitle,
108  const nsAString & aURL,
109  const nsAString & aVenueURL,
110  const nsAString & aTickets,
111  nsIArray *aArtistsConcertInfo,
112  const nsAString & aLibartist);
113 
114 protected:
115  nsString mArtistname;
116  nsString mArtistURL;
117  nsString mID;
118  nsString mTS;
119  nsString mVenue;
120  nsString mCity;
121  nsString mTitle;
122  nsString mURL;
123  nsString mVenueURL;
124  nsString mTickets;
125  nsCOMPtr<nsIArray> mArtistConcertInfoArray;
126  nsString mLibArtist;
127 };
128 
129 //------------------------------------------------------------------------------
130 
132 {
133 public:
136 
138  NS_DECL_SBISONGKICKARTISTCONCERTINFO
139 
140  nsresult Init(const nsAString & aArtistName,
141  const nsAString & aArtistURL);
142 
143 private:
144  nsString mArtistName;
145  nsString mArtistURL;
146 };
147 
148 //------------------------------------------------------------------------------
149 
151 {
152 public:
154  virtual ~sbSongkickProperty();
155 
157  NS_DECL_SBISONGKICKPROPERTY
158 
159  nsresult Init(const nsAString & aName,
160  const nsAString & aID,
161  const nsAString & aKey);
162 
163 private:
164  nsString mID;
165  nsString mName;
166  nsString mKey;
167 };
168 
169 #endif // sbSongkickDBService_h_
170 
_updateCookies aPath
NS_DECL_ISUPPORTS NS_DECL_SBISONGKICKPROPERTY nsresult Init(const nsAString &aName, const nsAString &aID, const nsAString &aKey)
nsresult GetDatabaseQuery(sbIDatabaseQuery **aOutDBQuery)
NS_DECL_ISUPPORTS NS_DECL_SBISONGKICKARTISTCONCERTINFO nsresult Init(const nsAString &aArtistName, const nsAString &aArtistURL)
nsCOMPtr< nsIArray > mArtistConcertInfoArray
NS_DECL_ISUPPORTS NS_DECL_SBPISONGKICKDBSERVICE static NS_DECL_NSIOBSERVER NS_METHOD RegisterSelf(nsIComponentManager *aCompMgr, nsIFile *aPath, const char *aLoaderStr, const char *aType, const nsModuleComponentInfo *aInfo)
_updateCookies aName
An object responsible for executing SQL queries on the database.
NS_DECL_ISUPPORTS NS_DECL_SBISONGKICKCONCERTINFO nsresult Init(const nsAString &aArtistname, const nsAString &aArtistURL, const nsAString &aID, const nsAString &aTS, const nsAString &aVenue, const nsAString &aCity, const nsAString &aTitle, const nsAString &aURL, const nsAString &aVenueURL, const nsAString &aTickets, nsIArray *aArtistsConcertInfo, const nsAString &aLibartist)