Sample ASL Export script
In this example ASL script, you are requesting XML output for all instances of the ServiceSubscriber class, the ServiceOfferings to which they are subscribed, and the Applications that compose the ServiceOfferings:
/* xml-export-sample.asl * * Copyright (C) 2003, System Management ARTS (SMARTS) * All Rights Reserved * * Sample Rule Set to export the topology of the ServiceSubscribers, the * ServiceOfferings they are subscribed to, the Applications that these * ServiceOfferings are composedOf, and the Hosts that Host these * Applications from the server into an XML document that will confirm * to the ICIM/XML DTD specifications. * * This is a sample xml-export-*.asl file. Users should make copies of this * file, and edit them according to their needs. But they should always name * these asl files according to the Naming convention, xml-export-<name>.asl */ /* * the XML_Builder object */ default builderName = ""; aslname = " ".getRuleFileName().": "; builder = self->object("XML_Builder", builderName)? LOG, STOP; if (builder->isNull()) { print(aslname."ERROR: The Wrapper object has not been created."); print(aslname."ERROR: Please make sure the CREATE_BUILDER is called ". "before calling the INITIALIZE rule in the script."); stop(); } /* * NOTE: Customize the script from this point on. */ START() { .. eol EXPORT_BIM_INSTANCES } EXPORT_BIM_INSTANCES { EXPORT_SERVICESUBSCRIBER EXPORT_SERVICEOFFERRING EXPORT_APPLICATION } EXPORT_SERVICESUBSCRIBER { } do { /* * Get all the instances of ServiceSubscriber class and start adding to the * XML Document. */ svcSubList = getInstances("ServiceSubscriber")? LOG, NEXT; foreach svcSub (svcSubList) { svcSubObj = object("ServiceSubscriber", svcSub)? LOG, IGNORE; builder->addObject(svcSub, "ServiceSubscriber"); builder->addAttribute(svcSub, "DisplayName"); builder->addRelationship("Subscriptions"); /* * Get all the ServiceOffering objects that each of these * ServiceSubscribers subscribe to, and add them to the document. */ foreach svcOffObj (svcSubObj->Subscriptions) { builder->addObject(svcOffObj->Name, svcOffObj->CreationClassName); builder->addObjectClosing(); } builder->addRelationshipClosing(); builder->addObjectClosing(); } } EXPORT_SERVICEOFFERRING { } do { /* * Get all the instances of ServiceOffering class and start adding to the * XML Document. */ svcOffList = getInstances("ServiceOffering")? LOG, NEXT; foreach svcOff (svcOffList) { svcOffObj = object("ServiceOffering", svcOff)? LOG, IGNORE; builder->addObject(svcOff, "ServiceOffering"); builder->addAttribute(svcOff, "DisplayName"); builder->addRelationship("ConsistsOf"); /* * Get all the <infrastructure> objects that each of these * ServiceOfferings consists of, and add them to the document. */ foreach infObj (svcOffObj->ConsistsOf) { builder->addObject(infObj->Name, infObj->CreationClassName); builder->addObjectClosing(); } builder->addRelationshipClosing(); builder->addObjectClosing(); } } EXPORT_APPLICATION { } do { /* * Get all the instances of Application class and start adding to the * XML Document. */ appList = getInstances("Application")? LOG, NEXT; foreach app (appList) { appObj = object("Application", app)? LOG, IGNORE; builder->addObject(app, "Application"); builder->addAttribute(app, "DisplayName"); /* * Get the Host object that this Application is HostedBy, * and add it to the document. */ hostObj = appObj->HostedBy; builder->addRelationship("HostedBy"); builder->addObject(hostObj->Name, hostObj->CreationClassName); builder->addObjectClosing(); builder->addRelationshipClosing(); /* * Get all the Transaction objects that these Applications Produce and * Consume, and export them to the XML Document also. */ builder->addRelationship("Produces"); foreach trans (appObj->Produces) { builder->addObjectClosing(); } builder->addRelationshipClosing(); builder->addRelationship("Consumes"); foreach trans (appObj->Consumes) { builder->addObject(trans->Name, trans->CreationClassName); builder->addObjectClosing(); } builder->addRelationshipClosing(); builder->addObjectClosing(); } }