Meta Data Services Programming

Accessing a Script

A script must run within the transaction of the calling program. When scripts encounter an unhandled error or exception, the repository engine reads the error information and populates the repository error queue appropriately. To minimize syntax errors in the script, you can use the ValidateScript method to perform a syntax check prior to script invocation.

To execute the script, the repository engine uses the Microsoft® ActiveX® Scripting Engine (VBScript) by default. If you require a more powerful scripting engine, you must instantiate that service from within your script.

There are three different ways to access a script. The first invokes a method; the other two get or put a property.

Invoking a Method

When a script provides the implementation code for a method definition object, you must access the script through method invocation.

When you invoke the method, the repository engine automatically executes the associated script. If there is no associated script, the repository engine returns the error message E_NOTIMPL.

Getting and Putting Properties

You can create a script that validates a property before inserting the value of that property into the repository database. In this case, your script (rather than the repository engine) validates the value, gets the value, and puts the value. If you are accessing script to validate a property before storing it in a repository database, you must create Get and Put methods that are associated with a property.

When you create scripts to retrieve and assign properties, you must always define both Get and Put operations in the same script.

See Also

Defining Script Objects

Get Method for Scripted Properties

Handling Errors

Method Invocation for Scripted Methods

Put Method for Scripted Properties