Warning:
This wiki has been archived and is now read-only.

ApplicationProgrammingInterface

From Device Description Working Group Wiki
Jump to: navigation, search

DDR API Sketch Input from Jose Cantera (TI+D)

VersionTwo


// File: DDR-API.idl

#ifndef _DDR_IDL_

#define _DDR_IDL_

// It depends on specifc issues that have to be resolved by the gro
#include "dom.idl"

#pragma prefix "w3c.org"

module ddr {

	// A trade-off  between concrete and generic exceptions should be taken
	exception DDRException {
		unsigned short code;
		any additionalData; // Additional data needed to describe more precisely the exception
	};
	
	// Issue: Create specific exceptions or create a generic exception. 
        // Specific exceptions are betters for Object Orientation
	exception DDRNoSuchProperty {
		string propertyName;
	};
	
	// It is impossible to recognize the device, although it can be defaulted to to the delivery context???
	exception DDRCannotRecognize {
		string reason;
	};
	
	// Are we going to define groups of properties as in WURFL???
	
	// It represents a unit. Issue: Are we going to define constants for each unit
	typedef unsigned short Unit;
	// XML-Schema datatype I suppose
	typedef string DataType;
	// What is this? Does the DDR needs to know about the URI of a property of the ontology? 
        // Is property name an alias?
	typedef string PropertyName;
	// This the URI of the property according to the DC Ontology
	typedef string OntologyIdentifier;
	
	// Contextkey to be defined by context key task force
	struct ContextKey {
	};
	
	// This the key that allows to identify specific pieces a device, a browser, a camera, a GPS ... 
	// This key must be used independently of the delivery context
	// Example: Nokia_6600 or Opera_Mini_3
	typedef string IndividualKey;
	
	// Path to a property of the delivery context
	// For example: /hasDevice/hasCamera/
	typedef string DeliveryContextPath;
	
	typedef string InformalDescription;  // i.e. Needs a human to interpret
	
	// Constant with a value that indicates that the property value is in the default units
	const Unit DEFAULT_UNIT = -1;
	// The value has no associated units
	const Unit NO_UNITS = -2;
	
	// A property in a DDR
	
	// This represents  a property i.e. all  the characteristics of a property
	interface DDRProperty {
		readonly attribute OntologyIdentifier id;
		readonly attribute PropertyName name;
		readonly attribute DataType type;
		readonly attribute Unit defaultUnit;
		readonly attribute InformalDescription description;
	};

	// This is a property value measured in certain units, 
	interface DDRPropertyValue {
		readonly attribute DDRProperty property;
		readonly attribute any value;
		readonly attribute Unit unit;
	};

	// A lis of values for a property
	interface DDRPropertyValueList {
		readonly attribute unsigned long length;
		DDRPropertyValue item(in unsigned long index);
	};
		
	
	// This represents an element of the delivery context 
        // (Device, Browser, Display, Camera, etc)
	interface DCElementDescription {
		// What's a property name? URI according to the ontology? Shortcut? UAProf property??
		DDRPropertyValue getPropertyValue(in DeliveryContextPath dcp) raises(DDRNoSuchProperty);
		// Does it raise an exception when the property is not available in that unit? 
                // How to deal with this
		DDRPropertyValue getPropertyValueInUnits(in DeliveryContextPath dcp,in Unit unit) raises(DDRNoSuchProperty);
		
		DDRPropertyValueList getPropertyValues(in DeliveryContextPath propertyName) raises(DDRNoSuchProperty);
		DDRPropertyValueList getPropertyValuesInUnits(in DeliveryContextPath dcp,in Unit unit) raises(DDRNoSuchProperty);
	};
	
	
	// This interface represents all the delivery context. 
        // Using this interface I can ask for different properties of the delivery context
	interface DeliveryContext : DCElementDescription {
		DCElementDescription getDeliveryContextElement(in DeliveryContextPath path) raises(DDRNoSuchElement);
	};
	
	
	module core {
		interface repository {
			DeliveryContext getDeliveryContext(in ContextKey contextKey) raises(DDRException);
			// This method allows the retrieval of individual descriptions but outside a delivery context
			DCElementDescription getIndividualDescription(in IndividualKey key) raises(DDRException);
		};
	};

	
	module resolution {
		struct ContextInfoPair {
			string element;
			string value;
		};
		
		typedef sequence<ContextInfoPair> ContextInfo;
		
		interface ContextInformation {
			put(in string element,in string value);
			string get(in string element);
			ContextInfo getAll();
		};
		
		interface DeliveryContextResolutor {
			ContextKey resolve(in ContextInformation contextInfo) raises(DDRCannotRecognize);
		};
	};

	
	// To be defined Check the Requirements
	module admin {
	};	

	module extended {		
	};
};

#endif


Questions raised in this version