(***************************************************************************** * uml2cdl --- a converter from UML models to WS-CDL. part of su4sml * http://projects.brucker.ch/su4sml/ * * cdl.sml --- * This file is part of uml2cdl. * * Copyright (c) 2005-2007, ETH Zurich, Switzerland * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * * Neither the name of the copyright holders nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ******************************************************************************) (** * SML types corresponding to the WS-CDL xml schema. * also includes some helper functions. *) structure CDL = struct open XML_Schema (** * The CDL description type. * * * * * * * * * *) datatype tDescriptionType = documentation | reference | semantics fun tDescriptionType2String documentation = "documentation" | tDescriptionType2String reference = "reference" | tDescriptionType2String semantics = "semantics" fun tDescriptionTypeFromString "documentation" = documentation | tDescriptionTypeFromString "reference" = reference | tDescriptionTypeFromString "semantics" = semantics | tDescriptionTypeFromString "" = documentation (* Basically, each type below that extends tExtensibleElements *) (* should have an additional record field: "description: {_type: tDescriptionType, content: string }" *) (* The content of the description is "free-form XML" *) type tDescription = { description_type: tDescriptionType, content: string } (* *) type tBoolean_expr = string type tXPath_expr = string (* *) datatype tWhenType = when_before | after | timeout (* *) datatype tUsage = once | unlimited fun tUsage2String once = "once" | tUsage2String unlimited = "unlimited" fun tUsageFromString "once" = once | tUsageFromString "unlimited" = unlimited (* *) datatype tAction2 = request | respond (* conflicts with tAction! *) (* *) datatype tAction = request | respond | request_respond (* conflicts with tAction2 *) fun tAction2String request = "request" | tAction2String respond = "respond" | tAction2String request_respond = "request-respond" fun tActionFromString "request" = request | tActionFromString "respond" = respond | tActionFromString "request-respond" = request_respond (* *) type tFinalizerReference = {choreographyName: NCName, choreographyInstanceId: tXPath_expr option, finalizerName: NCName} (* *) type tVariableRef = {variable: tXPath_expr} (* *) type tSourceVariableRef = {variable: tXPath_expr, expression: tXPath_expr} (* *) type tCopy = {name: NCName, causeException: bool option, source: tSourceVariableRef , target: tVariableRef } (* *) type tRecord = {name: NCName, causeException: bool option, when: tWhenType} (* *) type tVariableRecordRef = {variable: tXPath_expr option, recordReference: NCName list, causeException: bool option} (* *) type tExchange = {name: NCName, informationType: QName option, channelType: QName option, action: tAction, send: tVariableRecordRef, receive: tVariableRecordRef} (* *) type tParticipate = {relationshipType: QName, fromRole: QName, toRole: QName} (* *) type tTimeout = {time_to_complete: tXPath_expr, fromRoleRecordReference: NCName list option, (* hmpf *) toRoleRecordReference: NCName list option (* hmpf *) } (* *) type tBindVariable = {variable: tXPath_expr, role: QName} (* *) type tBind = {name:NCName, this: tBindVariable, free: tBindVariable} (* *) type tVariable = {name: NCName, informationType: QName option, channelType: QName option, mutable: bool option, free: bool option, silent: bool option, roleTypes: QName option} (* *) type tRelationshipRef = QName (* *) type tVariableDefinitions = tVariable list (* (* (* what is this??? *) *) (* *) (* *) *) (* mutually recursive datatypes are quite a hassle... *) datatype tActivity = sequence of tActivity list | parallel of tActivity list | choice of tActivity list | workunit of tWorkunit | interaction of {name: NCName, channelVariable: QName, operation: NCName, align: bool option, initiate: bool option, participate: tParticipate, exchange: tExchange list, timeout: tTimeout option, record: tRecord list } | perform of {choreographyName: QName, choreographyInstanceId: tXPath_expr option, bind: tBind list, choreography: tChoreography option} | assign of {copy: tCopy list, roleType: QName} | silentAction of {roleType: QName option, description: tDescription option} | noAction of {roleType: QName option} | finalize of {name: NCName, finalizerReference: tFinalizerReference list} and tChoreography = choreography of {name: NCName, complete: tBoolean_expr option, isolation: bool option, root: bool option, coordination: bool option, relationship: tRelationshipRef list, variableDefinitions: tVariableDefinitions, choreography: tChoreography list, activity: tActivity, exceptionBlock: tException list, finalizerBlock: tFinalizer list } and tFinalizer = tfinalizer of {name: NCName, workunit: tWorkunit list } and tException = texception of {name: NCName, workunit: tWorkunit list } withtype tWorkunit = {name: NCName, guard: tBoolean_expr option, repeat: tBoolean_expr option, block: bool option, activity: tActivity list} (* *) type tTokenReference = QName (* this can probably be merged with the type tReference... *) (* *) type tIdentity = {token: tTokenReference list} (* *) type tReference = {token: tTokenReference} (* *) type tPassing = {channel: QName, action: tAction option, new: bool option} (* *) type tRoleRef3 = {ref_type: QName, behavior: NCName option } (* *) type tChannelType = {name: NCName, usage: tUsage option, action: tAction option, passing: tPassing list, role: tRoleRef3, reference: tReference, identity: tIdentity option} (* *) type tRoleRef2 = {ref_type: QName} (* *) type tParticipantType = {name: NCName, role: tRoleRef2 list (* hmpf... *)} (* *) type tRoleRef = {ref_type: QName, behavior: NCName list option (* hmpf... *) } (* *) type tRelationshipType = {name: NCName, role: tRoleRef * tRoleRef } (* *) type tBehavior = {name: NCName, interface: QName option } (* *) type tRoleType = {name: NCName, behavior: tBehavior list } (* *) type tTokenLocator = {tokenName: QName, informationType: QName, part: NCName option, query: tXPath_expr } (* *) type tInformationType = {name: NCName, information_type: QName option, element: QName option, exceptionType: bool option } (* *) type tToken = { name: NCName, informationType: QName } (* *) type tPackage = {name: NCName, author: string, version: string, targetNamespace: anyURI, schema: xsdSchema, informationType: tInformationType list, token: tToken list, tokenLocator: tTokenLocator list, roleType: tRoleType list, relationshipType: tRelationshipType list, participantType: tParticipantType list, channelType: tChannelType list, choreography: tChoreography list } end