+++ /dev/null
-/*
- * Copyright (C) 2009 Jens Georg <mail@jensge.org>.
- *
- * Author: Jens Georg <mail@jensge.org>
- *
- * This file is part of Rygel.
- *
- * Rygel is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * Rygel is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-
-/**
- * Class used by MediaDB to create containers and items on demand
- *
- * If a specific kind of Item or Container is needed instead of
- * the default ones, inherit from this class and override the
- * corresponding methods.
- *
- * The class does not hold a reference to the MediaDB as the
- * MediaDB is holding a reference to the factory; this is done to
- * prevent circular references
- */
-public class Rygel.MediaExport.DBObjectFactory : Object {
- /**
- * Return a new instance of DatabaseBackedMediaContainer
- *
- * @param media_db instance of MediaDB
- * @param title title of the container
- * @param child_count number of children in the container
- */
- public virtual MediaContainer get_container (
- MediaCache media_db,
- string id,
- string title,
- uint child_count) {
- return new DBContainer (media_db, id, title);
- }
-
- /**
- * Return a new instance of MediaItem
- *
- * @param media_db instance of MediaDB
- * @param id id of the item
- * @param title title of the item
- * @param upnp_class upnp_class of the item
- */
- public virtual Rygel.MediaItem get_item (MediaCache media_db,
- MediaContainer parent,
- string id,
- string title,
- string upnp_class) {
- return new Rygel.MediaItem (id, parent, title, upnp_class);
- }
-}
*/
public class Rygel.MediaExport.MediaCache : Object {
private Database db;
- private DBObjectFactory factory;
+ private ObjectFactory factory;
internal const string schema_version = "8";
internal const string CREATE_META_DATA_TABLE_STRING =
"CREATE TABLE meta_data (size INTEGER NOT NULL, " +
public MediaCache (string name) throws Error {
this.open_db (name);
- this.factory = new DBObjectFactory ();
- }
-
- public MediaCache.with_factory (string name,
- DBObjectFactory factory)
- throws Error {
- this.open_db (name);
- this.factory = factory;
+ this.factory = new ObjectFactory ();
}
private void open_db (string name) throws Error {
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-internal class Rygel.MediaExport.ObjectFactory : DBObjectFactory {
- public override MediaContainer get_container (
+internal class Rygel.MediaExport.ObjectFactory : Object {
+ /**
+ * Return a new instance of DatabaseBackedMediaContainer
+ *
+ * @param media_db instance of MediaDB
+ * @param title title of the container
+ * @param child_count number of children in the container
+ */
+ public virtual MediaContainer get_container (
MediaCache media_db,
string id,
string title,
return new WritableContainer (media_db, id, title);
}
}
+
+ /**
+ * Return a new instance of MediaItem
+ *
+ * @param media_db instance of MediaDB
+ * @param id id of the item
+ * @param title title of the item
+ * @param upnp_class upnp_class of the item
+ */
+ public virtual MediaItem get_item (MediaCache media_db,
+ MediaContainer parent,
+ string id,
+ string title,
+ string upnp_class) {
+ return new MediaItem (id, parent, title, upnp_class);
+ }
}