Title: Code Generation
1Code Generation
- Lightning talk
- 22 July 2004
2Morgan Stanley Infrastructure APIs
- Talk SOAP to services
- Authentication
- Resource discovery
- Notification (Outage, Metric, Alerts, etc.)
- Message broadcasting
- Lots of languages
- Perl
- Java
- C/C
- C
3MSDWEclipse - authentication
my e3client new MSDWEclipse (
'Hostname' gt 'cwit315', 'Port' gt
'9368', ) die e3client-gtcreateUser(User
gt'goofie') sub AUTOLOAD my (self)
shift _at__ my command AUTOLOAD
command s/.// die "Not a
MSDWEclipse method AUTOLOAD\n"
unless command m/(createdeleteupdatereport
query)(.)/ self-gt_command(command,
_at__) use XMLLibXML use MSDWEclipseConsta
nts use vars qw(_at_fields _at_members
_at_attribs) use constant ELEMENTS gt 'User'
gt 'Attribs' gt 'name', ,
Application Eclipse.pm Object.pm
4MSDWEclipse - authentication
Object.pm
'Domain' gt 'Fields' gt
qw(Description Contact Project DefinitionURL),
'Attribs' gt 'name', ,
'DomainToDomain' gt 'Members' gt
qw(Domain LinkTo), , 'Resource' gt
'Fields' gt qw(), 'Attribs'
gt 'type', , 'Action' gt
'Fields' gt qw(Description),
'Attribs' gt 'name', ,
'ActionGroup' gt 'Fields' gt
qw(Description), 'Attribs' gt
'name', , 'ActionToActionGroup' gt
'Members' gt qw(ActionGroup Action
), ,
5MSDWQuasar common alert
ltclass name"CAMMetric" base"BaseEvent"
ctor"true" gt ltmessage event"CAMMetricTempla
te" /gt ltdocumentationgt ltinterfacegtThis
is the generic class for representing performance
metrics. Metrics can either be published directly
by the application or automatically by
configuring the Quasar publisher to publish
metrics from the underlying libraries. Further
information on the automatic publishing of
metrics can be found in the QUasar user guide.
lt/interfacegt ltimplementationgtThis class
is an HDOM implementation of the standard metric
interface. lt/implementationgt
lt/documentationgt ltinsertPoint
base"CAMMetricMetricDataXpath" /gt ltoptField
name"startTimeAsSeconds" class"seconds"gt
ltbind-xml name"CAMMetricStartTimeSecondsXpath"
type"long" access"both" /gt
ltdocumentationgt ltinterfacegtThe start
time for the metric. The time is measured as the
difference in seconds between the current time
and midnight, January 1, 1970 UTC. Alternatively
the time can be given as ISO string.
lt/interfacegt lt/documentationgt lt/optFieldgt
XML
6MSDWQuasar common alert
package MSDWQuasarltxslvalue-of
select"./_at_name" /gt use strict use vars
qw(_at_ISA) _at_ISA qw(MSDWQuasarltxslvalue-of
select"baseclass" /gt) use MSDWQuasarCAMGen
eratedConstants head1 NAME MSDWQuasarltxsl
value-of select"./_at_name" /gt - module to model
ltxslvalue-of select"./_at_name" /gt object head1
SYNOPSIS use MSDWQuasar my ltxslvalue-of
select"./_at_name" /gt MSDWQuasarltxslvalue-of
select"./_at_name" /gt-gtnew head1
DESCRIPTION ltxslvalue-of select"./documentation
/interface"/gt
XSL
7MSDWQuasar common alert
XSL
ltxslvariable name"getter"gt pod my
result ltxslvalue-of select"../_at_name"
/gt-gtgetltxslvalue-of select"fieldname"
/gtltxsltextgt lt/xsltextgt cut subltxsltextgt
lt/xsltextgtgetltxslvalue-of select"fieldname"
/gt my (self) _at__ my xpath
ltxslvalue-of select"getParentInsertPoint" /gt .
ltxslvalue-of select"./bind-xml/_at_name" /gt()
ltxslvalue-of select"gettype"
/gt lt/xslvariablegt
8MSDWQuasar common alert
XSL
ltxslvariable name"setter"gt pod
ltxslvalue-of select"../_at_name"
/gt-gtsetltxslvalue-of select"fieldname"
/gt(value)ltxsltextgt lt/xsltextgt cut subltxslte
xtgt lt/xsltextgtsetltxslvalue-of
select"fieldname" /gt my (self, value)
_at__ my xpath ltxslvalue-of
select"getParentInsertPoint" /gt . ltxslvalue-of
select"./bind-xml/_at_name" /gt() ltxslvalue-of
select"settype" /gt lt/xslvariablegt
9MSDWQuasar common alert
package MSDWQuasarCAMMetric use strict use
vars qw(_at_ISA) _at_ISA qw(MSDWQuasarCAMEvent)
use MSDWQuasarCAMGeneratedConstants head1
NAME MSDWQuasarCAMMetric - module to model
CAMMetric object head1 SYNOPSIS use
MSDWQuasar my CAMMetric MSDWQuasarCAMMe
tric-gtnew head1 DESCRIPTION This is the
generic class for representing performance
metrics. Metrics can either be published directly
by the application or automatically by
configuring the Quasar publisher to publish
metrics from the underlying libraries. Further
information on the automatic publishing of
metrics can be found in the QUasar user guide.
Perl
10MSDWQuasar common alert
Perl
pod BltStartTimeAsMillisgt The start time for
the metric. The time is measured as the
difference in milliseconds between the current
time and midnight, January 1, 1970 UTC.
Alternatively the time can be given as ISO
string. cut pod my result
CAMMetric-gtgetStartTimeAsMillis cut sub
getStartTimeAsMillis my (self) _at__
my xpath __PACKAGE__-gt_getParentInsertPoint .
CAMMetricStartTimeMillisXpath() return
self-gtgetElementValue(xpath)