Skip to content

Commit 4944274

Browse files
author
Zimmermann Olaf
committed
examples folder
1 parent 415fc1d commit 4944274

31 files changed

+1422
-0
lines changed

examples/HelloWorldMEPDemo.mdsl

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
API description HelloWorldAndMEPDemoAPI version "v1.0.0"
2+
3+
data type SampleDTO {ID, D}
4+
data type InvalidIdentifier ID<bool>
5+
6+
endpoint type HelloWorldEndpoint
7+
exposes
8+
operation sayHello in REQUEST_REPLY conversation
9+
expecting payload D<string>
10+
delivering payload SampleDTO
11+
12+
endpoint type MEPDemoAndTestEndpoint
13+
exposes
14+
operation testRequestReply in REQUEST_REPLY conversation
15+
expecting payload D<string>
16+
delivering payload SampleDTO
17+
operation testOneWay in ONE_WAY conversation
18+
expecting payload D<string>
19+
operation testNotification in NOTIFICATION conversation
20+
delivering payload SampleDTO
21+
operation testNoOp in "ToBeContinued" conversation
22+
// incomplete specification, does not make much sense at runtime
23+
24+
API provider HelloWorldAPIProvider
25+
offers HelloWorldEndpoint
26+
27+
API client HelloWorldAPIClient
28+
consumes HelloWorldEndpoint
29+
30+
// MEPDemoAndTestEndpoint not offered, not consumed (linter could report that)

examples/HelloWorldWiki.mdsl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
API description HelloWorldAPI
2+
3+
data type SampleDTO {ID, V}
4+
5+
endpoint type HelloWorldEndpoint
6+
exposes
7+
operation s
8+
expecting payload V<string>
9+
delivering payload SampleDTO
10+
11+
API provider HelloWorldAPIProvider1
12+
offers HelloWorldEndpoint
13+
14+
15+
API client HelloWorldAPIClient1
16+
consumes HelloWorldEndpoint
17+
18+
IPA
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
API description MAPContextRepresentationSketch
2+
3+
data type SharedContext (
4+
"apiKey":ID<int>?,
5+
"sessionId":V<int>?,
6+
"otherQoSPropertiesThatShouldNotGoToProtocolHeader":V<string>*)
7+
8+
endpoint type CustomerInformationHolderService
9+
exposes
10+
operation getCustomerAttributes
11+
expecting
12+
payload
13+
{ <<Context_Representation>>
14+
{
15+
{<<Annotated_Parameter_Collection>>"qosControl": SharedContext},
16+
{<<Wish_List>>"desiredAttributes":ID<string>+}
17+
}, // end of context representation
18+
{
19+
"actualPayload":V // SomeInParameters
20+
} // end of actual/inner payload
21+
} // end of entire/outer payload
22+
delivering
23+
payload {
24+
<<Context_Representation>> {
25+
{SharedContext},
26+
{<<Error_Report>>("errorCode":V<int>, "errorMessage":V<string>)}
27+
},
28+
{<<Pagination>>(
29+
"thisPageContent":V, // "SomeOutParameterSet",
30+
"previousPage":ID?,
31+
"nextPage":ID?)
32+
}
33+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
API description SampleScenarioForEuroPLoP2020
2+
3+
data type Customer {"name": V<string>,
4+
"address": V<string>,
5+
"bday": V<string>}
6+
7+
endpoint type CustomerRelationshipManager serves as PROCESSING_RESOURCE
8+
exposes
9+
operation validateCustomerRecord with responsibility COMPUTATION_FUNCTION
10+
expecting payload "customerRecord": Customer
11+
delivering payload "isCompleteAndSound": D<bool>
12+
operation createCustomer with responsibility NOTIFICATION_OPERATION
13+
expecting payload "customerRecord": Customer
14+
delivering payload "customerId": D<int>
15+
operation upgradeCustomer with responsibility STATE_TRANSITION_OPERATION
16+
expecting payload "promotionCode": P // request partially specified
17+
delivering payload P // response unspecified
18+
19+
endpoint type CustomerRepository serves as INFORMATION_HOLDER_RESOURCE
20+
exposes
21+
operation findCustomer with responsibility RETRIEVAL_OPERATION
22+
expecting payload "searchFilter": V<string>
23+
delivering payload "customerList": Customer*
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
API description MAPElementSterotypesSketch
2+
usage context PUBLIC_API for FRONTEND_INTEGRATION
3+
4+
data type URI L<string>
5+
data type CustomerDTO {"customerId":ID?, "name", "birthday", "address"} // partially modeled
6+
data type SampleParameterTree P // P will be refined/modeled later
7+
data type Page {V*|L*} // a page either is a set of values or a set of links
8+
9+
endpoint type CustomerRegistrationWorkflow serves as PROCESSING_RESOURCE
10+
exposes
11+
operation placeRegistrationRequest with responsibility BUSINESS_ACTIVITY_PROCESSOR
12+
expecting payload {
13+
<<Entity>> "customerToBeRegistered":CustomerDTO*
14+
}+
15+
delivering payload {
16+
<<Link>> "registrationRequestCode":URI,
17+
<<Error_Report>>("errorCode":V<int> | "errorMessage":V<string>)?
18+
}
19+
20+
operation completeRegistrationRequest with responsibility BUSINESS_ACTIVITY_PROCESSOR
21+
expecting payload {
22+
<<Link>>"registrationRequestCode":URI
23+
}+
24+
delivering payload {
25+
<<Entity>>"registeredCustomer":CustomerDTO*,
26+
<<Metadata>> "elapsedTime": MD<int>,
27+
<<Error_Report>>("errorCode":V<int> | "errorMessage":V<string>)?
28+
}
29+
30+
// copied from other example:
31+
32+
operation provideRegistrationStatistics with responsibility RETRIEVAL_OPERATION
33+
expecting payload {
34+
{<<Context_Representation>>{
35+
<<Wish_List>>"desiredAttributes":V<string>+ | <<Wish_Template>>"mockTree":SampleParameterTree},
36+
<<Metadata>>"someMoreContextInfo":V
37+
},
38+
{"payload":SampleParameterTree}
39+
}+
40+
delivering payload {
41+
{<<Pagination>>"payload":Page, "metadata":MD*, "previousPage":Page?, "nextPage":Page?},
42+
{<<Error_Report>>("errorCode":V<int>, "errorMessage":V<string>)}+
43+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
API description MAPContextRepresentationSketch
2+
3+
// HATEOAS support:
4+
data type HTTPVerbs {"GET"|"PUT"|"POST"|"PATCH"|"DELETE"} // TODO test this combo of choice and id/name only P... actually yields an enum
5+
// data type WebLink V<void> // marker type
6+
data type WebLink {"target":V<string>, "type":V<string>, "verb methods":HTTPVerbs+} // marker type
7+
8+
endpoint type DummyEndpoint exposes operation dummyOp expecting payload V<void> delivering payload WebLink*
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
API description MAPServiceTypeSketches
2+
data type A P // A is some unspecified data structure P (P for parameter)
3+
data type B P // B is another data structure, different from A but also unspecified
4+
data type EventFormatA P // A is some unspecified data structure P (P for parameter)
5+
data type EventFormatB P // B is another data structure, different from A but also unspecified
6+
data type NoParameters P // placeholder for empty parameter list (which is not allowed by current grammar)
7+
8+
// skeleton:
9+
endpoint type ect1 exposes
10+
operation op1
11+
expecting payload A
12+
delivering payload B
13+
14+
// example 1: stateless and side-effect free processing resource:
15+
endpoint type PureComputationResource serves as PROCESSING_RESOURCE and GROUND_RESOURCE
16+
exposes
17+
operation convertAtoB with responsibility COMPUTATION_FUNCTION
18+
expecting payload A
19+
delivering payload B
20+
operation calculate with responsibility COMPUTATION_FUNCTION
21+
expecting payload {V, V, P} // any number of unspecified values (flat/basic) and/or entities (structured, self-contained)
22+
delivering payload "some result"
23+
24+
// example 2: stateful processing resource (ground level, no outbound dependencies?)
25+
endpoint type PureOrchestrator serves as PROCESSING_RESOURCE
26+
exposes
27+
operation createProcessInstance with responsibility EVENT_PROCESSOR
28+
expecting payload NoParameters // represents empty parameter list
29+
delivering payload {("successFlag":V<bool>, "uri":L)}
30+
operation activity1 with responsibility BUSINESS_ACTIVITY_PROCESSOR
31+
expecting payload "some activity input":V
32+
delivering payload "some activity output":V
33+
operation activityN with responsibility BUSINESS_ACTIVITY_PROCESSOR
34+
expecting payload "some activity input":V
35+
delivering payload "some activity output":V
36+
operation cancelProcessInstance with responsibility EVENT_PROCESSOR
37+
expecting payload ID
38+
delivering payload V<bool>
39+
operation finishProcessInstance with responsibility EVENT_PROCESSOR
40+
expecting payload "some activity input":V
41+
delivering payload {"successFlag":V<bool>, "uri":L}
42+
43+
// example 3: Information Holder Resource 1 "Pure Data Provider" a.k.a. Entity Service, CRUD Service, Ground Information Holder
44+
endpoint type PureDataProvider serves as INFORMATION_HOLDER_RESOURCE
45+
exposes
46+
operation createInformationItem with responsibility EVENT_PROCESSOR
47+
expecting payload "some information item":V
48+
delivering payload {("successFlag":V<bool>, "uri":L)}
49+
operation readInformationItem with responsibility RETRIEVAL_OPERATION
50+
expecting payload ID // any number of unspecified values (flat/basic) and/or entities (structured, self-contained)
51+
delivering payload "requested information item"
52+
operation updateInformationItem with responsibility EVENT_PROCESSOR
53+
expecting payload A // TODO tbc
54+
delivering payload {"successFlag":V<bool>, "uri":L}
55+
operation deleteInformationItem with responsibility EVENT_PROCESSOR
56+
expecting payload ID // needed?
57+
delivering payload V<bool>
58+
operation searchInformationItemSet with responsibility RETRIEVAL_OPERATION
59+
expecting payload {"search scope", "search criteria", "result filter"}
60+
delivering payload "result set"
61+
62+
63+
// example 4: Gateway/Guard Resource 1 "Connector (bidirectional)" a.k.a. Integration Service, Provider Interfacer, Provider Guard
64+
endpoint type PureConnectorResource serves as GUARD_RESOURCE
65+
exposes
66+
operation receiveEvent with responsibility EVENT_PROCESSOR
67+
expecting payload "some event":EventFormatB // note: E is entity, not event
68+
delivering payload "acknowledgment":V
69+
operation receiveAndPassOnEvent with responsibility EVENT_PROCESSOR // EMITTER // no 'and' possible here (SRP)
70+
expecting payload "some event":EventFormatA // note: E is entity, not event
71+
delivering payload "acknowledgment":V
72+
operation transformMessageFormatAtoB with responsibility COMPUTATION_FUNCTION
73+
expecting payload EventFormatA
74+
delivering payload EventFormatB
75+
operation transformMessageFormatBtoA with responsibility COMPUTATION_FUNCTION
76+
expecting payload EventFormatB
77+
delivering payload EventFormatA
78+
79+
// example 5: stateful processing resource (guard level, so outbound dependencies?):
80+
// TODO, , combines 2 and 4
81+
endpoint type ect1 serves as GUARD_RESOURCE and PROCESSING_RESOURCE
82+
exposes
83+
operation op1
84+
expecting payload A
85+
delivering payload B
86+
87+
// example 6: Gateway/Guard Resource 2 "Legacy System Orchestrator Guard" a.k.a. Legacy Service Activator, Legacy Workflow Guard
88+
// TODO, combines 3 and 4
89+
endpoint type ect1 serves as GUARD_RESOURCE and INFORMATION_HOLDER_RESOURCE
90+
exposes
91+
operation op1
92+
expecting payload A
93+
delivering payload B
94+
95+
// example 7: mixed ms
96+
// TODO
97+
98+
IPA
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
API description MAPLinkLookupResource
2+
3+
data type URI P // Placeholder for protocol, domain, path, parameters
4+
5+
endpoint type LinkLookupResourceInterface // sketch
6+
exposes
7+
operation lookupInformationHolderByLogicalName
8+
expecting payload
9+
<<Identifier_Element>> "logicalName": ID // string or something else
10+
11+
delivering payload
12+
<<Link_Element>> "endpointAddress": URI // must point to an API endpoint that has an Information Holder role
13+
14+
operation lookupInformationHolderByCriteria
15+
expecting payload {
16+
"filter": P // some query expression or list of properties
17+
}
18+
delivering payload {
19+
<<Link_Element>> "uri": URI*
20+
}
21+
22+
API provider CustomerLookupResource
23+
offers LinkLookupResourceInterface
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
API description MAPTutorial0Sample
2+
3+
data type Customer {"name": D<string>, "address": D<string>, "bday": D<string>}
4+
5+
endpoint type CustomerLookup
6+
exposes
7+
operation findCustomer
8+
expecting payload "searchFilter": D<string>
9+
delivering payload "customerList": Customer*
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
API description MAPTutorial0Sample
2+
3+
data type Customer {
4+
"name": D<string>,
5+
"address": D<string>,
6+
"birthday": D<string>}
7+
data type CustomerPage {
8+
"pageContent": Customer*,
9+
"navigation": PageCursor,
10+
"statistics": PageMetadata?}
11+
data type PageCursor {
12+
"thisPage": PageID,
13+
"previousPage": PageID,
14+
"nextPage": PageID}
15+
data type PageMetadata {
16+
"totalResultCount": MD<int>,
17+
"pageSize": MD<int>,
18+
"offsetNumber": PageID}
19+
data type PageID L<string>
20+
21+
endpoint type CustomerLookup
22+
exposes
23+
operation findCustomer with responsibility RETRIEVAL_OPERATION
24+
expecting payload "searchFilter": D<string>
25+
delivering payload "customerList": Customer*
26+
27+
operation findCustomerPaginated with responsibility RETRIEVAL_OPERATION
28+
expecting payload "searchFilter": D<string> // could specify page size here
29+
delivering payload "customerPage": CustomerPage

0 commit comments

Comments
 (0)