[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[DotGNU]Dgmx and the metadata problem

From: Peter Minten
Subject: [DotGNU]Dgmx and the metadata problem
Date: Mon, 13 Jan 2003 12:34:20 +0100

Hi folks,

I've looked into the dgmx webservice definition format and must say I like it a
lot. The idea of putting metadata in a separate file is great, especially since
it solves a problem with languages that don't have metadata support build in
(like Ruby and Python (AFAIK)). For those languages you could simply precompile
the metadata into dgmx and load it at runtime. 

I suggest that we use the following convention for that: Metadata is always put
in comment form, with a one line comment sign (#) if possible or with a one line
comment with multiline comment delimiters (/* */), if an metadata attribute does
not fit on one line a contiuation is signalized using '\'.The metadata is
written in C# attribute form ([PublishedMember(description="foo")]).

So when I would write the state example in Ruby it would look like this:

# Description="Returns State name (from example in CookComputing.XmlRpc)", \
# Namespace="";)]
class StateName
  #[WebMethod("examples.getStateName", \
  # Description="Returns the name of a state given its number")
  # Args={int}]
  # Note that since Ruby doesn't have typed arguments the Args attribute arg
  # tells the metadata compiler what to write as argument types.
  def GetStateName(stateNumber)
    if (stateNumber < 1 || stateNumber > m_stateNames.Length)
      raise, "Invalid state number")
    return m_stateNames[stateNumber-1]
  end #def GetStatename

  m_stateNames = [ "Alabama", "Alaska", "Arizona", "Arkansas", \
        "California", "Colorado", "Connecticut", "Delaware", "Florida", \
        "Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", \
        "Kansas", "Kentucky", "Lousiana", "Maine", "Maryland","Massachusetts",\
        "Michigan", "Minnesota", "Mississipi", "Missouri", "Montana", \
        "Nebraska", "Nevada", "New Hampshire", "New Jersey", "New Mexico", \
        "New York", "North Carolina", "North Dakota", "Ohio", "Oklahoma", \
        "Oregon", "Pennsylviania", "Rhose Island", "South Carolina", \
        "South Dakota", "Tennessee", "Texas", "Utah", "Vermont", "Virginia", \
        "Washington", "West Virginia", "Wisconsin", "Wyoming" ]
end #class StateName

Then I could simply generate the metadata using a little metadata compiler like:
'dgmxgen --ruby state.rb'. At runtime the Webservice would load state.dgmx and
use it's information to publish it's stuff.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]