SampleIdl

From Device Description Working Group Wiki
Revision as of 19:42, 17 September 2008 by Ot (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Sample IDL

This page contains some sample IDL that is intended to act as a stimulus for discussion on the eventual form of the DDR API.

An initial, very simple, IDL for a DDR API

// A simple seed IDL for the DDR.
// This one just has a Get method; no structured types or any
// other well-formed features we expect of the final API.

module ddrcore
{
  
  // Declarations
  typedef string OntologyIdentifier;   // Responsibility of the UWA group
  typedef string RepositoryId;
  typedef string InformalDescription;  // i.e. Needs a human to interpret
  interface Repository;

  // Definitions
  struct ContextKey {
    string agentSignature;
  };
  
  exception DDRException {
    unsigned short code;
  };

  const unsigned short UNSPECIFIED_ERROR     =  1;
  const unsigned short NOT_SUPPORTED_ERROR   =  2;
  const unsigned short ACCESS_VIOLATION      =  3;
  const unsigned short SYNTAX_ERROR          =  4;

  interface MinimalRepository {
    readonly attribute   string         name;
    readonly attribute   RepositoryId   id;
    InformalDescription  getInformalValue (
      in ContextKey          contextKey;
      in OntologyIdentifier  propertyName;
    ) raises(DDRException);
  }
  
};

Questions raised by this example

  1. Should we be using well known types from other domains, such as DOMString?
  2. What should be the true nature of the ContextKey type?
  3. Can a Get method return a null/empty response?
  4. Should a failure to get something (because it's not there) be an Exception, or should a special return value be used?
  5. Should an explicit set of values be used for Exception codes, or should an enum type be used?