vCenter Orchestrator Developer's Guide vCenter Orchestrator 4.0.1 This document supports the version of each product listed and supports all subsequent versions until the document is replaced by a new edition. To check for more recent editions of this document, see http://www.vmware.com/support/pubs.
vCenter Orchestrator Developer's Guide You can find the most up-to-date technical documentation on the VMware Web site at: http://www.vmware.com/support/ The VMware Web site also provides the latest product updates. If you have comments about this documentation, submit your feedback to: docfeedback@vmware.com Copyright © 2009, 2010 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws.
Contents Updated Information 7 About This Book 9 1 Introduction to VMware vCenter Orchestrator 11 Key Features of the Orchestrator Platform 11 Orchestrator User Roles and Related Tasks 12 Orchestrator Architecture 13 2 Developing Workflows 15 Principal Phases in the Workflow Development Process 16 Accessing the Orchestrator Client 17 Testing Workflows During Development 17 Workflow Editor 17 Provide General Workflow Information 20 Defining Attributes and Parameters 21 Workflow Schema 23 Obtaining Input
vCenter Orchestrator Developer's Guide 5 Creating Resource Elements 131 View a Resource Element 131 Import an External Object to Use as a Resource Element 132 Edit the Resource Element Information and Access Rights 132 Save a Resource Element to a File 133 Update a Resource Element 133 Add a Resource Element to a Workflow 133 Add a Resource Element to a Web View 134 6 Creating Packages 137 Create a Package 137 Set User Permissions on a Package 138 7 Developing Plug-Ins 141 Overview of Plug-Ins 141 Con
Contents SSH Workflow Name Changes 339 vCenter Server Workflow Name Changes 339 XML Workflow Name Changes 342 Index 343 VMware, Inc.
vCenter Orchestrator Developer's Guide 6 VMware, Inc.
Updated Information This VMware vCenter Orchestrator Developer's Guide is updated with each release of the product or when necessary. This table provides the update history of the VMware vCenter Orchestrator Developer's Guide. Revision Description EN-000228-03 n n n n n n EN-000228-02 n n n EN-000228-01 n n n n n n n n n VMware, Inc.
vCenter Orchestrator Developer's Guide Revision Description EN-000228-00 Updated for the release of Orchestrator 4.0.1 with the following new information: n n n n n EN-000129-01 n n EN-000129-00 8 New procedure, “Edit a Workflow from the Standard Library,” on page 18.
About This Book The VMware vCenter Orchestrator Developer's Guide provides information and instructions about how to use the VMware vCenter Orchestrator platform to develop process-automation applications for virtual environments. Intended Audience This document is intended for developers who want to develop applications using the Orchestrator platform. Specifically, this document is intended for the following types of developer.
vCenter Orchestrator Developer's Guide Technical Support and Education Resources The following technical support resources are available to you. To access the current version of this book and other books, go to http://www.vmware.com/support/pubs. Online and Telephone Support To use online support to submit technical support requests, view your product and contract information, and register your products, go to http://www.vmware.com/support.
Introduction to VMware vCenter Orchestrator 1 VMware vCenter Orchestrator is a development and process-automation platform that provides a library of extensible workflows to allow you to create and run automated, configurable processes to manage the VMware vCenter infrastructure. Orchestrator exposes every operation in the vCenter Server API, allowing you to integrate all of these operations into your automated processes.
vCenter Orchestrator Developer's Guide Scripting engine Workflow engine The Mozilla Rhino JavaScript engine provides a way to create new building blocks for Orchestrator Platform. The scripting engine is enhanced with basic version control, variable type checking, name space management and exception handling. It can be used in the following building blocks: n Actions n Workflows n Policies The workflow engine allows you to capture business processes.
Chapter 1 Introduction to VMware vCenter Orchestrator n Running workflows and scheduling tasks n Managing version control of imported elements Users in this role are granted access to only the Web front end. They can run and schedule workflows and policies. End Users Orchestrator Architecture Orchestrator contains a workflow library and workflow engine to allow you to create and run workflows that automate orchestration processes.
vCenter Orchestrator Developer's Guide 14 VMware, Inc.
Developing Workflows 2 You develop workflows in the Orchestrator client interface. Workflow development involves using the workflow editor, the built-in Mozilla Rhino JavaScript scripting engine, and the Orchestrator and vCenter Server APIs. n Principal Phases in the Workflow Development Process on page 16 The process for developing a workflow involves a series of phases. n Accessing the Orchestrator Client on page 17 By default, all Orchestrator users can access the Orchestrator client.
vCenter Orchestrator Developer's Guide n Calling Workflows Within Workflows on page 52 Workflows can call on other workflows during their run. A workflow can start another workflow either because it requires the result of the other workflow as an input parameter for its own run, or it can start a workflow and let it continue its own run independently. Workflows can also start a workflow at a given time in the future, or start multiple workflows simultaneously.
Chapter 2 Developing Workflows Accessing the Orchestrator Client By default, all Orchestrator users can access the Orchestrator client. However, for security reasons, the Orchestrator administrator can limit access to the Orchestrator client to members of the Orchestrator administrator LDAP group. If the Orchestrator administrator has limited the access to the client and if you are not a member of the Orchestrator administrator group, you cannot log in to the Orchestrator client.
vCenter Orchestrator Developer's Guide Create a Workflow You can create workflows in the workflows hierarchical list in the Orchestrator client interface. Procedure 1 In the Orchestrator client, click the Workflows view. 2 (Optional) Right-click the root of the workflows hierarchical list, or a folder in the list, and select Add category to create a new workflow folder. 3 (Optional) Name the new folder. 4 Right-click the new folder or an existing folder and select New workflow.
Chapter 2 Developing Workflows 7 Click the Workflow category value to search for a folder in which to save the duplicate workflow. Select the folder you created in Step 2. If you did not create a folder, select a folder that is not in the library of standard workflows. 8 Click Yes or No to copy the workflow version history to the duplicate. Option Description Yes The version history of the original workflow is replicated in the duplicate. No The version of the duplicate reverts to 0.0.0.
vCenter Orchestrator Developer's Guide Table 2-1. Workflow Editor Tabs (Continued) Tab Description Events Provides information about each individual event that occurs when the workflow runs. This information includes a description of the event, the user who triggered it, the type and origin of the event, and the time and date when it occurred. Permissions Sets the permissions to interact with the workflow for users or groups of users.
Chapter 2 Developing Workflows Defining Attributes and Parameters After you create a workflow, you must determine the workflow's global attributes and input and output parameters. Workflow attributes are data that workflows process internally. Workflow input parameters are data that comes from an outside source, such as a user or another workflow. Workflow output parameters are data that the workflow delivers when it ends.
vCenter Orchestrator Developer's Guide 7 If the attribute is a constant rather than a variable, click the check box to the left of the attribute name to make its value read-only. The lock icon ( 8 ) identifies the column of read-only check boxes. (Optional) If you decide that the attribute should be an input or output parameter rather than an attribute, right-click the attribute and select Move as INPUT/OUTPUT parameter to change the attribute into a parameter.
Chapter 2 Developing Workflows You cannot use the following keywords in workflow attribute and parameter names. Table 2-2.
vCenter Orchestrator Developer's Guide View Workflow Schema You view a workflow schema in the Schema tab for that workflow in the Orchestrator client. Procedure 1 Navigate to a workflow in the workflow hierarchical list. 2 Click the workflow. Information about that workflow appears in the right pane. 3 Select the Schema tab in the right pane. You see the graphical representation of the workflow. Building a Workflow in the Workflow Schema Workflow schemas consist of a sequence of schema elements.
Chapter 2 Developing Workflows 7 Drag schema elements from the Basic, Log, or Network menus to the workflow schema. You can edit the names of the elements in the Basic, Log, or Network menus. You cannot edit their scripting. 8 Drag schema elements from the Action & Workflow menu to the workflow schema. When you drag actions or workflows to the workflow schema, a dialog box appears that allows you to search for the action or workflow to insert.
vCenter Orchestrator Developer's Guide Table 2-3. Schema Elements and Icons (Continued) Schema Element Name 26 Description Icon Icon Location in Workflow editor Decision Boolean function. Decision elements take one input parameter and return either true or false. The type of decision the element makes depends on the type of the input parameter. Decision elements allow the workflow to branch into different directions, depending on the input parameter the decision element receives.
Chapter 2 Developing Workflows Table 2-3. Schema Elements and Icons (Continued) Schema Element Name Description Icon Icon Location in Workflow editor Thrown Exception Creates an exception and stops the workflow. Multiple occurrences of this element can be present in the workflow schema. Exception elements have one input parameter, which can only be of the String type, and have no output parameter. When a workflow reaches an Exception element, the workflow token enters the failed state.
vCenter Orchestrator Developer's Guide Table 2-3. Schema Elements and Icons (Continued) Schema Element Name Description Icon Icon Location in Workflow editor Asynchronous Workflows Starts a workflow asynchronously. When a workflow reaches an asynchronous workflow element, it starts that workflow and continues its own run. The original workflow does not wait for the called workflow to finish before continuing.
Chapter 2 Developing Workflows Schema Element Properties Tabs You access a schema element's properties by clicking on a schema element that you have dragged into the workflow schema. The element properties appear in tabs at the bottom of the workflow editor. Different element types present different properties tabs, as shown in Table 2-4. Table 2-4.
vCenter Orchestrator Developer's Guide Table 2-4. Properties Tabs per Schema Element (Continued) Schema Element Property Tab Description Applies to Schema Element Type Info The schema element's general properties and description. The information the Info tab displays depends on the type of schema element.
Chapter 2 Developing Workflows Logical Flow of a Workflow The logical flow of a workflow is the progression of the workflow from one element to the next in the schema as the workflow runs. You define the logical flow of the workflow by linking elements in the schema. The standard path is the path that the workflow takes through the logical flow if all elements run normally. The exception path is the path that the workflow takes through the logical flow if an element does not run normally.
vCenter Orchestrator Developer's Guide n n true decision result, exception. a The decision element returns true. b The SnapVMsInResourcePool workflow encounters an error. c The workflow returns an exception and stops in the failed state. false decision result, exception. a The decision element returns false. b The operation the Scriptable task element defines encounters an error. c The workflow returns an exception and stops in the failed state.
Chapter 2 Developing Workflows What to do next The elements are joined, but you have not defined the data flow. You must define the IN and OUT bindings to bind incoming and outgoing data to workflow attributes. Data Flow of a Workflow The data flow of a workflow is the manner in which workflow element input and output parameters bind to workflow attributes as each element of the workflow runs. You define the data flow of a workflow by using schema element bindings.
vCenter Orchestrator Developer's Guide Element Bindings You must bind all workflow element input and output parameters to workflow attributes. Bindings set data in the elements, and define the output and exception behavior of the elements. Links define the logical flow of the workflow, whereas bindings define the data flow. To set data in an element, generate ouput parameters from the element after processing, and handle any errors that might occur when the element runs, you must set the element binding.
Chapter 2 Developing Workflows Procedure 1 Click an element on which to set the bindings. The element is highlighted and the element attributes tabs appear at the bottom of the Schema tab. 2 Click the IN tab. The contents of the IN tab depend on the type of element you selected. 3 n If you selected a predefined task, workflow, or action element, the IN tab lists the possible local input parameters for that type of element, but the binding is not set.
vCenter Orchestrator Developer's Guide Decisions Workflows can implement decision functions that define different courses of action according to a Boolean true or false statement. Decisions are forks in the workflow. Workflow decisions are made according to inputs provided by you, by other workflows, by applications, or by the environment in which the workflow is running. The value of the input parameter that the decision element receives determines which branch of the fork the workflow takes.
Chapter 2 Developing Workflows 6 Left-click inside the right side of the decision element, hold down the left mouse button, and move the pointer to the target element. A dotted red arrow appears between the two elements and the target element turns green. 7 Release the left mouse button. The dotted red arrow remains between the two elements. You have defined the path the workflow takes when the decision element receives unexpected input.
vCenter Orchestrator Developer's Guide Exception Handling Exception handling catches any errors that occur when a schema element runs. Exception handling defines how the schema element behaves when the error occurs. All elements in a workflow, except for decisions and start and end elements, contain a specific output parameter type that serves only for handling exceptions. If an element encounters an error during its run, it can send an error signal to an exception handler.
Chapter 2 Developing Workflows 11 Click the OUT tab for the exception handling element in the schema element properties tabs at the bottom of the Schema tab 12 Define the behavior of the exception handling element. n Right-click in the OUT tab and select Bind to workflow parameter/attribute to select an output parameter for the exception handling element to generate. n Click the Scripting tab and use JavaScript to define the behavior of the exception handling element.
vCenter Orchestrator Developer's Guide Defining Presentation Display Groups Each input step can have nodes of its own called display groups. The display groups define the order in which parameter input text boxes appear within their section of the input parameters dialog box. You can define display groups independently of input steps.
Chapter 2 Developing Workflows Setting Parameter Properties Orchestrator allows you to define properties to qualify the input parameter values that users provide when they run workflows. The parameter properties you define impose limits on the types and values of the input parameters the users provide. Every parameter can have several properties. You define an input parameter's properties in the Properties tab for a given parameter in the Presentation tab.
vCenter Orchestrator Developer's Guide 7 If you set the property value to static, you select a property value according to the type of parameter for which you are setting the properties. 8 If you set the property value to dynamic, you define the function to obtain the parameter property value by using an OGNL expression. The workflow editor provides help writing the OGNL expression.
Chapter 2 Developing Workflows Table 2-5. Workflow Input Parameter Properties (Continued) Parameter Property Parameter Type Description Show parameter input Any Shows or hides a parameter text box in the presentation dialog box, depending on the value of a preceding Boolean parameter. Hide parameter input Any Similar to Show parameter input, but takes the negative value of a previous Boolean parameter.
vCenter Orchestrator Developer's Guide Table 2-6. Predefined OGNL Constant Values (Continued) Constant Value Description ${#__date} Current date, with time set to 00:00:00 ${#__timezone} Current timezone Requesting User Interactions While a Workflow Runs A workflow can sometimes require additional input parameters from an outside source while it runs. These input parameters can come from another application or workflow, or the user can provide them directly.
Chapter 2 Developing Workflows 8 Create the Input Parameters Dialog Box for the User Interaction on page 51 Users provide input parameters during a workflow run in an input parameters dialog box, in the same way that they provide input parameters when a workflow first starts. 9 Respond to a Request for a User Interaction on page 52 Workflows that require interactions from users during their run suspend their run either until the user provides the required information or until the workflow times out.
vCenter Orchestrator Developer's Guide 4 (Optional) Select NULL to allow all users to respond to the request for user interaction. 5 To limit the permission to respond to a specific user or user group, click Create parameter/attribute in workflow. The Parameter information dialog box opens. 6 Name the parameter. 7 Select Create workflow ATTRIBUTE with the same name to create the LdapGroup attribute in the workflow. 8 Click Not set for the parameter value to open the LdapGroup selection box.
Chapter 2 Developing Workflows 5 Click Create parameter/attribute in workflow to set the workflow to fail after a timeout period. The Parameter information dialog box opens. 6 Name the parameter. 7 Select Create workflow ATTRIBUTE with the same name to create a Date attribute in the workflow. 8 Click Not set for the parameter Value. 9 Use the calendar to select an absolute date and time until which the workflow waits for the user to respond. 10 Click OK to close the calendar.
vCenter Orchestrator Developer's Guide 8 Define a function to calculate and generate a Date object named timerDate in the scripting pad in the Scripting tab. For example, you can create a Date object by implementing the following JavaScript function, in which the timeout period is a relative delay in milliseconds. timerDate = new Date(); System.log( "Current date : '" + timerDate + "'" ); timerDate.setTime( timerDate.getTime() + (86400 * 1000) ); System.
Chapter 2 Developing Workflows Define the External Inputs for a User Interaction You specify the information that users must provide during a workflow run as the input parameters of a user interaction. When a workflow reaches a user interaction element, it waits until a user provides the information that the user interaction requires as its input parameters. Prerequisites n Add a user interaction element to the workflow schema. n Set the security.group attribute for the user interaction.
vCenter Orchestrator Developer's Guide Prerequisites n Add a user interaction element to the workflow schema. n Set the security.group and timer.date attributes for the user interaction. n Define the external input parameters of the user interaction. Procedure 1 Click the User Interaction element in the workflow schema. 2 Click the Exception tab. 3 Click Not set for the output exception binding.
Chapter 2 Developing Workflows Create the Input Parameters Dialog Box for the User Interaction Users provide input parameters during a workflow run in an input parameters dialog box, in the same way that they provide input parameters when a workflow first starts. You create the layout of the dialog box in the Presentation tab of the user interaction element, not in the Presentation tab for the whole workflow.
vCenter Orchestrator Developer's Guide Respond to a Request for a User Interaction Workflows that require interactions from users during their run suspend their run either until the user provides the required information or until the workflow times out. Workflows that require user interactions define which users can provide the required information and direct the requests for interaction. Prerequisites Log in to the Orchestrator client. At least one workflow in Waiting for User Interaction state.
Chapter 2 Developing Workflows n Schedule a Workflow on page 56 You can call a workflow from a workflow and schedule it to start at a later time and date. n Call Several Workflows Simultaneously on page 57 Calling several workflows simultaneously runs the called workflows synchronously as part of the run of the calling workflow. The calling workflow waits for all of the called workflows to complete before it continues.
vCenter Orchestrator Developer's Guide Scheduled workflows only run once. You can schedule a workflow to run recurrently by calling the Workflow.scheduleRecurrently method in a scriptable task element in a synchronous workflow. Nested Workflows A workflow can start several workflows simultaneously by nesting several workflows in a single schema element.
Chapter 2 Developing Workflows Call a Workflow Synchronously Calling a workflow synchronously runs the called workflow as a part of the run of the calling workflow. The calling workflow can use the called workflow's output parameters as input parameters when it runs its subsequent schema elements. You call workflows synchronously from another workflow by using the Workflow element.
vCenter Orchestrator Developer's Guide Procedure 1 Drag an Asynchronous Workflow element from the Action & Workflow menu to the appropriate position in the workflow schema. The Choose workflow selection dialog box appears. 2 Search for and select the desired workflow from the list and click OK. 3 Link the Asynchronous Workflow element to the elements that precede and follow it in the workflow schema.
Chapter 2 Developing Workflows 9 Click Not set for Value to set the parameter value. 10 Use the calendar that appears to set the date and time to start the scheduled workflow and click OK. 11 Bind the remaining input parameters to the scheduled workflow in the IN tab of the scheduled workflow element. 12 Bind the required output parameters to the Task object in the OUT tab of the scheduled workflow element. 13 Define the exception behavior of the scheduled workflow element in the Exceptions tab.
vCenter Orchestrator Developer's Guide 9 Define the credentials with which to access the remote server. n n Select Inherit to use the same credentials as the user who runs the calling workflow. Select Dynamic and click Not set to select a set of dynamic credentials that a parameter of the credentials type defines elsewhere in the workflow. n Select Static and click Not set to enter the credentials directly.
Chapter 2 Developing Workflows How to run a workflow in a scripted For loop is demonstrated in “Workflow Scripting Examples,” on page 129. Implement the Start Workflows in a Series and Start Workflows in Parallel Workflows You can use the Start workflows in a series and Start workflows in parallel workflows to run a workflow on a selection of objects. You cannot run the Start workflows in a series and Start workflows in parallel workflows directly.
vCenter Orchestrator Developer's Guide 7 Bind the wf input of the Start workflows in a series or Start workflows in parallel workflow to the workflow to run on the objects. For example, to remove any snapshots of all the virtual machines returned by the getAllVirtualMachinesByFolder action, select the Remove all snapshots workflow.
Chapter 2 Developing Workflows Procedure 1 Drag a Scriptable Task element from the Generic menu to the schema of a workflow, above the element that requires the relative Date object for its timeout.date attribute. 2 Link the Scriptable Task element to the elements that precede and follow it in the workflow schema. 3 Click the Scriptable Task element to show its properties tabs in the bottom half of the Schema tab.
vCenter Orchestrator Developer's Guide Procedure 1 Drag a Waiting Timer element from the Generic menu to the position in the workflow schema at which to suspend the workflow's run. 2 Link the Waiting Timer element to the elements that precede and follow it in the workflow schema. If you implement a scriptable task to calculate the time and date, this element must precede the Waiting Timer element. 3 Click the Waiting Timer element to show its properties tabs in the bottom half of the Schema tab.
Chapter 2 Developing Workflows You create a Trigger object in a JavaScript function in a Scriptable Task element. This Scriptable Task element can be part of the trigger-based long-running workflow that waits for the trigger event. Alternatively, it can be part of a different workflow that provides input parameters to the trigger-based long-running workflow. The trigger function must implement the createEndOfTaskTrigger() method from the Orchestrator API.
vCenter Orchestrator Developer's Guide What to do next You must bind this trigger event to a Waiting Event element in a trigger-based long-running workflow. Create a Trigger-Based Long-Running Workflow If you know a workflow will have to wait for a response from an outside source during its run, but do not know how long that wait will last, you can implement it as a trigger-based long-running workflow. A triggerbased long-running workflow waits for a defined trigger event to occur before resuming.
Chapter 2 Developing Workflows Configuration Elements A configuration element is a list of attributes you can use to configure constants across a whole Orchestrator server deployment. All the workflows, actions, policies, and Web views running in a particular Orchestrator server can use the attributes you set in a configuration element.
vCenter Orchestrator Developer's Guide 15 Check the appropriate check boxes to set the access rights for the selected user group. You can set the following permissions on the configuration element. 16 Permission Description View Users can view the configuration element, but cannot view the schemas or scripting. Inspect Users can view the configuration element, including the schemas and scripting. Execute Users can run the elements in the configuration element.
Chapter 2 Developing Workflows Procedure 1 Click the Permissions tab. 2 Click the Add access rights link to define permissions for a new user or user group. 3 Search for a user or user group. The search results show all of the users and user groups from the Orchestrator LDAP server that match the search. 4 Select a user or user group and click OK. 5 Right-click the user and select Add access rights. 6 Check the appropriate check boxes to set the level of permissions for this user and click OK.
vCenter Orchestrator Developer's Guide 5 Right-click the workflow and select Edit to open the workflow editor. 6 Click the Schema tab. 7 Click the Validate button in the Schema tab toolbar. If the workflow is valid, a confirmation message appears. If the workflow is invalid, a list of errors appears. 8 If the workflow is invalid, click on an error message. The validation tool highlights the schema element in which the error occurs by adding a red icon to it.
Chapter 2 Developing Workflows Run a Workflow You can perform automated operations in vCenter Server by running workflows from the standard library or workflows that you create. For example, you can create a virtual machine by running the Create simple virtual machine workflow. Prerequisites You must have configured the vCenter plug-in. For details, see vCenter Orchestrator Installation and Configuration Guide. Procedure 1 Click the Workflows view in the Orchestrator client.
vCenter Orchestrator Developer's Guide 9 Navigate through the vCenter Server infrastructure hierarchy to the resource pool you defined. If the virtual machine does not appear in the list, click the refresh button to reload the inventory. The orchestrator-test virtual machine is present in the resource pool. 10 (Optional) Right-click the orchestrator-test virtual machine in the Inventory view to see a contextual list of the workflows that you can run on the orchestrator-test virtual machine.
Chapter 2 Developing Workflows 3 Create the Simple Workflow Example Schema on page 73 You create a workflow schema in the Schema tab of the workflow editor. The workflow schema contains the elements that the workflow runs. 4 Link the Simple Workflow Example Elements on page 75 You link a workflow's elements in the Schema tab of the workflow editor. The linking defines the flow of data through the workflow.
vCenter Orchestrator Developer's Guide Create the Simple Workflow Example The first step in the workflow development process is to create the workflow. Prerequisites The following components are installed and configured on the system. n vCenter Server, controlling some virtual machines, at least one of which is powered off n Access to an SMTP server n A valid email address For information about how to install and configure vCenter, see the ESX and vCenter Server Installation Guide.
Chapter 2 Developing Workflows Define the Simple Workflow Example Parameters You define workflow attributes and parameters in the workflow editor. Prerequisites You must have created the Start VM and Send Email workflow, and opened it for editing in the workflow editor. Procedure 1 Click the Inputs tab in the workflow editor. 2 Right-click in the Inputs tab and select Add Parameter. A parameter named arg_in_0 appears in the Inputs tab. 3 Click arg_in_0.
vCenter Orchestrator Developer's Guide 6 Type start in the Search text box. 7 Select the startVM action and click Select. 8 Drag the following action elements into the schema, one beneath the other under the startVM action element. vim3WaitTaskEnd Suspends the workflow run and polls an ongoing vCenter Server task at regular intervals, until that task is finished.
Chapter 2 Developing Workflows Link the Simple Workflow Example Elements You link a workflow's elements in the Schema tab of the workflow editor. The linking defines the flow of data through the workflow. Prerequisites You must have created the Start VM and Send Email workflow, defined its parameters, and laid out its schema. Procedure 1 Click the connector tool button in the toolbar at the top of the Schema tab in the workflow editor.
vCenter Orchestrator Developer's Guide Table 2-7. Simple Workflow Example Links (Continued) 4 Click Link to Type of Arrow Description Middle of Send Email scriptable task element End element Black Normal workflow progression Middle of Send Email Failed scriptable task element End element Black Normal workflow progression Click Save at the bottom of the workflow editor Schema tab. Figure 2-4 shows what the linked elements of the Start VM and Send Email workflow should look like. Figure 2-4.
Chapter 2 Developing Workflows 5 Click Color in the Info tab at the bottom of the workflow editor and select the background color. 6 Repeat the preceding steps to highlight other zones in the workflow. n Place a note over the vertical sequence of elements from the VM powered on? decision element to the OK element. Add the description Start VM path. n Place a note over the startVM failed, both Timeout scriptable task elements and the Send Email Failed scriptable task element.
vCenter Orchestrator Developer's Guide What to do next You must define the bindings for the other elements in the workflow. Bind the Simple Workflow Example Action Elements You bind a workflow's elements together in the Schema tab of the workflow editor. Bindings define how the action elements process input parameters and generate output parameters.
Chapter 2 Developing Workflows 12 Repeat the preceding steps to bind the input and output parameters to the vim3WaitTaskEnd and vim3WaitToolsStarted action elements. “Simple Workflow Example Action Element Bindings,” on page 79 lists the bindings for the vim3WaitTaskEnd and vim3WaitToolsStarted action elements. 13 Click Save at the bottom of the workflow editor's Schema tab. The action elements' input and output parameters are bound to the appropriate parameter types and values.
vCenter Orchestrator Developer's Guide Table 2-8. Binding Values of the vim3WaitTaskEnd Action (Continued) Parameter Name Binding Type Bind to Existing or Create Parameter? pollRate IN Create Binding Values n Local Parameter: pollRate n Source parameter: pollRate[attribute] n Type: number Value: 2 n actionResult OUT Create n Description: Polling rate in seconds at which vim3WaitTaskEnd checks the advancement of the vCenter server task.
Chapter 2 Developing Workflows Table 2-9. Binding Values of the vim3WaitToolsStarted Action Parameter Name Binding Type Bind to Existing or Create Parameter? vm IN Automatic binding pollingRate IN Bind Binding Values n Local Parameter: vm n Source parameter: vm[inparameter] n Type: VC:VirtualMachine n n Value: Not editable, variable is not a workflow attribute. Description: The virtual machine to start.
vCenter Orchestrator Developer's Guide 3 Click the IN tab in the schema element properties pane at the bottom of the Schema tab. Because this is a custom scriptable task element, no properties are predefined for you. 4 Right-click in the IN tab and select Bind to workflow parameter/attribute. 5 Select vm from the proposed list of parameters. 6 Leave the OUT and Exception tabs blank. This element does not generate an output parameter or exception. 7 Click the Scripting tab.
Chapter 2 Developing Workflows Table 2-10. Bindings of the Start VM Failed Scriptable Task Element Parameter Name Binding Type Bind to Existing or Create Parameter? vm IN Bind errorCode IN Create Binding Values n Local Parameter: vm n Source parameter: vm[inparameter] n Type: VC:VirtualMachine n Description: The virtual machine to power on. n Local Parameter: errorCode n Source parameter: errorCode[attribute] n Type: string Description: Catch any exceptions while powering on a VM.
vCenter Orchestrator Developer's Guide Table 2-11. Bindings of the Timeout 1 Scriptable Task Element Parameter Name Binding Type Bind to Existing or Create Parameter? vm IN Bind errorCode IN Bind Binding Values n Local Parameter: vm n Source parameter: vm[inparameter] n Type: VC:VirtualMachine n Description: The virtual machine to start. n Local Parameter: errorCode n Source parameter: errorCode[attribute] n Type: string Description: Catch any exceptions while powering on a VM.
Chapter 2 Developing Workflows Table 2-12. Bindings of the Timeout 2 Scriptable Task Element Parameter Name Binding Type Bind to Existing or Create Parameter? vm IN Bind errorCode IN Bind Binding Values n Local Parameter: vm n Source parameter: vm[inparameter] n Type: VC:VirtualMachine n Description: The virtual machine to power on. n Local Parameter: errorCode n Source parameter: errorCode[attribute] n Type: string Description: Catch any exceptions while powering on a VM.
vCenter Orchestrator Developer's Guide The OK scriptable task element requires the following scripted function. body = "The VM '"+vm.name+"' has started successfully and is ready for use"; //Writes the following event in the vCO database Server.log(body); Send Email Failed Scriptable Task Element The Send Email Failed scriptable task element receives notice that the sending of the email failed, and writes the event in the Orchestrator log.
Chapter 2 Developing Workflows Table 2-15. Bindings of the Send Email Scriptable Task Element Parameter Name Binding Type Bind to Existing or Create Parameter? vm IN Bind toAddress IN Bind Binding Values n Local Parameter: vm n Source parameter: vm[inparameter] n Type: VC:VirtualMachine n Description: The virtual machine to power on.
vCenter Orchestrator Developer's Guide //Apply the method that sends the email message myEmailMessage.sendMessage(); System.log("Sent email to '"+toAddress+"'"); Define the Simple Example Workflow Exception Bindings You define exception bindings in the Schema tab in the workflow editor. Exception bindings define how elements process errors. The following elements in the workflow return exceptions: startVM, vim3WaitTaskEnd, Send Email, and vim3WaitToolsStarted.
Chapter 2 Developing Workflows Procedure 1 Click the General tab at the top of the workflow editor. Under Attributes is a list of all the attributes you defined, with check boxes next to each attribute. When you check these checkboxes, you set attributes as read-only.
vCenter Orchestrator Developer's Guide 10 Select list from the list of possible values. 11 Click the (string)toAddress parameter in the top half of the Presentation tab. 12 Add a description in the Description tab in the bottom half of the screen. For example, type The email address of the person to notify. 13 Click the Properties tab for (string)toAddress. 14 Right-click the Properties tab and select Add Property > Mandatory input. 15 Set the value of the Mandatory input property to Yes.
Chapter 2 Developing Workflows 5 Provide a description of the Virtual Machine display group in the Description text box in the General tab at the bottom of the Presentation tab. For example, type Select the virtual machine to start. The text you enter here appears as a prompt in the input parameter dialog box when users start the workflow. 6 Drag the (VC:VirtualMachine)vm parameter under the Virtual Machine display group.
vCenter Orchestrator Developer's Guide 8 Click Submit to start the workflow. A workflow token appears under the Start VM and Send Email workflow. 9 Click the workflow token to follow the progress of the workflow as it runs. If the workflow ran successfully, the virtual machine you identified is in the powered-on state, and the email recipient you defined receives a confirmation email.
Chapter 2 Developing Workflows 6 Create the Complex Workflow Example Zones on page 98 Optionally, you can highlight different zones of the workflow by adding workflow notes. Creating different workflow zones helps to make complicated workflow schema easier to read and understand. 7 Define the Complex Workflow Example Bindings on page 99 You bind a workflow's elements together in the Schema tab of the workflow editor. Bindings define the data flow of the workflow.
vCenter Orchestrator Developer's Guide Define the Complex Workflow Example Input Parameters You define workflow input parameters in the workflow editor. The input parameters provide data for the workflow to process. Prerequisites You must have created the Take a Snapshot of All Virtual Machines in a Resource Pool workflow, and opened it for editing in the workflow editor. Procedure 1 Click the Inputs tab in the workflow editor. 2 Define the following input parameter.
Chapter 2 Developing Workflows 9 Add the following description of the action in the General tab. This action returns an array containing the disk modes of all disks on a VM. The elements in the array each have one of the following string values: - persistent - independent-persistent - nonpersistent - independent-nonpersistent Legacy values: - undoable - append 10 Click the Scripting tab.
vCenter Orchestrator Developer's Guide 3 Add the following schema elements to the workflow schema. Table 2-16.
Chapter 2 Developing Workflows Procedure 1 Click the connector tool button in the toolbar at the top of the Schema tab in the workflow editor. 2 Create the following links between the elements in the schema. Table 2-17.
vCenter Orchestrator Developer's Guide Create the Complex Workflow Example Zones Optionally, you can highlight different zones of the workflow by adding workflow notes. Creating different workflow zones helps to make complicated workflow schema easier to read and understand. Prerequisites You must have created the workflow, created its schema, and linked the schema elements . Procedure 1 2 Create the following workflow zones by using workflow notes.
Chapter 2 Developing Workflows Define the Complex Workflow Example Bindings You bind a workflow's elements together in the Schema tab of the workflow editor. Bindings define the data flow of the workflow. You also bind the scriptable task elements to their JavaScript functions. Prerequisites You must already have created the Take a Snapshot of All Virtual Machines in a Resource Pool workflow, defined its input parameter, created its schema, and linked the schema elements together.
vCenter Orchestrator Developer's Guide Table 2-18.
Chapter 2 Developing Workflows Table 2-19. Bindings of the VMs to Process? Decision Element Parameter Name Binding Type Bind to Existing or Create Parameter? numberOfVMs Decision Bind Binding Values n Source parameter: numberOfVMs[attribute] n Decision statement: Greater than Value: 0.
vCenter Orchestrator Developer's Guide Table 2-21. Bindings of the Remaining VMs? Custom Decision Element Parameter Name Binding Type Bind to Existing or Create Parameter? numberOfVMs IN Bind Binding Values n Source parameter: numberOfVMs[attribute] n n Decision statement: Greater than Value: 0.
Chapter 2 Developing Workflows Create Snapshot? Custom Decision Element The Create Snapshot? custom decision element determines whether to take snapshots of virtual machines, depending on the disk modes of the virtual machines. Table 2-23 shows the bindings that the Create Snapshot? custom decision element requires. Table 2-23.
vCenter Orchestrator Developer's Guide Table 2-24. Bindings of the Create a snapshot Workflow Element Parameter Name Binding Type Bind to Existing or Create Parameter? vm IN Bind name IN Create Binding Values n Local parameter: vm n Source parameter: vm[attribute] n Type: VC:VirtualMachine n Description: An active virtual machine of which to take a snapshot. n Local parameter: name n Source parameter: snapshotName[attribute] n Type: string Description: The name for this snapshot.
Chapter 2 Developing Workflows VM Snapshots Scriptable Task Element The VM Snapshots scriptable task element adds the snapshots to an array. Table 2-25 shows the bindings that the VM Snapshots scriptable task element requires. Table 2-25.
vCenter Orchestrator Developer's Guide Table 2-26.
Chapter 2 Developing Workflows Table 2-27.
vCenter Orchestrator Developer's Guide The Set Output scriptable task element performs the following scripted function. //Passes the value of the internal attribute to a workflow output parameter snapshotVmArrayOut = snapshotVmArray; Set the Complex Workflow Example Attribute Properties You set the attribute properties in the General tab in the workflow editor. Prerequisites You must have created the workflow, created and linked its schema, and defined the IN and OUT bindings for all elements.
Chapter 2 Developing Workflows 7 Click the Properties tab for (VC:ResourcePool)resourcePool. 8 Right-click the Properties tab and select Add Property > Mandatory input. 9 Right-click the Properties tab again and select Select value as from the list of proposed properties. When you set this property, you set how the user selects the value of the (VC:ResourcePool)resourcePool input parameter. 10 Drag the (VC:ResourcePool)resourcePool parameter under the Resource Pool display group.
vCenter Orchestrator Developer's Guide 110 VMware, Inc.
Developing Actions 3 Orchestrator provides libraries of predefined actions. Actions represent individual functions that you use as building blocks in workflows, Web views, and scripts. Actions are JavaScript functions. They take multiple input parameters and have a single return value. They can call on any object in the Orchestrator API, or on objects in any API that you import into Orchestrator by using a plug-in. When a workflow runs, an action takes its input parameters from the workflow's attributes.
vCenter Orchestrator Developer's Guide Procedure 1 Click Actions on the left side of the client interface. 2 Browse the libraries of actions by expanding the nodes of the actions hierarchical list. You can use the Actions view to view information about the actions in the libraries and create and edit actions. Components of the Actions View When you click an action in the actions hierarchical list, information about that action appears in the Orchestrator client's right pane.
Chapter 3 Developing Actions 5 Right-click the action and select Edit. 6 Click the Scripting tab. 7 To change the default return type, click the void link. 8 Add the action input parameters by clicking the arrow icon. 9 Write the action script. 10 Click Save and close. You created a custom action and added the action input parameters. What to do next You can use the new custom action in a workflow.
vCenter Orchestrator Developer's Guide n Do not write check points in actions. Workflows set a check point at the start and end of each element's run. n Avoid writing loops in an action. Create loops in the workflow instead. If the server restarts, a running workflow resumes at its last check point, at the start of an element.
4 Scripting Orchestrator uses JavaScript to create building blocks from which you create actions, workflow elements, and policies that access the APIs of the technologies that you plug into Orchestrator. Orchestrator uses the Mozilla Rhino 1.6 JavaScript engine as its scripting engine. The scripting engine provides variable type checking, name space management, automatic completion, and exception handling.
vCenter Orchestrator Developer's Guide Limitations of the Mozilla Rhino Implementation in Orchestrator Orchestrator implements the Mozilla Rhino 1.6 JavaScripting engine. However, the implementation of Rhino in Orchestrator presents some limitations. When writing scripts for workflows, you must consider the following limitations of the Mozilla Rhino implementation in Orchestrator. n When a workflow runs, the objects that pass from one workflow element to another are not Javascript objects.
Chapter 4 Scripting 5 Writing Scripts on page 119 The Orchestrator scripting engine helps you to write scripts. Automatic insertion of functions and automatic completion of lines of scripting accelerates the scripting process and minimizes the potential for writing errors in scripts. 6 Add Parameters to Scripts on page 120 The Orchestrator scripting engine helps you to import available parameters into scripts.
vCenter Orchestrator Developer's Guide What to do next Search the Orchestrator API using the API Explorer. Access the Orchestrator API Explorer Orchestrator provides an API Explorer to allow you to search the Orchestrator API and see the documentation of JavaScript objects that you can use in scripted elements. Procedure u You can access the API Explorer from either the Orchestrator client or from the Scripting tabs of the workflow, policy, and action editors.
Chapter 4 Scripting Table 4-1.
vCenter Orchestrator Developer's Guide 4 Copy and paste a method to add to the script. The scripting engine completes the method call, adding the required attributes. For example, if you copied the cloneVM() method from the com.vmware.library.vc.vm module, the scripting engine pastes the following code into the script. System.getModule("com.vmware.library.vc.vm").cloneVM(vm,folder,name,spec) The scripting engine highlights those parameters that you already defined in the element.
Chapter 4 Scripting Procedure 1 Move the cursor to the appropriate position in a script in the scripting pad of the Scripting tab. 2 Click the parameter link in the Scripting tab toolbar. Orchestrator inserts the parameter at the position of the cursor. 3 Insert a parameter with a null value into the script. If you pass null values to primitive types such as integers, Booleans, and Strings, the Orchestrator scripting API automatically sets the default value for this argument.
vCenter Orchestrator Developer's Guide Accessing Operating System Commands from JavaScript The Orchestrator API provides a scripting class, Command, that runs commands in the Orchestrator server host operating system. To prevent unauthorized access to the Orchestrator server host, by default, Orchestrator applications do not have permission to run the Command class. The Orchestrator administrator can allow access to the Command scripting class by setting the com.vmware.js.
Chapter 4 Scripting n Simple string exception type checking must use the following pattern. try { throw "VMwareNoSpaceLeftOnDatastore: Datastore 'myDatastore' has no space left" ; } catch ( e if (typeof(e)=="string" && e.indexOf("VMwareNoSpaceLeftOnDatastore:") == 0) ) { System.log("No space left on device") ; // Do something useful here } n Simple string exception type checking, must use the following pattern in scripted elements in workflows. if (typeof(errorCode)=="string" && errorCode.
vCenter Orchestrator Developer's Guide Basic Scripting Examples Workflow scripted elements, actions, and policies require basic scripting of common tasks. You can cut, paste, and adapt these examples into your scripted elements. Access XML Documents The following JavaScript example allows you to access XML documents from JavaScript by using the ECMAScript for XML (E4X) implementation in the Orchestrator JavaScript API.
Chapter 4 Scripting Setting and Obtaining Properties from a Hashtable The following JavaScript example sets properties in a hashtable and obtains the properties from the hashtable. In the following example, the key is always a String and the value is an object, a number, a Boolean, or a String. var table = new Properties() ; table.put("myKey",new Date()) ; // get the object back var myDate= table.get("myKey") ; System.
vCenter Orchestrator Developer's Guide Send an Email The following JavaScript example sends an email to the defined recipient, through an SMTP server, with the defined content. var message = new EmailMessage() ; message.smtpHost = "smtpHost" ; message.subject= "my subject" ; message.toAddress = "receiver@vmware.com" ; message.fromAddress = "sender@vmware.com" ; message.addMimePart("This is a simple message","text/html") ; message.
Chapter 4 Scripting Logging Scripting Examples Workflow scripted elements, actions, and policies require scripting of common logging tasks. You can cut, paste, and adapt these examples into your scripted elements. Persistent Logging The following JavaScript example creates persistent log entries. Server.log("This is a persistant message", "enter a long description here"); Server.warn("This is a persistant warning", "enter a long description here"); Server.
vCenter Orchestrator Developer's Guide // in a 'Data Object Type'. virtualMachineSnapshotRef is only the reference to the // 'Managed Object Type' not the object itself var virtualMachineSnapshotRef = virtualMachineSnapshotInfo.currentSnapshot; // Convert from ManagedObjectReference to a VimManagedObject. // The concrete class is VcVirtualMachineSnapshot. var virtualMachineSnapshot = VcPlugin.toManagedObject( virtualMachine, virtualMachineSnapshotRef); // The reverse operation, if required.
Chapter 4 Scripting } // Method to get all the host systems in a vCenter Server host var hostSystems = vimHost.getAllHostSystems(); if (hostSystems != null) { for (var j = 0; j < hostSystems.length; j++) { var hostSystem = hostSystems[j]; System.log("--- HostSystem '" + hostSystem.id + "'"); } } // Method to get all the virtual machines in a vCenter Server host var vms = vimHost.getAllVirtualMachines(); if (vms != null) { for (var j = 0; j < vms.length; j++) { var vm = vms[j]; System.log("--- VM '" + vm.
vCenter Orchestrator Developer's Guide if(allTokens[i].runningUserName == currentUser){ res.push(allTokens[i]); } } return res; Schedule a Workflow The following JavaScript example starts a workflow with a given set of properties, then schedules it to start one hour later. var workflowToLaunch = myWorkflow ; // create parameters var workflowParameters = new Properties() ; workflowParameters.put("name","John Doe") ; // change the task name workflowParameters.
Creating Resource Elements 5 Workflows and Web views can require as attributes objects that you create independently of Orchestrator. To use external objects as attributes in workflows or Web views, you import them into the Orchestrator server as resource elements. Objects that workflows and Web views can use as resource elements include image files, scripts, XML templates, HTML files, and so on.
vCenter Orchestrator Developer's Guide What to do next Import and edit a resource element. Import an External Object to Use as a Resource Element Workflows and Web views can require as attributes objects that you create independently of Orchestrator. To use external objects as attributes in workflows or Web views, you import them to the Orchestrator server as resource elements. Prerequisites An image file, script, XML template, HTML file, or other type of object to import.
Chapter 5 Creating Resource Elements What to do next Save the resource element to a file to update it, or add the resource element to a workflow or Web view. Save a Resource Element to a File You can save a resource element to a file on your local system. Saving the resource element as a file allows you to edit it. Prerequisites You must have a resource element in the Orchestrator server to save to a file. Procedure 1 Right-click the resource element and select Save to file.
vCenter Orchestrator Developer's Guide Procedure 1 Click the Workflows view in the Orchestrator client. 2 Expand the hierarchical tree viewer to navigate to the workflow that requires the resource element as an attribute. 3 Right-click the workflow and select Edit. 4 On the General tab, right-click in the attributes pane and select Add attribute. 5 Click the attribute name and type a new name for the attribute. 6 Click Type to set the attribute type.
Chapter 5 Creating Resource Elements 8 In the Select a type dialog box, type resource in the Filter box to search for an object type. Option Action Define a single resource element as an attribute Select ResourceElement from the list. Define a category that contains multiple resource elements as an attribute Select ResourceElementCategory from the list. 9 Click Value and type the name of the resource element or category of resource elements in the Search text box.
vCenter Orchestrator Developer's Guide 136 VMware, Inc.
Creating Packages 6 Packages are the vehicle for transporting content from one Orchestrator server to another. Packages can contain workflows, actions, policies, Web views, configurations, or resources. When you add an element to a package, Orchestrator checks for dependencies and adds any dependent elements to the package. For example, if you add a workflow that uses actions or other workflows, Orchestrator adds those actions and workflows to the package.
vCenter Orchestrator Developer's Guide Procedure 1 Click the Packages view in the Orchestrator client. 2 Click the menu button in the title bar of the Packages list and select Add package. 3 Name the new package and click OK. The syntax for package names is domain.your_company.folder.package_name. For example, com.vmware.myfolder.mypackage. 4 Right-click the package and select Edit. The package editor opens. 5 Add a description for the package in the General tab.
Chapter 6 Creating Packages 3 Search for a user or user group. The search results show all of the users and user groups from the Orchestrator LDAP server that match the search. 4 Select a user or user group and click OK. 5 Right-click the user and select Add access rights. 6 Check the appropriate check boxes to set the level of permissions for this user and click OK.
vCenter Orchestrator Developer's Guide 140 VMware, Inc.
Developing Plug-Ins 7 Plug-ins allow you to use Orchestrator to access and control external technologies and applications. Exposing an external technology in an Orchestrator plug-in allows you to incorporate objects and functions in workflows that access the objects and functions of that external technology. Plug-ins allow you to extend the Orchestrator scripting API with scripting types, classes, and methods that you can use in workflows to perform operations in the plugged-in technology.
vCenter Orchestrator Developer's Guide n Role of the vso.xml File on page 144 You use the vso.xml file to map the objects, classes, methods, and attributes of the plugged-in technology to Orchestrator inventory objects, scripting types, scripting classes, scripting methods, and attributes. The vso.xml file also defines the configuration and start-up behavior of the plug-in. n Roles of the Plug-In Adapter on page 144 The plug-in adapter is the entry point of the plug-in to the Orchestrator server.
Chapter 7 Developing Plug-Ins Plug-ins are composed of the following parts. Plug-In Module The plug-in itself, as defined by a collection of Java classes, a vso.xml file, and packages of the workflows and actions that interact with the objects that you access through the plug-in. The plug-in module is mandatory. Plug-In Adapter Defines the interface between the plugged-in technology and the Orchestrator server. The adapter is the point of entry of the plug-in to the orchestration platform.
vCenter Orchestrator Developer's Guide Role of the vso.xml File You use the vso.xml file to map the objects, classes, methods, and attributes of the plugged-in technology to Orchestrator inventory objects, scripting types, scripting classes, scripting methods, and attributes. The vso.xml file also defines the configuration and start-up behavior of the plug-in. The vso.xml file performs the following principal roles.
Chapter 7 Developing Plug-Ins technology, to allow Orchestrator to launch defined actions if certain events occur on the object, or if the object's values pass certain thresholds. Similarly, you can define PluginTrigger and PluginWatcher instances that define events that Wait Event elements in long-running workflows await. Sets the plug-in name You provide a name for the plug-in in the vso.xml file. The plug-in adapter gets this name from the vso.
vCenter Orchestrator Developer's Guide Role of Finder Objects Finder objects identify and locate specific instances of managed object types in the plugged-in technology. Orchestrator can modify and interact with objects that it finds in the plugged-in technology by running workflows on the finder objects. Every instance of a given managed object type in the plugged-in technology must have a unique identifier so that Orchestrator finder objects can find them.
Chapter 7 Developing Plug-Ins Role of Event Handlers Events are changes in the states or attributes of the objects that Orchestrator finds in the plugged-in technology. Orchestrator monitors events by implementing event handlers. Orchestrator plug-ins allow you to monitor events in a plugged-in technology in different ways. The Orchestrator plug-in API allows you to create the following types of event handlers to monitor events in a plugged-in technology.
vCenter Orchestrator Developer's Guide n Naming Plug-In Objects on page 149 You must provide a unique identifier for every object that the plug-in finds in the plugged-in technology. You define the object names in the elements and in the
Chapter 7 Developing Plug-Ins Figure 7-1. Format of the vso.
vCenter Orchestrator Developer's Guide Plug-In Object Naming Conventions You must follow Java class naming conventions when you name all objects in plug-ins. IMPORTANT Because of the way in which the workflow engine performs data serialization, do not use the following string sequences in object names. Using these character sequences in object identifiers causes the workflow engine to parse workflows incorrectly, which can cause unexpected behavior when you run the workflows.
Chapter 7 Developing Plug-Ins Table 7-2. Structure of the DAR Archive Folders Description plug-in_name\VSO-INF\ Contains the vso.xml file that defines the mapping of the objects in the plugged-in technology to Orchestrator objects. The VSO-INF folder and the vso.xml file are mandatory. plug-in_name\lib\ Contains the JAR files that contain the binaries of the plugged-in technology.
vCenter Orchestrator Developer's Guide 3 Components of the Solar System Application on page 154 The solar system application replicates a solar system and includes objects to represent stars, planets, and moons. The solar system application also defines operations that you can perform on these objects.
Chapter 7 Developing Plug-Ins 15 Install a Plug-In in the Orchestrator Server on page 211 After you create the plug-in DAR file, you must install it in the Orchestrator server. You install plug-ins in the Orchestrator configuration interface.
vCenter Orchestrator Developer's Guide You can install the solar system DAR file to experiment with the solar system plug-in in the Orchestrator client. Alternatively, you can examine the source files of the solar system application and solar system plug-in. You can modify the source files to adapt and extend the solar system application and solar system plug-in, and rebuild the DAR file to incorporate your modifications in the plug-in.
Chapter 7 Developing Plug-Ins CelestialBody.java Class The CelestialBody.java class is a serializable class that defines a generic celestial body, that can be a star, a planet, or a moon.
vCenter Orchestrator Developer's Guide Moon.java Class The Moon.java class extends CelestialBody to create moon objects.
Chapter 7 Developing Plug-Ins The SolarSystemRepository class defines the following constructor and methods: n SolarSystemRepository() constructor, to create a unique SolarSystemRepository instance and a SolarSystemEventHandler instance n getUniqueInstance(), to return a unique SolarSystemRepository instance n getStar(), to return the star of this solar system instance n setStar(), to set the star of this solar system instance n getAllPlanets(), to return a list of the planets that orbit the star
vCenter Orchestrator Developer's Guide Table 7-5. Source Files for the Solar System Plug-In Implementation (Continued) Class Name Description SolarSystemWatchersManager.java Implements StarFlareEventListener to monitor solar flare events in the solar system application and performs functions in Orchestrator if the solar flare exceeds a certain magnitude. \config\SolarSystemConfigurationAdaptor.
Chapter 7 Developing Plug-Ins Set Up the Plug-In Factory Implementation To create a plug-in factory, you create an implementation of the IPluginFactory interface from the Orchestrator plug-in API. Prerequisites n You have an application to plug in to Orchestrator. n You have access to the Orchestrator plug-in API JAR file. Procedure 1 Create and save a Java file for the plug-in factory implementation named YourApplicationNameFactory.java.
vCenter Orchestrator Developer's Guide Procedure 1 Set up logging so that Orchestrator can record in the logs the events that occur in the plugged-in technology. The solar system example uses an instance of org.apache.log4j.Logger to log events. public class SolarSystemFactory implements IPluginFactory { private Logger log = Logger.getLogger(this.getClass()); } 2 Set up a notification handler by implementing the IPluginNotificationHandler interface from the Orchestrator API.
Chapter 7 Developing Plug-Ins Prerequisites n Set up the factory implementation class. n Create a public constructor that implements the IPluginFactory interface. Procedure 1 Declare the IPluginFactory.find() method to find objects of the type java.lang.Object. public Object find(String type, String id) { } 2 Write in the logs the type and identifier of the objects that the plug-in factory finds. public Object find(String type, String id) { log.
vCenter Orchestrator Developer's Guide The findAll() method returns a QueryResult object that contains a list of the objects of the corresponding type that the plugged-in technology contains. For information about QueryResult objects, see “QueryResult Class,” on page 224. Prerequisites n Set up the factory implementation class. n Create a public constructor that implements the IPluginFactory interface. Procedure 1 Declare the IPluginFactory.findAll() method to obtain a QueryResult object.
Chapter 7 Developing Plug-Ins Find Objects By Relation Type in the Plugged-In Technology You can find objects by their relationship to other objects in the plugged-in technology by using the IPluginFactory.findRelation() method. You can also determine whether an object has any dependent child objects by using the IPluginFactory.hasChildrenInRelation() method. The IPluginFactory.findRelation() returns all of the dependent child objects that relate to a parent object by a certain relation type.
vCenter Orchestrator Developer's Guide Procedure 1 Declare the IPluginFactory.findRelation() method to return a java.util.List instance that lists all the child objects that relate to a parent object by a given relation. public List findRelation(String parentType, String parentId, String relationName) { } 2 Write in the logs the type and identifier of the parent object and the name of the relationship that the child objects have to the parent.
Chapter 7 Developing Plug-Ins 3 Call the appropriate methods from the plugged-in technology to obtain lists of child objects that relate to their parent objects by different types of relations. The SolarSystemFactory class uses an if-else statement to call the SolarSystemRepository.getAllPlanets() method to return a list of all of the planets that relate to a particular star by the OrbitingPlanets relation. The if-else statement also calls Planet.
vCenter Orchestrator Developer's Guide The possible return values of the hasChildrenInRelation() method are Yes, No, and Unknown. If you do not implement the hasChildrenInRelation() method, it returns Unknown. Prerequisites n Set up the factory implementation class. n Create a public constructor that implements the IPluginFactory interface. Procedure u Declare the IPluginFactory.hasChildrenInRelation() method to discover whether an object has any children of a certain relation type.
Chapter 7 Developing Plug-Ins Set Up the Event Listener Implementation To create a plug-in event listener, you implement the java.util.Eventlistener interface and create an instance of the IPluginNotification interface from the Orchestrator plug-in API. Prerequisites n Download the bundle of Orchestrator examples. n Unzip the examples bundle to an appropriate location. Procedure 1 Create and save a Java file for the plug-in event listener implementation named EventListener.java.
vCenter Orchestrator Developer's Guide Register the Event Listener with the Plugged-In Technology To monitor events in a plugged-in technology, you must register the event listener from the plug-in with the plugged-in technology and implement a notification handler. An event listener requires access to the main class of the application to which it listens for events.
Chapter 7 Developing Plug-Ins Notify Orchestrator of Events in the Plugged-In Technology Event listeners implement the IPluginNotificationHandler interface from the Orchestrator plug-in API to notify Orchestrator of events in the plugged-in technology. The IPluginNotificationHandler interface defines methods that you implement in the event listener to notify Orchestrator of changes in state of the objects that the event listener monitors in the plugged-in technology.
vCenter Orchestrator Developer's Guide Procedure 1 Create methods that implement the IPluginNotificationHandler.notifyElementUpdated() method to notify Orchestrator of changes to an existing object. The SolarSystemEventListener class creates the following methods to inform Orchestrator of changes to the circumference and gravity of a particular Planet object: public void circumferenceChanged(Planet planet) { notificationHandler.notifyElementUpdated("Planet", planet.
Chapter 7 Developing Plug-Ins For a description of the role of the plug-in events and the other components of a plug-in, see “Overview of Plug-Ins,” on page 141. For information about all of the methods and parameters of the event publisher interface, see “IPluginEventPublisher Interface,” on page 218. Procedure 1 Set Up the Event Generator on page 171 You can create IPluginEventPublisher instances and methods to generate events directly in the plug-in adaptor implementation.
vCenter Orchestrator Developer's Guide 6 Set up logging so that Orchestrator can record in the logs the events that the event generator generates. The solar system example uses an instance of org.apache.log4j.Logger to log events. public class SolarSystemEventGenerator { private static final Logger log = Logger.getLogger(SolarSystemEventGenerator.class); } 7 Create an instance of the event generator class for other classes in the plug-in implementation to use.
Chapter 7 Developing Plug-Ins Procedure 1 Create one or more instances of the IPluginEventPublisher interface with which to register the objects to monitor. The SolarSystemEventGenerator class creates a hashtable to contain all of the IPluginEventPublisher instances. private Hashtable> policyElements = new Hashtable>(); 2 Define a method to register the objects to monitor with the IPluginEventPublisher instances.
vCenter Orchestrator Developer's Guide Define and Publish Events to Orchestrator The IPluginEventPublisher interface allows you to publish to the Orchestrator policy engine events that you define in the plug-in that occur in the plugged-in technology. You can use the methods of the IPluginEventPublisher interface to set gauges and triggers that Orchestrator policies monitor.
Chapter 7 Developing Plug-Ins 5 Call the IPluginEventPublisher.pushGauge() or IPluginEventPublisher.pushTrigger() methods to publish gauges or triggers to the Orchestrator policy engine. The SolarSystemEventGenerator.generateFlareEvent() method calls the pushGauge() method to publish a gauge with the Orchestrator policy engine.
vCenter Orchestrator Developer's Guide The solar system plug-in features a workflow trigger that creates an instance of the PluginTrigger class to monitor solar flare events on a Star object in a SolarSystemRepository instance. These procedures present the steps involved in creating a workflow trigger. To illustrate the process, they present code from the SolarSystemTriggerGenerator class.
Chapter 7 Developing Plug-Ins 5 Import any other classes that the workflow trigger implementation requires. The SolarSystemTriggerGenerator class requires the following class: import java.util.Properties; 6 Declare a public class to contain the workflow trigger implementation. The SolarSystemTriggerGenerator class declares the following class: public class SolarSystemTriggerGenerator { } You set up the workflow trigger implementation.
vCenter Orchestrator Developer's Guide What to do next Set the properties that the workflow trigger monitors in the objects in the plugged-in technology. Set the Properties that a Workflow Trigger Monitors Workflow triggers monitor changes in the properties of an object in the plugged-in technology. When workflow triggers detect a change in the properties of an object, they notify any workflows in the Orchestrator server that are waiting for this event.
Chapter 7 Developing Plug-Ins 4 Call the Properties.setProperty() method to add the properties to monitor to the properties list. The SolarSystemTriggerGenerator class adds the identifier of the star object and the value of the magnitude of the solar flare event to the properties list props. public PluginTrigger createStarFlareTrigger(Star star, double magnitude){ PluginTrigger trigger = newTrigger(); Properties props = new Properties(); props.setProperty(STAR_ID, star.getId()); props.
vCenter Orchestrator Developer's Guide 2 Create Instances of the PluginWatcher Class on page 181 You create a plug-in watcher to watch a workflow trigger by instantiating the PluginWatcher class. When the event that the workflow trigger defines occurs, the plug-in watcher notifies any workflows that are waiting for that event. 3 Publish Plug-In Watchers on page 182 You implement the IPluginPublisher interface to publish plug-in watchers to the Orchestrator notification mechanism.
Chapter 7 Developing Plug-Ins 6 Declare a public class for the event generator implementation. The solar system example watcher declares the SolarSystemWatchersManager class, that implements the StarFlareEventListener class. public class SolarSystemWatchersManager implements StarFlareEventListener { } The StarFlareEventListener class listens for solar flare events of a certain magnitude. 7 Set up logging so that Orchestrator can record in the logs the events that the watcher observes.
vCenter Orchestrator Developer's Guide Procedure 1 Create one or more instances of the PluginWatcher class with which to register the workflow triggers to monitor. The SolarSystemWatchersManager class creates a hashtable to contain all of the PluginWatcher instances. private final Map watchers = new Hashtable(); 2 Obtain watcher instances by calling the PluginWatcher.getId() method.
Chapter 7 Developing Plug-Ins Procedure 1 Create an instance of the IPluginPublisher interface. The SolarSystemWatchersManager class declares the following variable for the IPluginPublisher instance. private IPluginPublisher pluginPublisher; 2 Define a method to add the IPluginPublisher instance to the plug-in adapter implementation. The SolarSystemWatchersManager class declares the following method that the SolarSystemAdapter class calls.
vCenter Orchestrator Developer's Guide 5 Define the event and publish it to the Orchestrator notification mechanism by calling the IPluginPublisher.pushWatcherEvent() method. The SolarSystemWatchersManager.starFlareEvent() method checks whether the magnitude value exceeds a maximum magnitude value. If the maximum magnitude value is exceeded, the starFlareEvent() method writes the flare event in the logs and publishes the event to the Orchestrator notification mechanism.
Chapter 7 Developing Plug-Ins Define Objects and Methods to Map to the Orchestrator JavaScript API You can map the object types, classes, and methods of the plugged-in technology and the plug-in itself to JavaScript types, classes, and methods that you add to the Orchestrator JavaScript API. You can add objects and functions to the JavaScript API that do not exist in the plugged-in technology by defining them in the plug-in implementation.
vCenter Orchestrator Developer's Guide You created an instance of a class that the vso.xml file can map to a scripting class in the Orchestrator JavaScript API. The vso.xml file of the solar system example maps the _solarSystemEventGenerator instance to the SolarSystemEventGenerator scripting class in the JavaScript API. What to do next Implement the plug-in adapter to instantiate all of the classes and objects that you defined in the plug-in.
Chapter 7 Developing Plug-Ins 3 Import the Orchestrator plug-in API interfaces, classes, and enumerations with a Java import statement. import ch.dunes.vso.sdk.api.*; 4 Import any other classes that the adapter implementation requires. In the solar system example, the adapter implementation requires the following classes: import javax.security.auth.login.LoginException; import org.jboss.logging.
vCenter Orchestrator Developer's Guide Procedure 1 Declare the variables that the adapter class uses in its method calls. The solar system adapter declares variables for the plug-in factory and plug-in name. public class SolarSystemAdapter implements IPluginAdaptor { private SolarSystemFactory factory; static String pluginName; } 2 Create an instance of the plug-in factory class that implements the IPluginFactory interface. The solar system adapter calls the IPluginAdaptor.
Chapter 7 Developing Plug-Ins Manage Plug-In Events The plug-in adapter manages the events that occur in the plugged-in technology by defining event generators and event publishers. Prerequisites n Create a public constructor that implements the IPluginAdaptor interface. n Instantiate the plug-in factory. Procedure 1 Define the method to generate plug-in events. You can define the events to manage directly in the adapter implementation.
vCenter Orchestrator Developer's Guide Add Plug-In Watchers Plug-in watchers monitor the events that workflow triggers define. When an event occurs, Orchestrator notifies any workflows that are waiting for that event. Prerequisites n Create a public constructor that implements the IPluginAdaptor interface. n Instantiate the plug-in factory. n Create event generators and publishers. Procedure 1 Create an instance of the plug-in watcher implementation.
Chapter 7 Developing Plug-Ins Add a Tab to the Configuration Interface You can add a tab to the Orchestrator configuration interface to allow users to provide information to the plugin configuration that is specific to their environment or preferences. To add a configuration tab for a plug-in to the configuration interface, you implement the IConfigurationAdaptor interface. You can also use the SDKHelper and extend the BaseAction classes from the Orchestrator plug-in API.
vCenter Orchestrator Developer's Guide Set Up the Configuration Adapter To create a tab in the configuration interface for a plug-in, you create an implementation of the IConfigurationAdaptor interface from the Orchestrator plug-in API. You also call the methods of the SDKHelper class. Prerequisites n You have an application to plug in to Orchestrator. n You have access to the Orchestrator plug-in API JAR file. n Implement the plug-in adapter and factory interfaces.
Chapter 7 Developing Plug-Ins Load and Save Configuration Information in the Configuration Server The IConfigurationAdaptor interface provides methods to load and save configuration information in the Orchestrator configuration server. The configuration adapter uses these methods to locate and update the configuration information for a plug-in by setting plug-in properties. You also create methods in the configuration adapter to define the values that the user can configure.
vCenter Orchestrator Developer's Guide 3 Define methods to obtain and set the configurable values. The SolarSystemConfigurationAdaptor class uses the Localizator.getResourceString() method to get the properties of Pluto from the plug-in configuration server and adds them to a hashtable. The SolarSystemConfigurationAdaptor class also defines methods to set whether Pluto is a planet and to set the user's home planet.
Chapter 7 Developing Plug-Ins 5 Implement the IConfigurationAdaptor.loadConfiguration() method to load configuration information from the configuration server into the Orchestrator server. The SolarSystemConfigurationAdaptor.loadConfiguration() method creates a Properties list to contain the configurable properties. The SolarSystemConfigurationAdaptor.loadConfiguration() method calls the SDKHelper.getConfigurationPathForPluginName() and SDKHelper.
vCenter Orchestrator Developer's Guide What to do next Obtain configuration information that the user sets in the configuration interface by implementing the Apache Struts framework. Create a Configuration Action to Obtain Configuration Information from the User Orchestrator uses the Apache Struts framework to pass to the Orchestrator server the configuration information that the user provides in the configuration interface.
Chapter 7 Developing Plug-Ins 6 Define the variables that the BaseAction implementation requires. The SolarSystemConfigureAction class declares variables for the unique identifier of each instance of the serializable BaseAction class, a logger, an array of ConfigurationError instances, and the configuration adapter instance. private private private private 7 static final long serialVersionUID = 1L; static Logger log = Logger.getLogger(SolarSystemConfigureAction.
vCenter Orchestrator Developer's Guide 10 Add error handling to the implementation of the configuration action. The SolarSystemConfigureAction class returns an array of errors if the configuration is invalid. public ConfigurationError[] getConfigErrors() { return configErrors; } public void setConfigErrors(ConfigurationError[] configErrors) { this.configErrors = configErrors; } public int getConfigErrorsSize() { return configErrors.
Chapter 7 Developing Plug-Ins Procedure 1 Create an index page for the configuration tab that implements the JavaServer Pages Standard Tag Library (JSTL). The index page must refer to the JSTL definition. <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> 2 Create a Web application definition XML file that provides information about the plug-in to the Orchestrator configuration server.
vCenter Orchestrator Developer's Guide 5 Copy all of the required JAR files in a directory named lib in the Web application directory. You must include the JAR files that contain the implementations of the configuration adapter and actions, and JAR files for any other technologies that configuration implementation uses. 6 Create a Web application archive to contain the Web application files. A WAR file is a JAR file that you rename to .war.
Chapter 7 Developing Plug-Ins Table 7-6. Contents of the Solar System Configuration WAR File (Continued) Directory Filename solarsystem\WEB-INF\lib\ n n n n n n n n solarsystem\WEB-INF\pages\ jaxb-api.jar jaxb-impl.jar jsr173_api.jar vmware-solarsystem.jar vmware-vmo-model.jar vmware-vmo-sdkapi.jar vmware-vmosdkwebsolarsystem.jar vmware-vmo-util.jar configure.
vCenter Orchestrator Developer's Guide 3 Define Enumerations on page 206 You can define enumerations in the vso.xml file to set global values that apply to all objects of a certain category. 4 Map Classes and Methods to Classes and Methods in the JavaScript API on page 206 Orchestrator monitors objects in the plugged-in application and performs operations on them by running workflows, policies, and actions. You map in the vso.
Chapter 7 Developing Plug-Ins 5 Set the and elements to define the behavior of the plug-in when the Orchestrator server starts. The solar system example sets the version mode to restart the plug-in whenever a new version is detected, and provides the path to a package of Orchestrator workflows, policies, and a Web view in the file structure of the DAR file. Orchestrator installs this package when the plug-in starts.
vCenter Orchestrator Developer's Guide Procedure 1 Set the data sources for the plug-in elements in the element. The plug-in adapter implementation is the point of access to all the classes of the plug-in. The solar system plug-in vso.xml file sets the name of the data source to solar-datasource and points the elements to the SolarSystemAdapter class that instantiates the SolarSystemFactory and the other classes of the plug-in.
Chapter 7 Developing Plug-Ins 6 Set the object's properties in the element. The solar system example defines name, circumference, and surfaceTemp properties for all Star objects. The bean-property property allows Orchestrator to create get and set methods in the scripting API to obtain and set these properties.
vCenter Orchestrator Developer's Guide Define Enumerations You can define enumerations in the vso.xml file to set global values that apply to all objects of a certain category. The categories that you set in the vso.xml file appear as enumerations in the Orchestrator JavaScript API. Prerequisites You must have set up the plug-in and defined elements in the vso.xml file. Procedure 1 Define an enumeration for a certain object type in the element.
Chapter 7 Developing Plug-Ins Prerequisites You must have set up the plug-in, and defined elements and enumerations. Procedure 1 Map a Java class from the plugged-in technology or from the plug-in implementation to a JavaScript class. The SolarSystemEventGenerator class defines the events that Orchestrator can invoke in the solar system application. The solar system vso.xml file maps the event generator class to a JavaScript class named _SolarSystemEventGenerator.
vCenter Orchestrator Developer's Guide 3 Map the methods in the Java class to methods in the Orchestrator JavaScript API in the
Chapter 7 Developing Plug-Ins Table 7-8.
vCenter Orchestrator Developer's Guide 7 Create a directory named resources at the root of the working directory. 8 (Optional) Create a directory named images in the resources directory. The resources\images directory can contain icons to represent the different objects of the plugged-in application in the Orchestrator Inventory view and selection dialog boxes. 9 (Optional) Create a directory named packages in the resources directory. The resources\packages directory can contain packages of workflows,
Chapter 7 Developing Plug-Ins Contents of the Solar System DAR File The DAR file is a ZIP file that you rename to DAR. You can unzip the solar system DAR file to view the contents and file structure of the solar system plug-in. The solar system example vmware-vmosdk-solarsystem.dar file contains the following directories and files. n n \lib, that contains the following JAR archives: n vmware-solarsystem.jar, that contains the classes of the solar system application. n vmware-vmosdk-solarsystem.
vCenter Orchestrator Developer's Guide 8 (Optional) If the plug-in adds a configuration tab to the configuration interface, click the tab for the plugin. For example, if you install the solar system plug-in, click Solar System. 9 (Optional) Configure the plug-in in its configuration tab. For example, if you install the solar system plug-in, select your home planet and select whether Pluto is a planet or a dwarf planet. 10 Click Apply changes. 11 Restart the Orchestrator server.
Chapter 7 Developing Plug-Ins Prerequisites n Install the solar system plug-in in the Orchestrator server. n Start the Orchestrator client. Procedure 1 Select Tools > Api explorer in the Orchestrator menus. 2 Expand the SolarSystem node in the hierarchical list of scripting objects.
vCenter Orchestrator Developer's Guide 9 Click the sun, a planet, or a moon to display its properties on the right. 10 Right-click the sun, a planet, or a moon to and select Execute operation to run a workflow on that object. You can select a workflow to run from a contextual list of workflows that take that type of object as an input parameter. You can run workflows on the solar system objects in the inventory. You can add a planet to the sun's orbit or generate or wait for a solar flare.
Chapter 7 Developing Plug-Ins The Star policy implements the solar system scripting API to monitor star objects for solar flare events and records their magnitude. The policy keeps on running until you stop it. If you run the Generate Flare Event again, the policy continues to record the magnitudes of the flares in the logs. What to do next Monitor events on objects in the plugged-in technology by running workflows.
vCenter Orchestrator Developer's Guide Access Plug-In Objects and Operations by Using a Web View With Web views, you can run workflows on objects from the Orchestrator inventory from a Web browser instead of from the Orchestrator client. The solar system example includes a Web view that you can use to access the objects and workflows of the solar system plug-in from a Web browser. Prerequisites n Install the solar system plug-in in the Orchestrator server. n Start the Orchestrator client.
Chapter 7 Developing Plug-Ins Method Returns Description get(java.lang.String propertyName, java.lang.Object object, java.lang.Object sdkObject) java.lang.Object Obtains a property from a given object in the plugin. set(java.lang.String propertyName, java.lang.String propertyValue, java.lang.Object object) Void Sets a property on a given object in the plug-in. IConfigurationAdaptor Interface The IConfigurationAdaptor interface allows you to add a tab in the Orchestrator configuration interface.
vCenter Orchestrator Developer's Guide IPluginAdaptor Interface You implement the IPluginAdaptor interface to manage plug-in factories, events and watchers. The IPluginAdaptor interface defines an adapter between a plug-in and the Orchestrator server. IPluginAdaptor instances are resonsible for session management. The IPluginAdaptor Interface defines the following methods.
Chapter 7 Developing Plug-Ins Policies can implement either gauges or triggers to monitor objects in the plugged-in technology. Policy gauges monitor the attributes of objects and push an event in the Orchestrator server if the values of the objects exceed certain limits. Policy triggers monitor objects and push an event in the Orchestrator server if a defined event occurs on the object.
vCenter Orchestrator Developer's Guide Method Returns Description invalidate(java.lang.String type, java.lang.String id) Void Invalidate objects by type and ID. void invalidateAll() Void Invalidate all objects in the cache. IPluginNotificationHandler Interface The IPluginNotificationHandler defines methods to notify Orchestrator of different types of event that occur on the objects Orchestrator accesses through the plug-in. The IPluginNotificationHandler Interface defines the following methods.
Chapter 7 Developing Plug-Ins Method Returns Description getWebAppContext() String Locates the WAR file of the Web application for the configuration tab. Provide the name and path to the WAR file from the /webapps directory in the DAR file as a string. setWebConfiguration(boolean webConfiguration) Boolean Determine whether the contents of the configuration tab are defined by a Web application. BaseAction Class The BaseAction class is a helper class that you can use to create Orchestrator actions.
vCenter Orchestrator Developer's Guide Method Returns Description fillTable(java.util.Hashtable table) Void Adds property values to a hashtable. getResourceString(java.lang.String key) java.lang.String Obtains a property from the hashtable. getResourceString(java.lang.String key, java.lang.Object... args) java.lang.String Obtains a property from the hashtable. hasKey(java.lang.
Chapter 7 Developing Plug-Ins Method Returns Description getSdkId() java.lang.String Obtains the ID of the object to monitor in the plugged-in technology. getSdkType() java.lang.String Obtains the type of the object to monitor in the plugged-in technology. getTimeout() Long Obtains the trigger timeout period. setModuleName(java.lang.String moduleName) Void Sets the name of the trigger module. setProperties(java.util.Properties properties) Void Sets a list of properties for the trigger.
vCenter Orchestrator Developer's Guide QueryResult Class The QueryResult class contains the results of a find query made on the objects Orchestrator accesses through the plug-in. public class QueryResult extends java.lang.Object implements java.io.Serializable The totalCount value can be greater than the number of elements the QueryResult returns, if the total number of results found exceeds the number of results the query returns.
Chapter 7 Developing Plug-Ins Method Returns Description getPropertyAccessor() java.lang.String Obtains an object property accessor getPropertyAccessorTree() java.lang.Object Obtains an object property accessor tree isHidden() Boolean Shows or hides the object isShowInColumn() Boolean Shows or hides the object in the database column isShowInDescription() Boolean Shows or hides the object description setAttributeName(java.lang.
vCenter Orchestrator Developer's Guide Method Returns Description loadPropertiesForPluginName(java.lang.String moduleName) java.util.Properties Loads a list of properties that users set in the configuration interface. savePropertiesForPluginName(java.util.Properties properties, java.lang.String moduleName) Void Saves in the plug-in properties that the user sets in the configuration interface. getPluginInstallCredentials() java.lang.
Chapter 7 Developing Plug-Ins PluginOperationException Class The PluginOperationException class handles errors encountered during a plug-in operation. public class PluginOperationException extends java.lang.RuntimeException implements java.io.Serializable The PluginOperationException class inherits the following methods from class java.lang.
vCenter Orchestrator Developer's Guide ErrorLevel Enumeration The ErrorLevel enumeration defines constant values for different levels of error that a plug-in encounters. public enum HasChildrenResult extends java.lang.Enum implements java.io.
Chapter 7 Developing Plug-Ins Method Returns Description getValue() int Returns one of the following values: 1 Parent has children -1 Parent has no children 0 Unknown, or invalid parameter valueOf(java.lang.String name) static HasChildrenResult Returns an enumeration constant of this type with the specified name. The String must match exactly an identifier used to declare an enumeration constant of this type. Do not use whitespace characters in the enumeration name.
vCenter Orchestrator Developer's Guide Elements of the vso.xml Plug-In Definition File The vso.xml file contains a set of standard elements. Some of the elements are mandatory while others are optional. Each element has attributes that define values for the objects and operations you map to Orchestrator objects and operations. This information describes all of the elements of the vso.xml file and the possible attribute values for each element.
Chapter 7 Developing Plug-Ins Attributes Value Description icon Image file Icon that represents the plug-in in the Orchestrator configuration interface. Mandatory attribute. adaptor-class Java class Implementation of the IConfigurationAdaptor Java interface that defines the actions to perform in the configuration interface. Mandatory attribute. configuration-war WAR archive Web application archive (war file) that contains the components of the Web application that implements the adapter class.
vCenter Orchestrator Developer's Guide url Element The element provides a URL that points to external documentation about an object or enumeration. You provide the URL between the and tags. The element is optional. The element has no attributes. Table 7-13. Element Hierarchy Parent Elements n n Child Elements None
Chapter 7 Developing Plug-Ins webview-components-library Element The element points to a JAR file containing custom Web view tapestry components that extend Web view capabilities. The element is optional. The element has the following attributes. Attributes Value Description jar String A JAR file containing Web view components. Mandatory attribute.
vCenter Orchestrator Developer's Guide Attributes Value Description invoker-mode direct (default) or timeout Sets a timeout on the finder function. If set to direct, calls to finder functions never time out. If set to timeout, the Orchestrator server applies the timeout period that corresponds to the finder method. Optional attribute. anonymous-loginmode never (default) or always Passes or does not pass the user's username and password to the plug-in. Optional attribute.
Chapter 7 Developing Plug-Ins finder Element The element represents in the Orchestrator client a type of object found through the plug-in. The element identifies the Java class that defines the object the object finder represents. The element defines how the object appears in the Orchestrator client interface. It also identifies the scripting object that the Orchestrator scripting API defines to represent this object.
vCenter Orchestrator Developer's Guide property Element The element maps the found object's properties to Java properties or method calls. You can call on the methods of the SDKFinderProperty class when you implement the plug-in factory to obtain properties for the plug-in factory implementation to process. You can show or hide object properties in the views in the Orchestrator client. You can also use enumerations to define object properties. The element is optional.
Chapter 7 Developing Plug-Ins relation Element The element defines how objects relate to other objects. You define the relation name in the element. The element is optional. A plug-in can have an unlimited number of elements. The element has the following attributes. Attributes Value Description name Relation name A name for this relation. Mandatory attribute.
vCenter Orchestrator Developer's Guide Type Value Description name Relation name A refid to a relation name. Mandatory attribute. Table 7-28. Element Hierarchy Parent Element Child Elements None events Element The element is the container for the and elements. The element can contain an unlimited number of triggers or gauges. The element is optional. The element has no attributes. Table 7-29.
Chapter 7 Developing Plug-Ins Type Value Description name Trigger name A name for the trigger. Optional attribute. display-name Trigger name The name that displays in the Orchestrator client. Optional attribute. type Trigger type The object type that defines the trigger. Mandatory attribute. Table 7-32. Element Hierarchy Parent Element Child Elements None gauge Element The element defines the gauges you can use for this finder.
vCenter Orchestrator Developer's Guide Type Value Description script-name JavaScript name Scripting name of the class. Must be globally unique. Mandatory attribute. java-class Java class The Java class wrapped by this JavaScript class. Mandatory attribute. create true (default) or false If true, you can create a new instance of this class. Optional attribute. strict true or false (default) If true, you can only call methods you annotate or declare in the vso.xml file. Optional attribute.
Chapter 7 Developing Plug-Ins Table 7-38. Element Hierarchy Parent Element Child Element Constructor parameter Element The element defines the constructor's parameters. The element is optional. A plug-in can have an unlimited number of elements. The element has the following attributes. Type Value Description name String Parameter name to use in API documentation. Mandatory attribute.
vCenter Orchestrator Developer's Guide Type Value Description is-deprecated true or false If true, the object maps a deprecated attribute. Optional attribute. since-version Number The version at which the attribute was deprecated. Optional attribute. Table 7-41. Element Hierarchy Parent Element Child Elements None methods Element The element is the container for the
Chapter 7 Developing Plug-Ins Table 7-44. Element Hierarchy Parent Element Child Elements n n code Element The element provides example code that appears in the API Explorer documentation. You provide the code example between the and
tags. The element is optional. The element has no attributes. Table 7-45.
vCenter Orchestrator Developer's Guide singleton Element The element creates a JavaScript scripting object as a singleton instance. A singleton object behaves in the same way as a static Java class. Singleton objects define generic objects for the plug-in to use, rather than defining specific instances of objects that Orchestrator accesses in the pluggedin technology. For example, you can use a singleton object to establish the connection to the plugged-in technology.
Chapter 7 Developing Plug-Ins entries Element The element is the container for the elements. The element is optional. The element has no attributes. Table 7-51. Element Hierarchy Parent Element Child Element entry Element The element provides a value for an enumeration attribute. The element is optional. A plug-in can have an unlimited number of elements. The element has the following attributes.
vCenter Orchestrator Developer's Guide 246 VMware, Inc.
Developing a Web Services Client 8 VMware vCenter Orchestrator provides a Web services API so that you can develop applications to access workflows through Web services. The main purpose of the Orchestrator Web service is to start workflows and to retrieve their output parameters through a network or the Web.
vCenter Orchestrator Developer's Guide Figure 8-1.
Chapter 8 Developing a Web Services Client Web Service Endpoint The Web service endpoint is the port upon which you connect a Web service client to the Orchestrator server. You connect to the Orchestrator Web service's endpoint at the following URL, in which is the IP address or host name of the host on which the Orchestrator server is running.
vCenter Orchestrator Developer's Guide Accessing the Server from Web Service Clients By default, Orchestrator permits access to workflows from Web service clients. However, the Orchestrator administrator can configure the server to deny connections from Web service clients. If the Orchestrator administrator has disabled access to the server from Web service clients, the server only answers Web service client calls from the echo() and echoWorkflow() methods, for testing purposes.
Chapter 8 Developing a Web Services Client 10 Run Workflows from a Web Service Client on page 257 The main purpose of a Web services client is to run workflows across a network. 11 Interact with a Workflow While it Runs on page 259 After the workflow starts, the Web services client can perform various actions in response to events while the workflow is running.
vCenter Orchestrator Developer's Guide Find Objects in the Orchestrator Server To perform any useful task with a workflow, you must find the objects on which the workflow will run. The Orchestrator Web service API provides functions for finding objects of all types in the VMware Infrastructure inventory. Workflows typically run on objects in the vCenter Server. Workflows can also run on objects from outside the vCenter Server by accessing them through plug-ins.
Chapter 8 Developing a Web Services Client 2 n Calls the QueryResult object's getElements operation to obtain the details of the objects found as an array of FinderResult objects. n Passes the array of FinderResult objects to the internal method displayFinderResult, which extracts the information. Extract the results from a FinderResult object.
vCenter Orchestrator Developer's Guide Procedure 1 Create a FinderResult object by calling the findForId operation on an object. finderResult = vsoWebControl.findForId("VC:VirtualMachine", "vcenter/vm-xx", username, password); In the preceding example, vcenter/vm-xx is the ID of a virtual machine object that the findForID operation finds. The findForID operation returns a FinderResult instance directly, rather than creating an array of FinderResult objects like find.
Chapter 8 Developing a Web Services Client Procedure 1 Create an array of FinderResult objects by calling the findRelation operation on an object. FinderResult[] results = vsoWebControl.findRelation("VC:ComputeResource", "vcenter/domain-s114", "getResourcePool()", "username", "password"); The preceding example returns an array of FinderResult objects that match the following criteria. 2 n The parent element is of the type VC:ComputeResource. n The parent element's ID is vchost/domain-s114.
vCenter Orchestrator Developer's Guide Find Workflows in the Orchestrator Server When you have found the objects with which to interact, you must find the workflows that perform these interactions. The Orchestrator Web service API includes the following operations to find all the workflows running in a given environment, to find a workflow with a particular name, or to find workflows with a particular ID.
Chapter 8 Developing a Web Services Client Procedure u Create an array of Workflow objects by calling the getWorkflowsWithName operation. Workflow[] workflows = vsoWebControl.getWorkflowsWithName("Simple user interaction", username, password); The preceding code example calls the getWorkflowsWithName operation to obtain all workflows for which the name, or part of the name, is Simple user interaction. You found workflows in the Orchestrator server that the Web service client can run on objects.
vCenter Orchestrator Developer's Guide Procedure 1 (Optional) Check the workflow user permissions by calling the hasRights operation. You can verify if a user has rights to read, run, or edit a particular workflow using the hasRights operation. This operation is not mandatory, but checking user rights before you run a workflow can help prevent exceptions. String workflowId = "1880808080808080808080808080808087808080011713796199469943be4c882"; Boolean rights = vsoWebControl.
Chapter 8 Developing a Web Services Client Interact with a Workflow While it Runs After the workflow starts, the Web services client can perform various actions in response to events while the workflow is running. Prerequisites You must have implemented operations in the Web service client to run workflows in the Orchestrator server. Procedure 1 Find running workflows by calling the getWorkflowTokenForId operation.
vCenter Orchestrator Developer's Guide 3 Provide inputs from user interactions by calling the answerWorkflowInput operation. If a workflow is waiting for user input in the waiting state, an application's event loop can specify that input at any time. You can create WorkflowTokenAttribute arrays as normal, and then supply them to a workflow during its run by using the answerWorkflowInput operation. The following example continues the code from Step 2. if ("waiting".equals(tokenStatus) == true) { System.
Chapter 8 Developing a Web Services Client Procedure 1 Obtain the results of a running workflow by calling the getWorkflowTokenResult( ) operation. The getWorkflowTokenResult( ) operation stores the results as an array of attributes. WorkflowTokenAttribute[] retAttributes = vsoWebControl.getWorkflowTokenResult(token.getId(), username, password); The preceding example code obtains the result of a workflow token with a specific identifier. 2 (Optional) Print the workflow results.
vCenter Orchestrator Developer's Guide Web Service Application Examples Orchestrator provides working examples of Web services client applications that provide Web access to Orchestrator. You can download the Orchestrator examples ZIP file from the VMware vCenter Orchestrator Documentation download page. For information about where to find the documentation download page, see “Example Applications,” on page 9.
Chapter 8 Developing a Web Services Client ModuleInfo Object ModuleInfo stores the name, version, description, and display name attributes for each plug-in. A Web service application can use these attributes to modify its behavior based on the presence or absence of certain plugins or plug-in versions. The getAllPlugins operation returns arrays of ModuleInfo objects to list all the plug-ins a user can access, as the following example shows.
vCenter Orchestrator Developer's Guide Type Value Description Long totalCount The total number of objects found. The QueryResult object contains an array of FinderResult objects. The vso.xml file for the relevant plug-in sets the number of FinderResult objects the query returns. The standard plug-ins that Orchestrator provides all return an unlimited number of FinderResult objects. The totalCount property reports the total number of FinderResult objects found.
Chapter 8 Developing a Web Services Client WorkflowParameter Object The WorkflowParameter object defines a parameter in a workflow, for example, an input, an output, or an attribute. Workflow developers can set up arbitrary parameters to provide any input parameters or output parameters that the workflows need. The format of the parameters is defined entirely by the workflow. The following table shows the properties of the WorkflowParameter object.
vCenter Orchestrator Developer's Guide Type Value Description String globalState The state of the workflow as a whole, with the following possible values: n running: the workflow is running n waiting: the workflow is waiting for runtime parameters, which can be provided by answerWorkflowInput n waiting-signal: the workflow is waiting for an external event n canceled: the workflow was canceled by a user or by an application n completed: the workflow has finished n failed: the workflow encoun
Chapter 8 Developing a Web Services Client You can also pass an array of WorkflowTokenAttribute objects to the answerWorkflowInput operation to provide input that a workflow token needs while it runs. public void answerWorkflowInput(String workflowTokenId, WorkflowTokenAttribute[] answerInputs, String username, String password); The following table shows the properties of the WorkflowTokenAttribute object.
vCenter Orchestrator Developer's Guide Type Value Description String workflowTokenId The ID of a running workflow that is waiting for input from a user interaction or external application Array of WorkflowTokenAttribute objects answerInputs The result of the user interaction or external application, passed as input to the waiting workflow String username Orchestrator user name String password Orchestrator password Return Value No return value.
Chapter 8 Developing a Web Services Client echoWorkflow Operation The echoWorkflow operation tests the connection to the Web service by checking serialization. The echoWorkflow operation provides a useful debugging tool if you are connecting to an older Web service implementation. Calling this operation verifies the connection to the server by checking that the serialize and deserialize operations work correctly. The echoWorkflow operation is declared as follows.
vCenter Orchestrator Developer's Guide Query parsing is performed by the plug-in that contains the objects you are looking for. The query language used by the find operation is defined by the plug-in. Consequently, the syntax of the query parameter differs according to the implementation of the plug-in. Most of the officially supported Orchestrator plug-ins do not store any objects in the inventory, so they do not expose anything that can be searched for.
Chapter 8 Developing a Web Services Client Type Value Description String type Type of object looked for. String query The query. The query is a string enclosed in quotation marks. Any object of the type specified by the type parameter with a name that matches the query string is returned in the QueryResult. String username Orchestrator user name. String password Orchestrator password. Return Value Returns the result of the query as a QueryResult object.
vCenter Orchestrator Developer's Guide Type Value Description String parentType The type of parent object. The parentType property can be the name of a plug-in, or it can specify a more narrowly defined parent. For example, you can specify the parentType as "VC:" to obtain the objects at the root of VMware vCenter Server plug-in, or you can a specific folder, such as "VC:VmFolder". String parentId The ID of a particular parent object.
Chapter 8 Developing a Web Services Client Table 8-2.
vCenter Orchestrator Developer's Guide getAllPlugin Operation The getAllPlugin operation returns the description of all the plug-ins installed in Orchestrator. IMPORTANT The getAllPlugin operation is deprecated since Orchestrator 4.0. Use getAllPlugins instead. getAllPlugins Operation The getAllPlugins operation returns the description of all the plug-ins installed in Orchestrator. Many of the actions that you perform using Orchestrator depend on functions that you enable through plugins.
Chapter 8 Developing a Web Services Client getWorkflowForId Operation The getWorkflowForId operation retrieves a workflow identified by its unique ID. If you know the ID of a specific workflow, you can use the getWorkflowForID operation to obtain the workflow object. Multiple workflows running through different plug-ins might have the same name. The safest way to obtain workflows is to use the getWorkflowsWithName operation to obtain their ID, rather than by obtaining them by name.
vCenter Orchestrator Developer's Guide Return Value Returns an array of Workflow objects that correspond to the provided name or name fragment. Workflows are returned in an array even if only one workflow is found. Returns null if you pass it an invalid parameter. getWorkflowTokenForId Operation The getWorkflowTokenForId operation finds the WorkflowToken object for a specific workflow token. The getWorkflowTokenForId operation is declared as follows.
Chapter 8 Developing a Web Services Client The getWorkflowTokenResult operation is declared as follows. public WorkflowTokenAttribute[] getWorkflowTokenResult(String workflowTokenId, String username, String password); Type Value Description String workflowTokenId ID of this specific run of the workflow String username Orchestrator user name. String password Orchestrator password.
vCenter Orchestrator Developer's Guide hasChildrenInRelation Operation The hasChildrenInRelation operation checks whether a given relation type has any children. In some cases, objects are most easily located through their relationships with other objects. You can obtain all the objects that relate to another object by a given relation by calling the findRelation operation on that object. The findRelation operation finds only the relatives of a known object.
Chapter 8 Developing a Web Services Client A Web service application can check those rights by calling the hasRights operation. In the following example, hasRights checks whether the user has the right to read the workflow. hasRights(workflowId, username, password, 'r') Type Value Description String workflowId The ID of the workflow for which you are checking a user's rights. String username Orchestrator user name. String password Orchestrator password.
vCenter Orchestrator Developer's Guide Type Value Description String eventName The eventName property is the name of the event that a workflow is waiting for before running. The eventName string you pass to sendCustomEvent must match the name of an Event object declared in the script, action or workflow that defines the custom event. String serializedProperties The serializedProperties property defines the parameters to pass to the waiting workflow as a series of name-value pairs.
Developing Web Views 9 Orchestrator Web views are Web 2.0 frontends that allow users to access Orchestrator workflows and objects in the Orchestrator inventory by using a Web browser rather than by using the Orchestrator client. Orchestrator provides a standard Web view that users can use to run workflows, called weboperator. The weboperator Web view provides end users with browser access to all of the workflows in the library, that they can run on all of the objects in the inventory.
vCenter Orchestrator Developer's Guide n Accessing Server Objects from URLs on page 309 You can add URLs to Web view pages to access objects in the Orchestrator server, without having to implement a Web view component. For example, you can add URLs to Web view pages that run an action in the Orchestrator server or URLs that retrieve resource elements from the Orchestrator server. n Create a Simple Web View Using the Default Template on page 312 The easiest way to create a Web view is to use a template.
Chapter 9 Developing Web Views Start the Weboperator Web View You start the weboperator Web view from the Orchestrator client. Procedure 1 Click the Web Views view in the Orchestrator client. The weboperator Web view and any other Web views that you have imported into Orchestrator appear. 2 Right-click weboperator and select Publish. 3 Open a browser and go to http://orchestrator_server:8280.
vCenter Orchestrator Developer's Guide n Create a Web View Skeleton on page 284 You can create a Web view by creating a Web view skeleton. A Web view skeleton contains no HTML files or Web view components, and requires you to create these elements using Web development tools. n Export a Web View as a Template on page 285 You can use an existing Web view as a template. You can export a Web view as a template, and then edit the exported template to create a Web view.
Chapter 9 Developing Web Views 3 Type a name for the Web view in the Create Web View text box and click OK. 4 Right-click the Web view in the Web view list and select Edit. The Web view editor opens. 5 On the General tab, set the URL folder value to include a suffix for the URL on which Orchestrator will publish the Web view.
vCenter Orchestrator Developer's Guide Create a Web View from a Template You can reduce the amount of development work by creating a Web view from a template. A Web view template is a ZIP file that contains all the files and components of an existing Web view that you can use as the basis from which to create a new Web view. Orchestrator provides a default Web view template that you can use as the starting point for Web view development.
Chapter 9 Developing Web Views What to do next Export the contents of the new Web view to a working folder to modify them, and edit the Web view settings and attributes in the Orchestrator client. Define a Web View Template as a Resource Element Instead of exporting a Web view to your local system for use as a Web view template, you can define a Web view template as a resource element in the Orchestrator server.
vCenter Orchestrator Developer's Guide 7 On the General tab, set the URL folder value to include a suffix for the URL on which Orchestrator will publish the Web view. For example, if you set the URL folder to MyWebView, Orchestrator publishes the Web view at http://orchestrator_server:8280/vmo/MyWebView/, where orchestrator_server is the IP address or DNS name of the machine on which the Orchestrator server is running.
Chapter 9 Developing Web Views Configure the Server for Web View Development During the Web view development process, you can configure the Orchestrator server to publish the Web view from a working folder rather than from the Orchestrator server. When the server runs in development mode, you can preview the Web view as you develop it, without having to import it to the Orchestrator server to view it. You set the Orchestrator server to Web view development mode in the Orchestrator configuration interface.
vCenter Orchestrator Developer's Guide 10 Verify that your Web view's URL folder value matches the name of your working directory. For example, if you created the working folder C:\Documents and Settings\username\Desktop\MyWebView\, set the URL folder to MyWebView. 11 a If the Web view is running, right-click the Web view and select Unpublish. b Right-click the Web view and select Edit.
Chapter 9 Developing Web Views Procedure 1 Click the Web Views view in the Orchestrator client. 2 Right-click the Web view and select Edit. 3 Click the Attributes tab in the Web view editor. 4 Right-click in the Attributes tab and select Add attribute. 5 Click the attribute name and type a name. 6 Click the attribute Type link and select the attribute type from the list. 7 Click the attribute Value link and type or select the value of the attribute.
vCenter Orchestrator Developer's Guide 9 Click Value and type the name of the resource element or category of resource elements in the Search text box. 10 Select the resource element or category of resource elements from the proposed list and click Select. 11 Click Save and Close to exit the editor. You added a resource element or category of resource elements as an attribute in a Web view.
Chapter 9 Developing Web Views Procedure 1 Click the Web Views view in the Orchestrator client. 2 Right-click the Web view to publish and select Publish. Orchestrator publishes the Web view at http://orchestrator_server:8280/vmo/web_view_url_folder/. The IP address or DNS name of the machine on which the Orchestrator server is running is orchestrator_server. The name of the Web view URL folder is web_view_url_folder.
vCenter Orchestrator Developer's Guide Table 9-1. Contents of the Web View Template default.html File Code Description tags You can insert Web view components in any type of HTML tag. The Web view template wraps all its content in tags, to show that this code is specific to Orchestrator. jwcid="@layout/MyBorder" A reference to the MyBorder Web view component from the default Web view template. The MyBorder component defines the borders of the Web view pages.
Chapter 9 Developing Web Views Reference a Tapestry Component in an HTML Page You add Tapestry components to a Web view by adding a jwcid attribute to an HTML tag in a Web page. The jwcid attribute references a Web view component. You can add a jwcid attribute to any HTML tag. You can add references to components from the Orchestrator Web view component library, to components from the Tapestry Standard, or to custom components that you create.
vCenter Orchestrator Developer's Guide You can precede the @ character with a unique identifier. With the unique identifier, you can reuse the class throughout the HTML page, by referencing the unique identifier. In the following example, the component is Border and the unique identifier is myBorderComponent.
Chapter 9 Developing Web Views Example: Web View Template Access.html File | Logout WebviewComponent Class The ch.dunes.web.webview.WebviewComponent class is the main class for Web view components. All Web view component specification JWC files must implement this class.
vCenter Orchestrator Developer's Guide Method Returns Description translateParameters(java.util.List parametersValues) java.lang.Object[] If the object value is a string that begins with "attribute:", translateParameters translates an array of objects into a FinderResult object. If the string does not begin with "attribute:", it does nothing. getClientId() java.lang.String Obtains the ID of the client. setClientId(java.lang.String id) void Sets the ID of the client. getDojoSource() org.apache.
Chapter 9 Developing Web Views Method Returns Description executeAction(java.lang.String actionAttributeName, java.lang.Object actionParameters) java.lang.Object Runs an action in the server and returns the result. getAbsoluteUrl(java.lang.String relativeUrl) java.lang.String Returns the absolute URL from a relative URL. getAttribute(java.lang.String attributeName) java.lang.Object Returns the Web view attribute of the specified name. Use this method instead of getAttributes().
vCenter Orchestrator Developer's Guide WebObjectComponent Class The ch.dunes.web.webview.components.WebObjectComponent class provides methods to obtain information from objects in the Orchestrator server. The WebObjectComponent class extends WebviewComponent. You use the WebObjectComponent class in conjunction with vmo:ListPane components. The vmo:ListPane component inserts a list of objects into a Web view.
Chapter 9 Developing Web Views
Object ID | |
Orchestrator Tapestry Component Library Orchestrator has a library of Tapestry components that you can reference in Web views. You can also use all the components that the Tapestry Framework 4.0 standard defines.vCenter Orchestrator Developer's Guide Example: vmo:IfMemberOf Component The following example shows how to use the vmo:IfMemberOf component to add information about a user's LDAP group membership to a Web view. You are a member of the group defined by the adminGroup attribute. You are not a member of the group defined by the adminGroup attribute.
Chapter 9 Developing Web Views The following example code line references a Web view attribute that contains a path to a CSS file. You create Web view attributes in the Orchestrator client. vmo:IncludeWorkflowHeader Component You use the vmo:IncludeWorkflowHeader component in conjunction with the vmo:WebformContainer to display a Web form in a Web view.
vCenter Orchestrator Developer's Guide Name Type Description url String The URL of the content of the list. Returns a JavaScript Object Notation (JSON) string. detailUrl String The URL of the HTML page in which to display the details of an object in the list. The HTML page that detailUrl refers to must include a reference to a Web view component that implements the WebObjectComponent class. detailParameterName String Name of the parameter that stores the ID of the item. Default is itemId.
Chapter 9 Developing Web Views