Author: ygrego Date: 2015-01-29 17:10:15 +0000 (Thu, 29 Jan 2015) New Revision: 745 Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/745 Log: Refactoring general of oipf object factory Modified: oipf/js/impl/ApplicationManagerObject.js oipf/js/impl/ChannelConfig.js oipf/js/impl/OipfObjectFactory.js oipf/js/impl/RemoteManagementObject.js oipf/js/impl/SearchManagerObject.js Modified: oipf/js/impl/ApplicationManagerObject.js =================================================================== --- oipf/js/impl/ApplicationManagerObject.js 2015-01-29 14:11:59 UTC (rev 744) +++ oipf/js/impl/ApplicationManagerObject.js 2015-01-29 17:10:15 UTC (rev 745) @@ -1,19 +1,10 @@ -var Class = new Function(); - -Function.prototype.extend = function(proto) { - var parent = this; - - var child = function() { - this.init && this.init.apply(this, arguments); - }; - - child.prototype = proto; - child.prototype.__proto__ = parent.prototype; - child.prototype.super = parent.prototype; - - return child; -}; - +/* + * Description: An OITF SHALL support a non-visual embedded object of type “ application/oipfApplicationManager ”, with + * the following JavaScript API, to enable applications to access the privileged functionality related to application lifecycle + * and management that is provided by the application model defined in this section. + * If one of the methods on the application/oipfApplicationManager is called by a webpage that is not a + * privileged DAE application, the OITF SHALL throw an error as defined in section 10.1.1. + */ var ApplicationManagerObject = Class.extend({ init : function(){ Modified: oipf/js/impl/ChannelConfig.js =================================================================== --- oipf/js/impl/ChannelConfig.js 2015-01-29 14:11:59 UTC (rev 744) +++ oipf/js/impl/ChannelConfig.js 2015-01-29 17:10:15 UTC (rev 745) @@ -1,3 +1,22 @@ +/*The ChannelConfig class provides the entry point for applications to get information about the list of channels + * available. It can be obtained in two ways: + * -By calling the method getChannelConfig() of the video/broadcast embedded object as defined in + * section 7.13.1.3. + * -By calling the method createChannelConfig() of the object factory API as defined in section 7.1.1. + * The availability of the properties and methods are dependent on the capabilities description as specified in section 9.3. + * The following table provides a list of the capabilities and the associated properties and methods. If the capability is false + * the properties and methods SHALL NOT be available to the application. Properties and methods not listed in the + * following table SHALL be available to all applications as long as the OITF has indicated support for tuner control (i.e. + * <video_broadcast>true</video_broadcast> as defined in section 9.3.1) in their capability. + * Capability | Properties | Methods + * Element <extendedAVControl> | onChannelScan | startScan() stopScan() + * is set to “ true ” as defined in | + * section 9.3.6. | + *----------------------------------|---------------|--------------------------- + * Element <video_broadcast | |createChannelList() + * type="ID_IPTV_SDS"> is set as | | + * defined in section 9.3.6. | | + */ var ChannelConfig = Class.extend({ /* Modified: oipf/js/impl/OipfObjectFactory.js =================================================================== --- oipf/js/impl/OipfObjectFactory.js 2015-01-29 14:11:59 UTC (rev 744) +++ oipf/js/impl/OipfObjectFactory.js 2015-01-29 17:10:15 UTC (rev 745) @@ -18,22 +18,6 @@ var searchManager_dae_mime_type = "application/oipfSearchManager"; var statusView_dae_mime_type = "application/oipfStatusView"; -var Class = new Function(); - -Function.prototype.extend = function(proto) { - var parent = this; - - var child = function() { - this.init && this.init.apply(this, arguments); - }; - - child.prototype = proto; - child.prototype.__proto__ = parent.prototype; - child.prototype.super = parent.prototype; - - return child; -}; - /*! * \class OipfObjectFactory * \brief Provide access to components of a terminal supporting OIFP specification. @@ -42,23 +26,89 @@ init: function() { console.log("[INFO] constructor of OipfObjectFactory class called."); + this.applicationManagerObject = new ApplicationManagerObject(); + this.channelConfigObject = new channelConfigObject(); + this.searchManagerObject = new SearchManagerObject(); + this.remoteManagementObject = new RemoteManagementObject(); }, - listObjects: {}, + /* + * Description: An OITF SHALL support a non-visual embedded object of type “ application/oipfApplicationManager ”, with + * the following JavaScript API, to enable applications to access the privileged functionality related to application lifecycle + * and management that is provided by the application model defined in this section. + * If one of the methods on the application/oipfApplicationManager is called by a webpage that is not a + * privileged DAE application, the OITF SHALL throw an error as defined in section 10.1.1. + */ + applicationManagerObject: null, - /*! - * \class - * \brief + channelConfigObject: null, + + /* + * Description: Access to the functionality of the application/oipfRemoteManagement embedded object SHALL adhere to the + * security requirements as defined in section 10. + */ + remoteManagementObject: null, + + /* + * Description: OITFs SHALL implement the application/oipfSearchManager embedded object. This object provides a + * mechanism for applications to create and manage metadata searches. + */ + searchManagerObject: null, + + + /* + * Description: + * This method SHALL return true if and only if an object of the specified type is supported by + * the OITF, otherwise it SHALL return false. + * + * Argument: + * - mimeType : If the value of the argument is one of the MIME types defined in tables 1 + * to 4 of [OIPF_MEDIA2] or one of the DAE defined mime types listed + * below then an accurate indication of the OITF’s support for that MIME + * type SHALL be returned. For other values, it is recommended that an OITF returns a value which + * accurately reflects its support for the specified MIME type. + * DAE MIME Type: + * application/notifsocket, application/oipfApplicationManager, + * application/oipfCapabilities, application/oipfCodManager, + * application/oipfCommunicationServices, application/oipfConfiguration, + * application/oipfDownloadManager, application/oipfDownloadTrigger, + * application/oipfDrmAgent, application/oipfGatewayInfo, + * application/oipfCommunicationServices, application/oipfMDTF, + * application/oipfParentalControlManager, application/oipfRecordingScheduler, + * application/oipfRemoteControlFunction, application/oipfRemoteManagement + * */ isObjectSupported: function(mimeType) { }, - /*! - * \method - * \brief - * \return - */ + /*! + * Description: + * If the object type is supported, each of these methods shall return an instance of the + * corresponding embedded object. + * Since objects do not claim scarce resources when they are instantiated, instantiation shall + * never fail if the object type is supported. If the method name to create the object is not + * supported, the OITF SHALL throw an error with the error.name set to the value + * " TypeError ". + * If the object type is supported, the method shall return an HTMLObjectElement equivalent + * to the specified object. The value of the type attribute of the HTMLObjectElement SHALL + * match the mimetype of the instantiated object, for example " video/broadcast " in case of + * method oipfObjectFactory.createVideoBroadcastObject() . + * + * Arguments: + * -requiredCapabilities : + * An optional argument indicating the formats to be supported by + * the resulting player. Each item in the argument SHALL be one of + * the formats specified in [OIPF_MEDIA2]. Scarce resources will + * be claimed by the object at the time of instantiation. The + * allocationMethod property SHALL be set + * STATIC_ALLOCATION . If the OITF is unable to create the player + * object with the requested capabilities, the method SHALL return + * null . + * If this argument is omitted, objects do not claim scarce resources + * so instantiation shall never fail if the object type is supported. The + * allocationMethod property SHALL be set to DYNAMIC_ALLOCATION . + */ createVideoBroadcastObject: function() { console.log("[INFO] createVideoBroadcastObject() of OipfObjectFactory class called."); @@ -66,31 +116,58 @@ }, - /*! - * \class - * \brief - */ + /* + * Description + * If the object type is supported, each of these methods SHALL return an instance of the + * corresponding embedded object. This may be a new instance or existing instance. For + * example, the object will likely be a global singleton object and calls to this method may + * return the same instance. + * Since objects do not claim scarce resources when they are instantiated, instantiation + * SHALL never fail if the object type is supported. If the method name to create the object is + * not supported, the OITF SHALL throw an error with the name property set to the value + * " TypeError ". + * If the object is supported, the method SHALL return a JavaScript Object which + * implements the interface for the specified object. + */ createSearchManagerObject: function() { console.log("[INFO] createSearchManagerObject() of OipfObjectFactory class called."); - return this.verifOipfObjectExisting(searchManager_dae_mime_type); + return this.searchManagerObject; }, - /*! - * \class - * \brief - */ + /* + * Description + * If the object type is supported, each of these methods SHALL return an instance of the + * corresponding embedded object. This may be a new instance or existing instance. For + * example, the object will likely be a global singleton object and calls to this method may + * return the same instance. + * Since objects do not claim scarce resources when they are instantiated, instantiation + * SHALL never fail if the object type is supported. If the method name to create the object is + * not supported, the OITF SHALL throw an error with the name property set to the value + * " TypeError ". + * If the object is supported, the method SHALL return a JavaScript Object which + * implements the interface for the specified object. + */ createApplicationManagerObject: function() { console.log("[INFO] createApplicationManagerObject() of OipfObjectFactory class called."); - return this.verifOipfObjectExisting(applicationManager_dae_mime_type); + return this.applicationManagerObject; }, - /*! - * \class - * \brief - */ + /* + * Description + * If the object type is supported, each of these methods SHALL return an instance of the + * corresponding embedded object. This may be a new instance or existing instance. For + * example, the object will likely be a global singleton object and calls to this method may + * return the same instance. + * Since objects do not claim scarce resources when they are instantiated, instantiation + * SHALL never fail if the object type is supported. If the method name to create the object is + * not supported, the OITF SHALL throw an error with the name property set to the value + * " TypeError ". + * If the object is supported, the method SHALL return a JavaScript Object which + * implements the interface for the specified object. + */ createCapabilitiesObject: function() { console.log("[INFO] createCapabilitiesObject() of OipfObjectFactory class called."); @@ -104,7 +181,7 @@ createChannelConfig: function() { console.log("[INFO] createChannelConfigObject() of OipfObjectFactory class called."); - return this.verifOipfObjectExisting(channelConfig_type); + return this.channelConfigObject; }, /*! @@ -234,114 +311,74 @@ createRemoteManagementObject: function() { console.log("[INFO] createRemoteManagementObject() of OipfObjectFactory class called."); - return this.verifOipfObjectExisting(remoteManagement_dae_mime_type); + return this.remoteManagementObject; }, - createStatusViewObject: function() { + /*! + * Description: + * If the object type is supported, each of these methods shall return an instance of the + * corresponding embedded object. + * Since objects do not claim scarce resources when they are instantiated, instantiation shall + * never fail if the object type is supported. If the method name to create the object is not + * supported, the OITF SHALL throw an error with the error.name set to the value + * " TypeError ". + * If the object type is supported, the method shall return an HTMLObjectElement equivalent + * to the specified object. The value of the type attribute of the HTMLObjectElement SHALL + * match the mimetype of the instantiated object, for example " video/broadcast " in case of + * method oipfObjectFactory.createVideoBroadcastObject() . + * + * Arguments: + * -requiredCapabilities : + * An optional argument indicating the formats to be supported by + * the resulting player. Each item in the argument SHALL be one of + * the formats specified in [OIPF_MEDIA2]. Scarce resources will + * be claimed by the object at the time of instantiation. The + * allocationMethod property SHALL be set + * STATIC_ALLOCATION . If the OITF is unable to create the player + * object with the requested capabilities, the method SHALL return + * null . + * If this argument is omitted, objects do not claim scarce resources + * so instantiation shall never fail if the object type is supported. The + * allocationMethod property SHALL be set to DYNAMIC_ALLOCATION . + */ + createStatusViewObject: function() { console.log("[INFO] createStatusViewObject() of OipfObjectFactory class called."); return new StatusViewObject(); }, - + + /*! + * Description: + * If the object type is supported, each of these methods shall return an instance of the + * corresponding embedded object. + * Since objects do not claim scarce resources when they are instantiated, instantiation shall + * never fail if the object type is supported. If the method name to create the object is not + * supported, the OITF SHALL throw an error with the error.name set to the value + * " TypeError ". + * If the object type is supported, the method shall return an HTMLObjectElement equivalent + * to the specified object. The value of the type attribute of the HTMLObjectElement SHALL + * match the mimetype of the instantiated object, for example " video/broadcast " in case of + * method oipfObjectFactory.createVideoBroadcastObject() . + * + * Arguments: + * -requiredCapabilities : + * An optional argument indicating the formats to be supported by + * the resulting player. Each item in the argument SHALL be one of + * the formats specified in [OIPF_MEDIA2]. Scarce resources will + * be claimed by the object at the time of instantiation. The + * allocationMethod property SHALL be set + * STATIC_ALLOCATION . If the OITF is unable to create the player + * object with the requested capabilities, the method SHALL return + * null . + * If this argument is omitted, objects do not claim scarce resources + * so instantiation shall never fail if the object type is supported. The + * allocationMethod property SHALL be set to DYNAMIC_ALLOCATION . + */ createVideoMpegObject: function() { console.log("[INFO] createVideoMpegObject() of OipfObjectFactory class called."); return new VideoMpegObject(); - }, - - verifOipfObjectExisting: function(mimeType) { - - var currentObject = this.listObjects[mimeType]; - - if(!currentObject){ - - switch(mimeType){ - - case searchManager_dae_mime_type : - currentObject = new SearchManagerObject(); - break; - - case notifSocket_dae_mime_type : - currentObject = new NotifSocketObject(); - break; - - case applicationManager_dae_mime_type : - currentObject = new ApplicationManagerObject(); - break; - - case capabilities_dae_mime_type : - currentObject = new CapabilitiesObject(); - break; - - case codManager_dae_mime_type : - currentObject = new CodManagerObject(); - break; - - case configuration_dae_mime_type : - currentObject = new ConfigurationObject(); - break; - - case downloadManager_dae_mime_type : - currentObject = new DownloadManagerObject(); - break; - - case downloadTrigger_dae_mime_type : - currentObject = new DownloadTriggerObject(); - break; - - case drmAgent_dae_mime_type : - currentObject = new DrmAgentObject(); - break; - - case gatewayInfo_dae_mime_type : - currentObject = new GatewayInfoObject(); - break; - - case communicationServices_dae_mime_type : - currentObject = new CommunicationServicesObject(); - break; - - case mdtf_dae_mime_type : - currentObject = new MDTFObject(); - break; - - case parentalControlManager_dae_mime_type : - currentObject = new ParentalControlManagerObject(); - break; - - case recordingScheduler_dae_mime_type : - currentObject = new RecordingSchedulerObject(); - break; - - case remoteControlFunction_dae_mime_type : - currentObject = new RemoteControlFunctionObject(); - break; - - case remoteManagement_dae_mime_type : - currentObject = new RemoteManagementObject(); - break; - - case searchManager_dae_mime_type : - currentObject = new SearchManagerObject(); - break; - - case channelConfig_type: - currentObject = new ChannelConfig(); - break; - - default: - console.log("[Info][ERROR] : This mime-type: "+ mimeType +" not exist!!!"); - return undefined; - } - - - this.listObjects[mimeType] = currentObject; - } - - return this.listObjects[mimeType]; - - } - + } }); Modified: oipf/js/impl/RemoteManagementObject.js =================================================================== --- oipf/js/impl/RemoteManagementObject.js 2015-01-29 14:11:59 UTC (rev 744) +++ oipf/js/impl/RemoteManagementObject.js 2015-01-29 17:10:15 UTC (rev 745) @@ -1,3 +1,7 @@ +/* + * Description: Access to the functionality of the application/oipfRemoteManagement embedded object SHALL adhere to the + * security requirements as defined in section 10. + */ var RemoteManagementObject = Class.extend({ init : function(){ Modified: oipf/js/impl/SearchManagerObject.js =================================================================== --- oipf/js/impl/SearchManagerObject.js 2015-01-29 14:11:59 UTC (rev 744) +++ oipf/js/impl/SearchManagerObject.js 2015-01-29 17:10:15 UTC (rev 745) @@ -7,6 +7,12 @@ elem.dispatchEvent(event); */ +var currentQuery; + +/* + * Description: OITFs SHALL implement the application/oipfSearchManager embedded object. This object provides a + * mechanism for applications to create and manage metadata searches. + */ var SearchManagerObject = Class.extend({ /* @@ -83,9 +89,19 @@ result: null, /* + * Description : + * The target(s) of the search. Valid values are: * - *\type Integer + * Value | Description + * ------ ---------------------------------------------------------- + * 1 | Metadata relating to scheduled content SHALL be searched. + * 2 | Metadata relating to on-demand content SHALL be searched. * + * These values SHALL be treated as a bitfield, allowing searches to be carried out across multiple search + * targets. + * + * Type Integer + * */ searchTarget: null, @@ -95,15 +111,35 @@ }, /* + * Description: + * Set a query and constraints for retrieving metadata for programmes from a given channel + * and given start time from metadata contained in the stream as defined in section 4.1.3 of + * [OIPF_META2]. Setting the search parameters using this method will implicitly remove any + * existing constraints, ordering or queries created by prior calls to methods on this object. + * This method does not cause the search to be performed; applications must call + * getResults() to retrieve the results. + * + * Arguments: + * - channel: The channel for which programme information should be found. * - *\param Channel - *\param Integer + * - startTime: The start of the time period for which results should be returned measured in + * seconds since midnight (GMT) on 1/1/1970. The start time is inclusive; any + * programmes starting at the start time, or which are showing at the start time, + * will be included in the search results. If null , the search will start from the + * current time. * + * -count: Optional argument giving the maximum number of programmes for which + * information should be fetched. This places an upper bound on the number of + * results that will be present in the result set – for instance, specifying a value of + * 2 for this argument will result in at most two results being returned by calls to + * getResults() even if a call to getResults() requests more results. + * If this argument is not specified, no restrictions are imposed on the number of + * results which may be returned by calls to getResults(). + * */ - findProgrammesFromStream: function(channel, startTime) { + findProgrammesFromStream: function(channel, startTime, count) { console.log("[INFO]: findProgrammesFromStream [IN]"); - console.log(channel); - this.metaDataSearch.findProgrammesFromStream(channel, startTime); + currentQuery = new Query(channel, startTime, count); console.log("[INFO]: findProgrammesFromStream [Out]"); }, @@ -153,8 +189,16 @@ var Query = Class.extend({ - init: function() { + channel: null, + startTime: null, + + count: null, + + init: function(channel, startTime, count) { + this.channel= channel; + this.startTime= startTime; + this.count= count; } }); \ No newline at end of file
participants (1)
-
ygrego@users.nuiton.org