[an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] Examples Creating Custom Objects
Gold User's Guide
<<< Previous Customizing Gold Objects Next >>>

Examples Creating Custom Objects

Creating a custom object involves defining a new object, adding attributes to the object, and adding actions to the object.

Example 9. Creating a License object to track license usage and charges.

Invoke the Gold control program in interactive mode.

$ goldsh

Create the License Object.

gold> Object Create Name=License Description=License

Successfully created 1 Object

Next, define its attributes. Give each record a unique id (so the record can be more easily modified), a license type that can be one of (Matlab,Mathematica,Compiler,AutoCAD,Oracle), the user who is using it, the start and end time, how many instances of the license were used, and how much was charged.

gold> Attribute Create Object=License Name=Id DataType=AutoGen PrimaryKey=True Description="Record Id"

Successfully created 1 Attribute

gold> Attribute Create Object=License Name=Type DataType=String Required=True Values="(Matlab,Mathematica,Compiler,AutoCAD,Oracle)" Fixed=True Description="License Type"

Successfully created 1 Attribute

gold> Attribute Create Object=License Name=User Required=True Values="@User" Description="User Name"

Successfully created 1 Attribute

gold> Attribute Create Object=License Name=StartTime DataType=TimeStamp Description="Start Time"

Successfully created 1 Attribute

gold> Attribute Create Object=License Name=EndTime DataType=TimeStamp Description="End Time"

Successfully created 1 Attribute

gold> Attribute Create Object=License Name=Count DataType=Integer Description="Number of Licenses Used"

Successfully created 1 Attribute

gold> Attribute Create Object=License Name=Charge DataType=Currency Description="Amount Charged"

Successfully created 1 Attribute

Finally, designate the actions you want to allow on the object. The standard set of actions includes Create, Query, Delete, Modify, and Undelete. If you would like to manage licenses from the web GUI, set Display=True.

gold> Action Create Object=License Name=Create Display=True Description=Create

Successfully created 1 Action

gold> Action Create Object=License Name=Query Display=True Description=Query

Successfully created 1 Action

gold> Action Create Object=License Name=Modify Display=True Description=Modify

Successfully created 1 Action

gold> Action Create Object=License Name=Delete Display=True Description=Delete

Successfully created 1 Action

gold> Action Create Object=License Name=Undelete Display=True Description=Undelete

Successfully created 1 Action

When done, exit the goldsh prompt.

gold> quit

That's about it. Licenses should now be able to be managed via the GUI and goldsh. The data source will need to use one of the methods of interacting with Gold (see Methods of interacting with Gold) in order to push license record usage info to Gold.

Apart from being used as an Allocation Manager, Gold can be used as a generalized information service. It can be used to manage just about any object oriented information over the web. For example, Gold could be used to provide meta-schedulers with machine/user mappings, or node/resource information.

Example 10. Using Gold as a Grid Map File.

Invoke the Gold control program in interactive mode.

$ goldsh

Create the GridMap Object.

gold> Object Create Name=GridMap Description="Online Grid Map File"

Successfully created 1 Object

Next, define its attributes. Each entry will consist of a userid (which will serve as the primary key) and a required public X.509 certificate.

gold> Attribute Create Object=GridMap Name=User PrimaryKey=True Values=@User Description="User Name"

Successfully created 1 Attribute

gold> Attribute Create Object=GridMap Name=Certificate DataType=String Required=True Description="X.509 Public Key"

Successfully created 1 Attribute

Finally, designate the actions you want to allow on the object. If you would like to manage certificates from the web GUI, set Display=True.

gold> Action Create Object=GridMap Name=Create Display=True Description=Create

Successfully created 1 Action

gold> Action Create Object=GridMap Name=Query Display=True Description=Query

Successfully created 1 Action

gold> Action Create Object=GridMap Name=Modify Display=True Description=Modify

Successfully created 1 Action

gold> Action Create Object=GridMap Name=Delete Display=True Description=Delete

Successfully created 1 Action

gold> Action Create Object=GridMap Name=Undelete Display=True Description=Undelete

Successfully created 1 Action

Exit the goldsh prompt.

gold> quit

From this point, a peer service will need to use one of the methods of interacting with Gold (see Methods of interacting with Gold) in order to query the GridMap information.


<<< Previous Home Next >>>
Adding an Action to an Object Up Integration with the Resource Management System
[an error occurred while processing this directive] [an error occurred while processing this directive]