Skip to content

A demo using the SAS Open Metadata Interface (IOMI) from .NET

License

Notifications You must be signed in to change notification settings

paulhomes/DotNetOMIDemo

Repository files navigation

DotNetOMIDemo

DotNetOMIDemo is a demo of using the SAS® Open Metadata Interface (OMI) from the .NET platform.

The SAS Open Metadata Interface allows programmers to interoperate with a SAS Metadata Server to query, add, update and delete metadata for a SAS platform installation.

Whilst I've spent a few years working with the SAS OMI from Java, I've only recently started using it on the .NET platform. There are plenty of Java based examples of using the SAS OMI but I couldn't find any .NET examples. This demo serves as a .NET example for me to refer back to when I need it and perhaps might also help others too.

It's a console application which connects to a metadata server, using connection attributes specified on the command line, to execute an IOMI method and print the resulting XML to the console.

The demo uses the lower level IOMI class to work with the SAS metadata server through its XML interface. It shows how to obtain a connection to a SAS metadata server programmatically (without using any XML config files) and then executes a specified IOMI method (specified in the task option and defaults to GetRepositories).

The following tasks names can be used to execute the same named IOMI method:

  • GetRepositories lists the available metadata repositories.
  • GetNamespaces lists the namespaces (SAS and REPOS).
  • GetTypes lists the metadata model types in a specified namespace.
  • GetTypeProperties lists the properties (attributes and associations) for a specified metadata model type in a specified namespace.
  • GetSubtypes lists the immediate sub-types for a specified metadata model type in a specified namespace.
  • GetMetadataObjects lists all metadata objects for a specified metadata model type in a specified namespace.

This git repository depends upon but does not include any SAS software or libraries. If you want to build and run this demo you must have seperately licensed and installed SAS software from SAS Insitute Inc. This demo is not associated with, endorsed by, or sponsored by SAS Institute Inc. and has no official or unofficial affiliation with SAS Institute Inc.

License

DotNetOMIDemo is licensed under the terms of the MIT License. See LICENSE.md for more information.

DotNetOMIDemo includes source code from the Command Line Parser Library Copyright (c) 2005 - 2012 Giacomo Stelluti Scala. Command Line Parser Library is also licensed under the MIT License.

Dependancies

This demo has the following dependancies:

Microsoft Visual Studio and .NET Framework

You will need Microsoft Visual Studio in order to build the demo. I used the free Microsoft Visual Studio Express 2012 for Windows Desktop. The demo has been configured to use the .NET Framework Version 4.

Command Line Parser Library

DotNetOMIDemo uses the Command Line Parser Library for it's command line option handling capabilities. For convenience this dependancy has been handled via source code inclusion as documented here. No additional steps are requried to handle this dependancy, but if a newer version is available you may want to fork this demo to update the commandline source code or convert it to an assembly dependancy instead.

SAS Integration Technologies

In addition to having a SAS platform installation with a SAS metadata server to connect to, in order to build and run this demo, you will need to have installed the SAS Integration Technologies Client. This client provides the necessary SAS assemblies that constitute the .NET callable SAS Open Metadata Interface. You will already have the SAS Integration Technologies Client installed if you have installed SAS Enterprise Guide or the SAS Add-in for Microsoft Office.

Building the Demo

Open the DotNetOMIDemo.sln file in Microsoft Visual Studio. Resolve any broken references to the SAS assemblies by pointing to the location of your SAS Integration Technologies Client installation. The demo includes references to the following SAS assemblies (which for me are all in C:\Program Files\SAS\SharedFiles\Integration Technologies):

  • UserContext.dll
  • Utilities.dll
  • SASOMIInterop.dll

Use the BUILD > Build Solution menu items to generate the DotNetOMIDemo.exe file in the bin/Release directory. If you have the SAS Integration Technologies Client references correctly resolving you should also find some SAS DLLs have been copied into this directory too.

Running the Demo

Once you have successfully built the demo you can run the DotNetOMIDemo.exe command from the bin/Release directory. You will need to provide the appropriate connection attributes for your SAS metadata server. This includes the metadata server's host name and port number as well as an appropriate user id and password. The password can be specified as plain text or in SAS pwencode format.

Usage

Usage information, together with command line options, can be obtained by running DotNetOMIDemo.exe --help which will generate the following output:

DotNetOMIDemo 1.4
Copyright © 2012-2013 Paul Homes
DotNetOMIDemo is licensed under the terms of the MIT License
<http://opensource.org/licenses/MIT>.
Usage: DotNetOMIDemo.exe --host=<hostname> --port=<port> --user=<user> --password=<password> [--authdomain=<domain>] [--task=<task>] [other task options]
       DotNetOMIDemo.exe --host localhost --port=8561 --user='sasadm@saspw' --password='secret' --task=GetTypes SAS

  -h, --host          SAS metadata server host name (default=localhost)

  -t, --port          SAS metadata server port number (default=8561)

  -u, --user          Required. SAS metadata server user id

  -p, --password      Required. SAS metadata server password

  -d, --authdomain    SAS metadata server authentication domain (default=blank)

  -v, --verbose       Enable verbose output

  -k, --task          Metadata task name (default=GetRepositories)

  --help              Display this help screen.

Examples

Here are a few command line examples:

bin\Release\DotNetOMIDemo.exe -h sasmeta.example.com -t 8563 -u sasdemo -p secret

bin\Release\DotNetOMIDemo.exe --host="sasmeta.example.com" --port=8563 --user="sasdemo" --password="{SAS002}B87C6F3C16DD10DE179AC3C3"

bin\Release\DotNetOMIDemo.exe --host="sasmeta.example.com" --port=8563 --user="sasdemo" --password="{SAS002}B87C6F3C16DD10DE179AC3C3" --task GetRepositories

bin\Release\DotNetOMIDemo.exe --host="sasmeta.example.com" --port=8563 --user="sasdemo" --password="{SAS002}B87C6F3C16DD10DE179AC3C3" --task GetNamespaces

bin\Release\DotNetOMIDemo.exe --host="sasmeta.example.com" --port=8563 --user="sasdemo" --password="{SAS002}B87C6F3C16DD10DE179AC3C3" --task GetTypes REPOS

bin\Release\DotNetOMIDemo.exe --host="sasmeta.example.com" --port=8563 --user="sasdemo" --password="{SAS002}B87C6F3C16DD10DE179AC3C3" --task GetTypes SAS

bin\Release\DotNetOMIDemo.exe --host="sasmeta.example.com" --port=8563 --user="sasdemo" --password="{SAS002}B87C6F3C16DD10DE179AC3C3" --task GetTypeProperties SAS Person

bin\Release\DotNetOMIDemo.exe --host="sasmeta.example.com" --port=8563 --user="sasdemo" --password="{SAS002}B87C6F3C16DD10DE179AC3C3" --task GetSubtypes SAS Identity

bin\Release\DotNetOMIDemo.exe --host="sasmeta.example.com" --port=8563 --user="sasdemo" --password="{SAS002}B87C6F3C16DD10DE179AC3C3" --task GetMetadataObjects SAS Person

Reference Documentation

You may find the following documentation references useful when reviewing or extending this demo:

  • SAS® 9.3 Integration Technologies: Windows Client Developer's Guide:
  • SAS® 9.3 Open Metadata Interface: Reference and Usage: Metadata Access (IOMI Interface)
  • SAS® 9.3 Metadata Model: Reference
  • AuthenticationService Help File from the locally installed SAS Integration Technologies Client (e.g. C:\Program Files\SAS\SharedFiles\Integration Technologies\AuthenticationService.chm)
  • SASObjectManager Help File from the locally installed SAS Integration Technologies Client (e.g. C:\Program Files\SAS\SharedFiles\Integration Technologies\sasoman.chm)

Trademarks

SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.

Other product and company names mentioned herein may be registered trademarks or trademarks of their respective owners.

About

A demo using the SAS Open Metadata Interface (IOMI) from .NET

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages