Metadata Interface Reference and Usage
Metadata Interface Reference and Usage
4 Open Metadata
®
SAS® Documentation
The correct bibliographic citation for this manual is as follows: SAS Institute Inc. 2016. SAS® 9.4 Open Metadata Interface: Reference and Usage,
Third Edition. Cary, NC: SAS Institute Inc.
SAS® 9.4 Open Metadata Interface: Reference and Usage, Third Edition
Copyright © 2016, SAS Institute Inc., Cary, NC, USA
What’s New in SAS 9.4 Open Metadata Interface: Reference and Usage . . . . . . . . . . . . ix
PART 1 Concepts 1
Chapter 1 • Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
About This Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Installation Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Audience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
What Is the SAS Open Metadata Architecture? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
What Can I Do with the SAS Open Metadata Interface? . . . . . . . . . . . . . . . . . . . . . . . . . 6
Authentication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Authorization Facility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Chapter 3 • Using Interfaces That Read and Write Metadata in SAS 9.4 . . . . . . . . . . . . . . . . . . . 19
Overview of Using Interfaces That Read and Write Metadata . . . . . . . . . . . . . . . . . . . . 19
What Is the SAS Type Dictionary? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Content of a Type Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Requirements for Using the Type Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Benefits of the SAS Type Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
GetCredentials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
GetIdentity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
GetInfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
GetInternalLoginSitePolicies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
GetInternalLoginUserInfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
GetLoginsforAuthDomain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
IsAuthorized . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
IsInRole . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
SetInternalLoginUserOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
SetInternalPassword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
Overview
In SAS 9.4, the Pause, Refresh, Resume, and Stop methods support new XML elements
in the OPTIONS parameter that enable users to specify whether the methods should be
executed only on the connected SAS Metadata Server or on all SAS Metadata Servers in
the cluster:
<CLUSTER/>
Specifies to execute the request on all SAS Metadata Servers in the cluster.
<SINGLE_SERVER/>
Specifies to execute the request only on the connected SAS Metadata Server.
For more information about these optional elements, see “Pause” on page 208,
“Refresh” on page 211, “Resume” on page 220, and “Stop” on page 237.
The IServer Status method supports new XML elements in the INMETA parameter to
return information about a server cluster and the cluster’s status in relationship to the
quorum:
<CLUSTER attributes/>
Returns values for specified cluster attributes. Valid attributes are CLUSTERGUID=,
DEFINED_NODES=, CURRENT_NODES=, HAS_FIRST_NODE=,
HAS_QUORUM=, and LIST=.
<CLUSTERSTATE/>
Returns information about the cluster’s availability. Valid return values are
STARTING, QUORUM, or LOSTQUORUM.
x What’s New in SAS 9.4 Open Metadata Interface: Reference and Usage
Beginning in the second maintenance release for SAS 9.4, the SAS Metadata Server
sends alert email reminders in addition to the initial alert email message for the alert
condition the journal commit task stopped running. The SAS Metadata
Server terminates itself if the alert condition is not addressed within a defined grace
period. The IServer Status method provides the following optional XML elements in the
INMETA parameter to return information about the omaconfig.xml options that
configure that functionality.
<OMA ALERT_CONDITION_FREQUENCY=" "/>
Returns the amount of time that will elapse before the initial and subsequent alert
email reminders about the alert condition will be sent. The time value is returned in
seconds. The default value is 21,600 seconds (six hours).
<OMA ALERT_CONDITION_GRACE_PERIOD=" "/>
Returns the amount of time that the alert condition will be allowed to persist before
the SAS Metadata Server shuts itself down. The time value is returned in seconds.
The default value is 259,200 seconds (three days).
The Status method also accepts a new subelement within the <Scheduler/> XML
element to return information about alert conditions:
<Scheduler><AlertConditions/></Scheduler>
Specify the <AlertConditions/> subelement to determine whether an alert condition
exists on the specified SAS Metadata Server. If an alert condition exists, the
subelement returns an <AlertCondition/> XML element and an <ExpirationTime/>
XML element. The <AlertCondition/> element includes the error and a datetime
value representing the time at which the error occurred. The <ExpirationTime/>
element includes the server’s scheduled termination time.
For more information, see “Status” on page 222.
Enhancements to the IOMI Server Interface xi
Beginning in the third maintenance release for SAS 9.4, the Status method supports an
XML element in the OPTIONS parameter.
<CLUSTER/>
specifies to execute the request in the INMETA parameter on the master server. In a
clustered metadata server configuration, a slave node processes Status requests by
default. A load-balancing algorithm that operates outside of the SAS Open Metadata
Interface controls which node gets the request. Some cluster XML elements, such as
<CLUSTER List=" "/> and <CLUSTER CurrentNodes= " "/>, return meaningful
information only when they are processed by the master server. When specified in a
Status request, the <CLUSTER/> element submits the contents of the INMETA
parameter directly to the master server. There is no need to know or specify server
connection parameters. In previous releases of SAS 9.4, you had to use PROC
METADATA with METHOD=STATUS, specify the NOREDIRECT argument, and
specify connection parameters for the master server to connect to the master server.
This parameter has no effect in a single metadata server configuration.
The SAS Metadata Server cluster has a synchronization check feature. This feature is
invoked through the SAS Management Console Metadata Manager Analyze/Repair
wizard or the sas-analyze-metadata batch tool. The Status method supports the following
XML element in the INMETA parameter to return information about synchronization
check:
<SynchCheck><Results OptionalAttribute(s)=" "/></SynchCheck>
reports the results of the last synchronization check on the slave node that received
the Status query. By default, the query returns the Id value and Name value of all
repositories that were examined and a <Container/> XML element that specifies the
name of any metadata type container in which an error was found. Optional
attributes are available to request comprehensive output and to request information
for a named repository.
For information about <CLUSTER/>, see “Status” on page 222. For more information
about <SynchCheck/>, see the following topic for the Status method: “Cluster
Information Elements” on page 225.
Documentation Enhancements
In the second maintenance release for SAS 9.4, the XMLSELECT documentation was
enhanced to include the new topic: “Controlling XMLSELECT Query Size” on page
348.
1
Part 1
Concepts
Chapter 1
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Chapter 2
Client Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Chapter 3
Using Interfaces That Read and Write Metadata in SAS 9.4 . . . . . . . . 19
2
3
Chapter 1
Introduction
interfaces should be reserved for tasks that cannot be performed with the SAS Java
Metadata Interface.
SAS provides SAS language interfaces to metadata, such as PROC METADATA and
SAS metadata DATA step functions, to enable SAS programmers to submit SAS Open
Metadata Interface method requests either directly or indirectly within SAS.
This book is organized in four parts:
• Part 1, Concepts, provides an overview of the SAS Open Metadata Architecture and
the SAS Open Metadata Interface server interfaces. It provides information that is
needed by all clients to connect to and communicate with the SAS Metadata Server.
• Part 2, SAS Java Metadata Interface, describes how to use the SAS Java Metadata
Interface to produce clients that create, read, and update metadata. Reference
information about SAS Java Metadata Interface methods is provided as Java class
documentation. You can view a Web-enabled version of the Java class
documentation at support.sas.com/94api.
• Part 3, Server Interfaces, contains reference information about SAS Open Metadata
Interface server interfaces. There are four server interfaces:
• IOMI — metadata access interface
• ISecurity — metadata authorization interface
• ISecurityAdmin — security administration interface
• IServer — server control interface
IOMI information is provided for PROC METADATA users. PROC METADATA
enables users to submit IOMI method calls that are formatted for the DoRequest
method through its interface.
• Part 4, IOMI Server Interface Usage, contains IOMI usage information that is helpful
to all clients issuing metadata access method calls, whether clients are using the SAS
Java Metadata Interface, IOMI methods directly, or one of the SAS language
interfaces to metadata.
Installation Requirements
Both the SAS Open Metadata Interface and SAS Java Metadata Interface are shipped as
part of Base SAS software. The SAS Open Metadata Interface uses the Integrated Object
Model (IOM) to communicate with the SAS Metadata Server. Currently, this interface
supports Java and SAS clients.
The following software must be accessible from computers where you will develop SAS
Open Metadata Interface clients:
• SAS Versioned Jar Repository (VJR)
• SAS Integration Technologies software appropriate for the client
• software for the intended programming environment
See “JRE and JAR Requirements” on page 28 for information about SAS Java
Metadata Interface requirements.
Both the SAS Open Metadata Interface server interfaces and SAS Java Metadata
Interface are contained in the VJR. The VJR is installed when the SAS Intelligence
Platform Object Framework or SAS Management Console is installed. For easy access
What Is the SAS Open Metadata Architecture? 5
to the VJR, we recommend the SAS AppDev Studio development environment. For
more information about the VJR, see the SAS AppDev StudioUser’s Guide at
support.sas.com/rnd/appdev.
SAS language interfaces to metadata such as PROC METADATA and SAS metadata
DATA step functions simply need access to Base SAS 9.4 software.
Prerequisites
• You must have access to a properly configured SAS Metadata Server to create and
access metadata. A properly configured metadata server has a foundation repository
that contains standard SAS metadata. The SAS Deployment Wizard installs and
configures a metadata server for you. An existing SAS 9.2 Metadata Server or SAS
9.3 Metadata Server can be migrated to the SAS 9.4 environment by using the SAS
Migration Utility and SAS Deployment Wizard. For more information, see the SAS
Intelligence Platform: Migration Guide.
• To connect to the SAS Metadata Server, you must be able to authenticate to the
server. To create and update metadata, you must have proper authorization to
metadata repositories. For more information, see the SAS Intelligence Platform:
Security Administration Guide.
Audience
This book provides information for developers who are producing or maintaining clients
that access metadata, secure metadata, or manage the SAS Metadata Server.
It is the primary source of information for developers who are producing SAS Java
Metadata Interface and SAS Open Metadata Interface clients.
It is a secondary source of information for users of the SAS language interfaces to
metadata. The SAS language interfaces to metadata are described in SAS Language
Interfaces to Metadata. Users of the SAS language interfaces to metadata need
information from this book to be able to format the XML method calls that can be
submitted with PROC METADATA.
The SAS Metadata Server uses information stored in repository objects to access the
metadata repositories. It uses the SAS Repository Manager to manage the metadata
repositories. The application metadata types are used in various combinations by
clients to create metadata that describes application data or entities that are used by
an application. The metadata model defines valid relationships between metadata
types, uses the inheritance of attributes and associations to affect common behaviors,
and uses subclassing to extend behaviors.
• The SAS Open Metadata Interface provides methods for reading and writing
metadata objects in repositories. It also provides methods for administering
repositories and the SAS Metadata Server, for defining and administering access
controls on application metadata objects and repositories, and for getting
authorizations based on the metadata access controls.
• The SAS Metadata Server is a server that surfaces metadata from one or more
repositories through the SAS Open Metadata Interface. The SAS Metadata Server
uses the Integrated Object Model (IOM) from SAS Integration Technologies. IOM
provides distributed object interfaces to Base SAS software and enables you to use
industry-standard languages, programming tools, and communication protocols to
develop clients that access Base SAS features on IOM servers. The purpose of the
SAS Metadata Server is to provide a central, shared location for accessing metadata.
• Define access controls on resources and request authorization decisions from the
SAS Open Metadata Architecture authorization facility.
Authentication
The SAS Metadata Server supports a variety of authentication providers to determine
who can access the SAS Metadata Server. It also defines privileged users. Only a user
who has been granted unrestricted user status on the SAS Metadata Server has
unrestricted access to metadata on the SAS Metadata Server. Only a user who has been
granted either unrestricted user status or administrative user status on the SAS Metadata
Server can create and delete repositories, modify a repository's registrations, change the
state of a repository, and register users. For more information about metadata server
authentication and privileged users, see the SAS Intelligence Platform: Security
Administration Guide.
Authorization Facility
The SAS Metadata Server uses an authorization facility to control access to metadata
repositories and to specific metadata in the metadata repositories. Authorization
processes are insulated from metadata-related processes in the SAS Metadata Server.
The authorization facility provides an interface for querying authorization metadata that
is on the metadata server, and returns authorization decisions based on rules that are
stored in the metadata.
The SAS Metadata Server uses the authorization facility to make queries about
ReadMetadata and WriteMetadata permissions on metadata and enforces the decisions
that are returned by the authorization facility. It is not necessary for SAS Open Metadata
Interface clients to enforce authorization decisions regarding the ReadMetadata and
WriteMetadata permissions.
SAS Open Metadata Interface clients can use the authorization facility to request
authorization decisions on other types of access (for example, to request authorization
decisions on data that is represented by SAS metadata). For example, other SAS IOM
servers define and enforce Read, Write, Create, and Delete permissions on data that is
represented by metadata. Applications that use the authorization facility to request
authorization decisions on application-defined actions and objects must enforce the
authorization decisions themselves.
The authorization facility's interface consists of a set of methods that are available in the
ISecurity server interface. For more information, see Chapter 8, “Authorization
(ISecurity Interface),” on page 129. Security administration methods are available in the
ISecurityAdmin server interface. For more information, see Chapter 9, “Security
Administration (ISecurityAdmin Interface),” on page 171.
For information about the types of access controls supported by the authorization facility
and how the authorization facility makes authorization decisions, see the SAS
Intelligence Platform: Security Administration Guide.
8 Chapter 1 • Introduction
9
Chapter 2
Client Requirements
Clients use repository objects to register repositories in the SAS Repository Manager, to
modify a repository’s registered access mode, or to get information about repository
availability.
A client that controls access to the SAS Metadata Server does so to interrupt client
activity so that maintenance tasks can be performed. Examples of maintenance tasks are
recovering memory, running metadata analysis and repair tools, or changing certain
server configuration and invocation options while the server is offline. For SAS 9.4,
which supports clustering of metadata servers to provide redundancy and high
availability, options are available to execute server control requests on specific servers or
uniformly on all servers in the cluster.
The SAS authorization facility supports resource-based authorization and role-based
authorization.
A client that defines resource-based authorization enables administrators to define and
manage access controls on the metadata that describes the resources. Access controls can
be defined directly on the metadata that describes a resource, or they can be defined in
an access control template (ACT) that is associated with many resources. A client that
manages access controls enables administrators to list identities that have permissions on
a resource. Administrators can also list permissions that are defined directly on a
resource, list permissions that are defined in an ACT, and apply and remove ACTs from
a resource. Administrators can create an ACT, modify the attributes of an ACT, and
destroy an ACT.
A client that requests authorizations based on resource-authorization settings queries the
SAS Open Metadata Architecture authorization facility to determine whether the
specified user has appropriate permission to a requested resource based on active access
controls. Then, depending on the decision, the SAS authorization facility either enforces
the decision or allows the SAS Metadata Server to enforce the decision. The SAS
Metadata Server enforces ReadMetadata and WriteMetadata permissions to a resource.
A client that wants to enforce other permissions on a resource must do so itself. For
information about the default access controls supported by the SAS authorization
facility, and how the SAS authorization facility works, see the SAS Intelligence
Platform: Security Administration Guide.
A client that defines role-based authorization identifies application actions that will be
controlled as metadata. Administrators can assign identities to the roles. The
GetApplicationActionsAuthorizations method enables clients to request decisions based
on role membership.
A client that creates and manages internal user accounts creates internal logins, and
modifies their authentication settings for the task.
Appropriate identity, permission, resource, ApplicationAction, and Role objects must be
defined in the SAS Metadata Server for authorizations to be meaningful. For detailed
information about the security features that are available through the SAS Open
Metadata Architecture authorization facility, see the SAS Intelligence Platform: Security
Administration Guide.
For information about methods that can be used to back up and recover the SAS
Metadata Server, see “Backing Up and Recovering the SAS Metadata Server” on page
16.
Important Terms
To create a metadata client, you must be familiar with the following terms:
Creating and Accessing Metadata That Describes Application Elements 11
metadata type
specifies a SAS Metadata Model metadata type that models the metadata for a
resource. For example, the metadata type Column models the metadata for a SAS
table column, and the metadata type RepositoryBase models the metadata for a
repository. The SAS Metadata Model defines approximately 170 metadata types.
namespace
specifies a group of related metadata types. A namespace is used to partition
metadata into different contexts. The SAS Open Metadata Interface defines two
namespaces: SAS and REPOS. The SAS namespace contains metadata types that
describe application elements. The REPOS namespace contains metadata types that
describe repositories.
metadata object
specifies an instance of a metadata type.
metadata type property
is a term that collectively refers to the attributes and associations that are defined for
a metadata type in the SAS Metadata Model. An attribute describes a characteristic
of the metadata type. An association describes a relationship between an object of
this metadata type and an object of another metadata type.
Creating Repositories
Before you can create application metadata in a SAS Metadata Repository, you must
create metadata that defines at least one SAS Metadata Repository. The SAS Open
Metadata Interface can be used to create a SAS Metadata Repository, but this is not the
recommended way. If you perform a SAS planned installation to set up your SAS
Metadata Server, the SAS Deployment Wizard creates the first repository — a
foundation repository — for you. If additional repositories are needed, we recommend
that you create them with SAS Management Console because it creates default metadata
in the repositories for you. For more information about defining and managing SAS
metadata repositories, see the SAS Intelligence Platform: System Administration Guide.
For server connection information, see “Connecting to the SAS Metadata Server” on
page 12.
For a description of the metadata types in the SAS namespace, see “Alphabetical Listing
of SAS Namespace Types” in the SAS Metadata Model: Reference.
The SAS Open Metadata Interface provides the IOMI server interface for reading and
writing metadata objects. For more information about IOMI, see Chapter 7, “Metadata
Access (IOMI Interface),” on page 69.
We recommend that clients use the SAS Java Metadata Interface to read and write
metadata instead of using IOMI methods directly. For reference information about the
SAS Java Metadata Interface, see the documentation at support.sas.com/94api. For usage
information, see Chapter 6, “Using the SAS Java Metadata Interface,” on page 39.
Beginning in SAS 9.3, a SAS type dictionary affects the SAS Metadata Model metadata
types that clients should select to represent common and shared application entities.
Objects need to store specific attribute values to ensure that the dictionary is used in
metadata queries. For more information about the SAS type dictionary, see Chapter 3,
“Using Interfaces That Read and Write Metadata in SAS 9.4,” on page 19.
Available Interfaces
The SAS Metadata Server is an object server; it uses the Integrated Object Model (IOM)
provided by SAS Integration Technologies to communicate with clients. SAS Integration
Technologies provides interfaces that enable clients to connect to the SAS Metadata
Server generically as an IOM server. When you use these interfaces, you must be
familiar with the interfaces and classes that define the SAS Metadata Server and the SAS
Open Metadata Interface server interfaces. In addition, you must know how to read and
write an XML document to use the metadata access functionality of the IOMI server
interface.
As an alternative to the SAS Integration Technologies interfaces, SAS provides the SAS
Java Metadata Interface. The SAS Java Metadata Interface hides the details of IOM
servers and the steps of how to create a connection to a SAS Metadata Server from the
client. It provides a Java object interface to the metadata access functionality of the SAS
Open Metadata Interface. This object interface defines an interface for each SAS
Metadata Model metadata type. These interfaces enable clients to use getter and setter
methods to read and write metadata attributes and associations, instead of requiring
clients to submit XML metadata property strings that define values, like the IOMI
methods do. In addition, these interfaces provide methods for connecting to the SAS
Connecting to the SAS Metadata Server 13
Metadata Server with the ISecurity, ISecurityAdmin, and IServer server interfaces, so
that clients do not need to know the details of their implementation.
Because of its ease of use, the SAS Java Metadata Interface is recommended over the
SAS Integration Technologies interfaces, both for performing metadata access tasks and
for connecting to the SAS Metadata Server with the non-metadata server interfaces.
For examples of the statements that are required to establish a connection to the SAS
Metadata Server with the SAS Java Metadata Interface, see “Sample Program” on page
52. The sample program is a metadata access client.
For more information about connecting with the non-metadata server interfaces, see
Chapter 8, “Authorization (ISecurity Interface),” on page 129, Chapter 9, “Security
Administration (ISecurityAdmin Interface),” on page 171, and Chapter 10, “Server
Control (IServer Interface),” on page 205.
Standard Interface
A request is submitted by declaring object variables that represent the method’s
parameters in the client, and then referencing the object variables in the method request.
In this documentation, we refer to this way to submit requests as the “standard
interface.” The standard interface is supported for the SAS Java Metadata Interface and
all of the SAS Open Metadata Interface server interfaces.
When you submit a request using the standard interface, the SAS Metadata Server does
not require you to use the published parameter names for the object variables. However,
if you use different parameter names, the names in the object variable declarations must
also be used to represent the method’s parameters in the method request. For example,
consider the GetMetadata method.
In the standard interface, a GetMetadata request is submitted as follows:
inMetadata= "<PhysicalTable Id="A5345678.A5000001" Name="" Desc="">
<Columns/>
</PhysicalTable>";
ns="SAS";
Communicating with the SAS Metadata Server 15
flags=0;
options="";
You do not have to use the parameter names INMETADATA, OUTMETADATA, NS,
FLAGS, and OPTIONS in the object variable declarations. However, the same names
that you use in the object variable declarations must be used in the method syntax. The
names must be specified in the order in which they are presented in the method’s
documentation.
DoRequest Interface
The SAS Open Metadata Interface IOMI server interface and the Status method from the
IServer server interface can be submitted to the SAS Metadata Server using the
DoRequest interface. The DoRequest interface is based on the IOMI DoRequest method.
The DoRequest method is a messaging method whose sole purpose is to submit another
method to the SAS Metadata Server. A client declares object variables for the
DoRequest method’s parameters in the client. Then, the client submits another method in
the DoRequest method’s INMETADATA parameter. This other method’s parameters are
formatted in an XML string. For example, consider the GetMetadata method from the
previous example, reformatted for the DoRequest method:
outMetadata=" ";
inMetadata="<GetMetadata>
<Metadata>
<PhysicalTable Id="A5345678.A5000001" Name="" Desc="">
<Columns/>
</PhysicalTable>
</Metadata>
<NS>SAS</NS>
<Flags>0</Flags>
<Options/>
</GetMetadata>";
rc=DoRequest(inMetadata,outMetadata);
The DoRequest interface provides a standard way for a client to submit method requests
to the SAS Metadata Server. Instead of the client parsing the submitted method’s
parameters, the SAS Metadata Server parses them. The format of the XML string is
described in “DoRequest” on page 97. The IOMI reference documentation includes
examples of how to format each method for the DoRequest interface.
Because we recommend the SAS Java Metadata Interface to read and write metadata
(instead of using the IOMI server interface directly), a Java client would not use the
DoRequest interface. However, PROC METADATA accepts IOMI methods that are
formatted for the DoRequest method’s INMETADATA parameter as its input. For an
example of how to submit, from PROC METADATA, an XML string that is formatted
for the DoRequest method, see PROC METADATA documentation in SAS Language
Interfaces to Metadata.
When creating an XML string for the DoRequest method or PROC METADATA, you
must use published parameter names in the XML elements to represent the method
parameters (<NS>, <FLAGS>, <OPTIONS>), with one exception. The submitted
method’s INMETADATA parameter should be represented by a <METADATA>
element, as shown in the example. The method parameters do not need to be specified in
the order in which they are presented in the syntax.
16 Chapter 2 • Client Requirements
The SAS Deployment Wizard uses this facility to configure a default schedule of
unassisted metadata server backups for all new and migrated SAS systems during
installation. The SAS Management Console Metadata Manager provides a graphical user
interface to enable customers to monitor and manipulate backups, modify the default
backup configuration and backup schedule, perform ad hoc backups, and perform
metadata server recovery. A MetadataServer script in the SASMeta/MetadataServer
directory provides a batch interface for the functionality available in SAS Management
Console.
Lower-level access can be obtained by using metadata procedures, such as PROC
METAOPERATE and PROC METADATA, or by issuing IServer Refresh and Status
method requests. However, using metadata procedures and issuing method requests are
not necessary. Directly using the IServer Refresh or Status method is discouraged. The
recommended interface for manipulating, administering, and monitoring server backups
is SAS Management Console.
For information about manipulating, administering, and monitoring server backups with
SAS Management Console, including best practices for incorporating server backups
into the overall backup plan for the SAS Intelligence Platform, see the SAS Intelligence
Platform: System Administration Guide. The MetadataServer script is also documented
in the SAS Intelligence Platform: System Administration Guide.
For information about administering server backups with PROC METAOPERATE and
monitoring server backups with PROC METADATA, see the SAS Language Interfaces
to Metadata. IServer methods are described in Chapter 10, “Server Control (IServer
Interface),” on page 205.
18 Chapter 2 • Client Requirements
19
Chapter 3
Using Interfaces That Read and
Write Metadata in SAS 9.4
association names and secondary metadata types, which compose the logical metadata
definition, in the request.
The SAS Metadata Model is structured to distinguish PrimaryType subtypes from
SecondaryType subtypes to facilitate the metadata type selection process for creating
logical metadata definitions.
Beginning in SAS 9.2, SAS took steps to improve consistency in the look and feel of
SAS applications through the introduction of the SAS Folders tree and a SAS type
dictionary. The SAS Folders tree is a feature of SAS Management Console, SAS Data
Integration Studio, SAS OLAP Cube Studio, and other SAS applications.
In order for an object to appear in the SAS Folder tree, it must be of an object type that is
registered in the dictionary. For object types that are persisted in metadata, an aspect of
the dictionary is that it standardizes the primary metadata type and association names
used to retrieve their logical metadata definition, and makes it easier to retrieve a logical
metadata definition.
This section describes the dictionary and how it affects Read and Write operations with
the interfaces described in this book.
TypeName
specifies a name that uniquely identifies the type definition in the SAS type
dictionary.
Many type definitions use the same SAS Metadata Model metadata type as the
primary object in their logical metadata definition. For example, the type definitions
for both the SASReport and InformationMap object types specify Transformation as
their metadata type. To ensure that the appropriate type definition is used to retrieve
an object type’s logical metadata definition, SAS wizards and procedures that create
metadata store the TypeName value that is appropriate for each object type in the
primary object’s PublicType attribute. When listing objects, the PublicType value is
used with the MetadataType to identify the object type.
ContainerType
specifies the object type that contains the object. This is usually Folder, but it can be
another object type from the SAS type dictionary. For example, a Column object is
contained by a Table object.
ContainerAssociation
specifies the association name that links the primary object in a logical metadata
definition to its container. Object types that are contained by a folder have a Trees
association to the folder. (A folder is represented by an object of the Tree metadata
type in the SAS Metadata Model.) A Column object has a Table association to the
table that contains it.
DefinitionVersion
specifies a double value in the form MMMmmbbbb.0 that indicates the type
definition’s current usage version. M=major version, m=minor version, and b=build.
SupportedObjectVersionMin
specifies a double value in the form MMMmmbbbb.0 that indicates the minimum
usage version supported for this type definition.
SupportedObjectVersionMax
specifies a double value in the form MMMmmbbbb.0 that indicates the maximum
usage version supported for this type definition.
Clients can specify a type definition version for an object by storing a version value in
the primary object’s UsageVersion attribute. The DefinitionVersion,
SupportedObjectVersionMin, and SupportedObjectVersionMax attributes indicate the
range of versions that are available for a type definition. For more information about the
TypeDefinition attributes, see SAS Metadata Model: Reference.
Creating Metadata
SAS provides wizards and procedures to create metadata for the resources and
information assets that are most commonly used and shared among SAS applications.
We recommend that you use these wizards and procedures to create metadata, instead of
coding metadata definitions directly.
If a wizard or procedure does not exist for the metadata that you want to create, and you
have to create a logical metadata definition, the definition must meet the following
requirements:
22 Chapter 3 • Using Interfaces That Read and Write Metadata in SAS 9.4
• Use the metadata type indicated in the appropriate type definition’s MetadataType
attribute for its primary object.
• The primary object should specify the following:
• the type definition’s TypeName value in the PublicType attribute.
• a valid usage version value in the UsageVersion attribute. Most objects are
versioned as 1000000.
• an association to a valid container object, if it is specified in the type definition.
• associations to appropriate secondary objects.
A goal of the SAS type dictionary is to save customers from having to know the details
of an object type’s logical metadata definition. As a result, the type definition
internalizes information that is necessary to retrieve the logical metadata definition. (For
example, the metadata template is not shown in a type definition’s Properties window.)
To determine the association names and secondary metadata types used in an object
type’s logical metadata definition, issue a GetMetadata request on an existing object of
the object type in which you are interested. Set the OMI_FULL_OBJECT (2) flag.
OMI_FULL_OBJECT is a new flag that instructs the SAS Metadata Server to use the
metadata template from an object’s type definition to process the request. The metadata
server will return the full logical metadata definition.
A logical metadata definition that is created with the SAS Open Metadata Interface or
SAS Java Metadata Interface is considered a custom logical metadata definition. SAS
does not guarantee that custom logical metadata definitions will take advantage of the
full functionality of SAS. To ensure that full functionality is available, use SAS wizards
and procedures to create metadata.
SAS does not support custom type definitions.
Querying Metadata
A GetMetadata request retrieves specified attributes and associations of a SAS Metadata
Model metadata object. If you want to get an object’s full logical metadata definition,
specify the appropriate PrimaryType subtype in the INMETADATA parameter, and set
the OMI_FULL_OBJECT (2) flag. The SAS Metadata Server reads the value in the
object’s PublicType attribute to fulfill the request. If the object does not store a value in
the PublicType attribute, then GetMetadata returns specified information for the SAS
Metadata Model metadata object only. For more information about the
OMI_FULL_OBJECT flag, see “Using the OMI_FULL_OBJECT Flag” on page 298.
To list all instances of an object type that is in the type dictionary with a
GetMetadataObjects request, perform the following steps.
1. Specify the MetadataType value from the type definition in the TYPE parameter.
2. Set the OMI_XMLSELECT (128) flag.
3. Submit an <XMLSELECT> element that specifies the object’s TypeName value in
the OPTIONS parameter, as follows:
<XMLSELECT search="@PublicType='TypeName'"/>
Using the TypeName value ensures that the correct type definition is used to process
the GetMetadataObjects request.
For more information about querying objects with the SAS Java Metadata Interface, see
“Getting and Updating Existing Objects” on page 48.
Benefits of the SAS Type Dictionary 23
For more information about querying objects with the SAS Open Metadata Interface, see
Chapter 14, “Getting the Properties of a Specified Metadata Object,” on page 279 and
Chapter 16, “Getting All Metadata of a Specified Metadata Type,” on page 317.
Deleting Objects
A DeleteMetadata request that specifies a PrimaryType subtype always uses the type
dictionary to process the request unless you specify a user-defined template.
For more information about deleting objects with the SAS Java Metadata Interface, see
“Deleting Objects” on page 51.
For more information about deleting objects with the SAS Open Metadata Interface, see
Chapter 19, “Deleting Metadata Objects,” on page 355.
Part 2
Chapter 4
Understanding the SAS Java Metadata Interface . . . . . . . . . . . . . . . . . . 27
Chapter 5
Overview of Interfaces and Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Chapter 6
Using the SAS Java Metadata Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
26
27
Chapter 4
Understanding the SAS Java
Metadata Interface
The object store serves as a container for Java objects that users create to add or modify
metadata objects in the SAS Metadata Server. The following figure illustrates the
relationship between the objects in an object store.
Factory
Server Store
Object Store
Object
AssociationList AssociationList
Object
Work Unit
A SAS Open Metadata Interface metadata object is defined by two types of properties:
• a set of attributes that describe the characteristics of the metadata object instance,
including its name, description, date it was created, and any unique characteristics
• associations that describe its relationships with other metadata objects
Using the SAS Java Metadata Interface, you create a metadata object on the SAS
Metadata Server, or you modify an existing metadata object’s attributes, by creating a
Java object representing its SAS metadata type. You then persist the new or modified
Java object to the SAS Metadata Server. A metadata type refers to one of the metadata
types defined in the SAS namespace of the SAS Metadata Model. Metadata objects live
in the SAS Metadata Server. The Java objects in the object store act as proxies for the
metadata objects in the SAS Metadata Server.
Information about associations is managed separately from information about attributes.
Associations are managed by creating AssociationList objects. An AssociationList
30 Chapter 4 • Understanding the SAS Java Metadata Interface
object stores information about how two metadata objects are related to each other
through an association name. To determine the associations defined for a specific
metadata type, see the “Alphabetical Listing of SAS Namespace Metadata Types” in the
SAS Metadata Model: Reference.
In the figure, Figure 4.1 on page 29, the squares named Object represent metadata
objects, and the squares named AssociationList represent the associations between the
metadata objects. Every relationship in the SAS Metadata Model is a two-way
association. That is, there are two sides to each relationship, and each side has a name.
For example, if the metadata objects in the figure represented a PhysicalTable and a
Column, the PhysicalTable object would have a Columns association to the Column
object. The Column object would have a Table association to the PhysicalTable object.
For more information about associations, see “Understanding Associations” in SAS
Metadata Model: Reference.
For an overview of the interfaces used to create the factory, stores, and other objects, see
“Interfaces and Classes Summary” on page 31.
For information about how to write a SAS Java Metadata Interface client that reads and
writes metadata, see “Overview of Creating a SAS Java Metadata Interface Client” on
page 39.
For documentation about specific classes and methods, see the SAS Java Metadata
Interface at support.sas.com/93api.
31
Chapter 5
Overview of Interfaces and
Classes
Table 5.1 com.sas.metadata.remote Interfaces and Classes for Reading and Writing
Metadata
If the object factory does not need to be used in a remote environment—that is, it does
not need to be available to remote Java Virtual Machines (JVMs)—you can pass in a
false value to the constructor. As a result, the factory behaves as if it is running in a
local, single JVM environment.
The object factory is instantiated once for each user. If the application is intended to
support multiple users, such as a Web application, a separate object factory needs to be
created for each user.
stores information about a metadata object's attributes and its potential associations. You
can use this method to create an object that represents a new or existing object.
The following are examples of the createComplexMetadataObject method. To create an
object that represents a new metadata object, specify:
MdFactory.createComplexMetadataObject(myNewObjectName,
metadata_type,
8char_target_repository_identifier)
To create an object that represents an existing metadata object on the SAS Metadata
Server, specify:
MdFactory.createComplexMetadataObject(ObjectName,
metadata_type,
identifier_of_existing_metadata_object)
An alternate — and preferred — approach for creating objects for an existing metadata
object is to issue a getMetadata or getMetadataObjects request. The getMetadata and
getMetadataObject methods are available within the MdOMIUtil interface. The
createComplexMetadataObject method creates an empty metadata object; it has no
attributes or associations set. Use of one of the GetMetadata methods will then be
needed to fully populate the object.
You can get the identifiers of all registered repositories on the SAS Metadata Server by
using the getRepositories method of the MdOMIUtil interface. You can get the identifier
of an existing object instance by using one of the getMetadataObjects methods of the
MdOMIUtil interface. For more information about repository and object instance
identifiers, see “Identifying Metadata” on page 73.
Deleting Objects
To delete an existing metadata object from the SAS Metadata Server, you must create an
object that represents it in the SAS Java Metadata Interface client. Then, you delete both
the server and client metadata objects by calling the deleteMetadataObjects method of
the MdFactory interface. Calling this method removes the metadata object from both the
server and client.
An alternate way to delete existing metadata objects is to use the delete method that is
available with each object. Using this method simply marks the object as deleted. The
updateMetadataAll method needs to be called to persist this change to the SAS Metadata
Server.
34 Chapter 5 • Overview of Interfaces and Classes
A client that reads and writes metadata uses the makeOMRConnection method to
connect to the SAS Metadata Server. The client disconnects from the server by using the
closeOMRConnection method.
The MdOMRConnection interface also provides methods for connecting to the server
with the SAS Open Metadata Interface IServer, ISecurity, and ISecurityAdmin server
interfaces, and for getting information about the SAS Metadata Server connection. The
following table summarizes the methods in the MdOMRConnection interface.
getUserHomeFolder Gets the user home folder for the specified user.
Working with the AssociationList Class 37
For reference information about each method, see the SAS Java Metadata Interface
documentation at support.sas.com/93api.
• The first statement specifies to get from the SAS Metadata Server for object
tableObject a list of all the objects in the Columns association. If a Columns
association does not exist, then an empty AssociationList object is created on the
client.
• The second statement adds object columnObject to the Columns AssociationList that
was retrieved or created.
Whenever you create an AssociationList object for a specified association name, the
SAS Java Metadata Interface automatically creates an AssociationList object that
represents the reverse association. For example, for each column listed by the
getColumns method, the SAS Java Metadata Interface creates AssociationList objects in
the object store representing the reverse association. So, for the preceding example, the
columnObject.setTable(tableObject) is performed for the user by the SAS Java Metadata
Interface.
If you want to clear the contents of an association, you can use the clear method from the
AssociationList class. For the preceding example, you would issue the following:
columns.clear();
The clear method removes all SAS Metadata Model metadata objects representing both
sides of the bidirectional association.
The dispose method should be used when the object store is no longer needed. The
dispose method removes all objects in the object store from memory.
Chapter 6
Using the SAS Java Metadata
Interface
Getting Started
This section provides the steps to construct and execute a SAS Java Metadata Interface
client that reads and writes metadata.
The first step in developing and running a client program is to make sure that you have
access to a properly configured SAS Metadata Server. You should have a properly
configured SAS Metadata Server if your site performed a SAS planned installation.
After the SAS Metadata Server has been configured, you can begin developing a SAS
Java Metadata Interface client that uses it. All SAS Java Metadata Interface clients
access a SAS Metadata Server using the following steps:
1. Instantiate an object factory.
2. Connect to the SAS Metadata Server.
3. Create Java object instances that represent SAS Metadata Model metadata objects
and modify attributes and associations as needed.
4. Persist changes to the SAS Metadata Server.
Read the following topics for instructions about how to implement the preceding steps:
• “Instantiating an Object Factory and Connecting to the SAS Metadata Server” on
page 41
• “Getting Information about Repositories” on page 43
• “Creating Objects” on page 44
• “Getting and Updating Existing Objects” on page 48
• “Deleting Objects” on page 51
Instantiating an Object Factory and Connecting to the SAS Metadata Server 41
Example code fragments are given to illustrate each step. To see how the code examples
are submitted in an actual program, see “Sample Program” on page 52.
An object factory is needed for each user who will use an application. Therefore, each
user will have their own factory instance.
The examples given do not attempt to show how to create multiple object factories.
Their goal is to show how a typical user connects to the SAS Metadata Server and issues
SAS Java Metadata Interface method calls that create, read, and persist metadata objects
on the SAS Metadata Server.
/**
* Default constructor
*/
public MdTesterExamples()
{
// Calls the factory's constructor
initializeFactory();
}
_factory.setDebug(false);
_factory.setLoggingEnabled(false);
// Sets the output streams for logging. The logging output can be
// directed to any OutputStream, including a file.
_factory.getUtil().setOutputStream(System.out);
_factory.getUtil().setLogStream(System.out);
}
/**
* The following statements define variables for SAS Metadata Server
* connection properties, instantiate a connection factory, issue
* the makeOMRConnection method, and check exceptions for error conditions.
*
*/
public boolean connectToServer()
{
String serverName = "MACHINE_NAME";
String serverPort = "8561";
String serverUser = "USERNAME";
String serverPass = "PASSWORD";
try
{
MdOMRConnection connection = _factory.getConnection();
else
{
// If there is a message from the server:
System.out.println(ErrorType + ": " + ErrorMsg);
}
if (t instanceof org.omg.CORBA.COMM_FAILURE)
{
// If there is an invalid port number or host name:
System.out.println(e.getLocalizedMessage());
}
else if (t instanceof org.omg.CORBA.NO_PERMISSION)
{
// If there is an invalid user ID or password:
System.out.println(e.getLocalizedMessage());
}
}
else
{
// If we cannot find a nested exception, get message and print.
System.out.println(e.getLocalizedMessage());
}
// If there is an error, print the entire stack trace.
e.printStackTrace();
return false;
}
catch (RemoteException e)
{
// Unknown exception.
e.printStackTrace();
return false;
}
// If no errors occur, then a connection is made.
return true;
}
Here is an example of the output that might be returned by the GetRepositories method:
The repositories contained on this SAS Metadata Server are:
Repository: Foundation (A0000001.A5PCE796)
Repository: MyProject (A0000001.A5RVLQQ9)
Repository: Custom1 (A0000001.A5T27ER8)
Repository: Custom2 (A0000001.A5IUI1BI)
The two-part number in each line is the repository identifier. The first part of the number
(A0000001) is the SAS Repository Manager identifier and is the same for all
repositories. The second part of the number is the unique repository ID. This is the
identifier that we will use to create and read metadata.
The CMetadata interface is the base interface that is used to describe all metadata
objects.
Creating Objects
You can create metadata objects by using the methods in the MdFactory interface. You
must create a Java object instance for every new and existing metadata object that you
want to read, update, or delete in a SAS Metadata Repository. You must create an object
Creating Objects 45
store in which to hold the metadata objects. The object store maintains a list of the
metadata objects that need to be persisted to the SAS Metadata Server with a single
request.
The following code creates a new PhysicalTable object, a new Column object, and a new
Keyword object. The code creates associations between these objects. After the metadata
objects are created, they are persisted to the SAS Metadata Server.
Notes:
• To create and persist a new metadata object, you must specify a metadata repository
in which to store the object. You can specify a repository identifier directly in the
createComplexMetadataObject method.
• Because these are new metadata objects, they are assigned permanent metadata
object identifiers when they are persisted to the SAS Metadata Server. A request that
creates Java object instances to represent existing metadata objects needs to
determine their metadata object identifiers before persisting changes to the SAS
Metadata Server. For more information, see “Getting and Updating Existing Objects”
on page 48.
• When creating a new metadata object with createComplexMetadataObject, a valid
metadata type must be passed in. For a list of all valid metadata types, see
com.sas.metadata.remote.MetadataObjects.
• The example defines PublicType and UsageVersion attributes for the table and
column objects, and an association to a folder. As a result, the objects are visible in
the SAS Folders tree, and they can be accessed by the utilities that are available to
objects in that tree. Later, these attribute values can be used to simplify metadata
queries. For more information, see Chapter 3, “Using Interfaces That Read and Write
Metadata in SAS 9.4,” on page 19.
A metadata object must be unique within a folder. The example includes a private
method that verifies that no other tables with the same Name and PublicType
attribute values exist in the folder.
/**
* The following statements create a table, column, and keyword on the column.
* The objects are created in the user's My Folder folder.
* @param repository CMetadata object with id of form: A0000001.A5KHUI98
*/
public void createTable(CMetadata repository)
{
if (repository != null)
{
try
{
System.out.println("\nCreating objects on the server...");
// Before creating any objects, we must verify that the Table does
// not already exist within the parent folder. The table cannot be
// created if it is not unique within the folder.
if (!isUnique(myFolder, tableName, tableType))
{
// Create a PhysicalTable object named "TableTest".
PhysicalTable table = (PhysicalTable) _factory.createComplexMetadataObject
(store,
null,
"TableTest",
MetadataObjects.PHYSICALTABLE,
shortReposID);
null,
"KeywordTest",
MetadataObjects.KEYWORD,
shortReposID);
/**
* isUnique() is a private method that determines whether an object is unique
* within a given folder.
* @param folder is the name of the parent folder
* @param name is the Name value of the object
* @param type is the PublicType value of the object
* @return true if an object with the specified name and type exists within
* the folder.
*/
private boolean isUnique(Tree folder, String name, String type)
throws RemoteException, MdException
{
// Now, retrieve the objects in the folder and make sure that the folder doesn't
// already contain this table. The object's Name and PublicType attribute values
// are used to determine if it is unique.
List members = folder.getMembers();
for (Iterator iter = members.iterator(); iter.hasNext(); )
{
CMetadata meta = (CMetadata) iter.next();
if (meta instanceof PrimaryType)
{
// Verify that the types and object names match
// A case-insensitive match should be used when comparing the names.
if (type.equals(((PrimaryType) meta).getPublicType()) &&
name.equals(meta.getName()))
{
// We found a match.
return true;
}
48 Chapter 6 • Using the SAS Java Metadata Interface
}
}
return false;
}
For more information about object stores and AssociationList objects, see “SAS Java
Metadata Interface Overview” on page 27.
The output prints the name, metadata object identifier, and PublicType and UsageVersion
values of the table and column objects. In addition, it prints the name and metadata
object identifier of the Keyword object. And, it prints the path of the table in the SAS
Folders tree, and the Description and ColumnName values of the column object.
For more information about the search criteria supported in the <XMLSELECT>
element, see Chapter 17, “Filtering a GetMetadataObjects Request,” on page 333. For
Deleting Objects 51
more information about the templates supported in the <TEMPLATES> element, see
“Understanding Templates” on page 301.
Deleting Objects
This section provides an example of how to delete metadata objects. Deleting objects is
similar to updating objects. You must create a Java object instance that represents the
server metadata object on the client before you can delete it.
In this example, the getMetadataObjectsSubset method gets the PhysicalTable object that
was created and updated in “Creating Objects” on page 44, and in “Getting and Updating
Existing Objects” on page 48. The deleteMetadataObjects method deletes the objects.
Because PhysicalTable is a PrimaryType subtype in the SAS Metadata Model, and the
object instance stores a valid TypeName value in the PublicType attribute, there is no
need to specify a template to get the associated Column and Keyword objects, and there
is no need to specifically delete the objects. When you delete an object that specifies the
name of a type definition from the SAS type dictionary in the PublicType attribute, the
SAS Metadata Server uses the template that is internalized in the type definition to
identify the associated objects in its logical metadata definition. The metadata server
automatically deletes these associated objects as well. The getMetadataObjectsSubset
method is in the MdOMIUtil interface. The deleteMetadataObjects method is in the
MdFactory interface.
/**
* This example deletes the objects that we created.
* @param repository
*/
public void deleteTable(CMetadata repository)
{
if(repository != null)
{
try
{
System.out.println("\nDeleting the objects from the server...");
MdObjectStore store = _factory.createObjectStore();
// Note: Since the object has a valid PublicType value, the SAS
// Metadata Server automatically deletes all objects associated
// with the table, such as its Column and Keyword objects, when the table
// is deleted. There is no need to specify a template to delete
// the associated objects.
flags,
xmlSelect);
For an executable version of this example and the examples in “Creating Objects,”
“Getting and Updating Existing Objects,” and a few additional examples, see “Sample
Program” on page 52.
Sample Program
The following is an executable version of the code examples from Chapter 6, “Using the
SAS Java Metadata Interface,” on page 39.
/**
* Copyright (c) 2011 by SAS Institute Inc., Cary, NC 27513
*/
package com.sas.metadata.remote.test;
import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
Sample Program 53
import com.sas.metadata.remote.AssociationList;
import com.sas.metadata.remote.CMetadata;
import com.sas.metadata.remote.Column;
import com.sas.metadata.remote.Keyword;
import com.sas.metadata.remote.MdException;
import com.sas.metadata.remote.MdFactory;
import com.sas.metadata.remote.MdFactoryImpl;
import com.sas.metadata.remote.MdOMIUtil;
import com.sas.metadata.remote.MdOMRConnection;
import com.sas.metadata.remote.MdObjectStore;
import com.sas.metadata.remote.MetadataObjects;
import com.sas.metadata.remote.PhysicalTable;
import com.sas.metadata.remote.PrimaryType;
import com.sas.metadata.remote.Tree;
/**
* This is a test class that contains the examples for SAS Java Metadata Interface.
*/
public class MdTesterExamples
{
/**
* The object factory instance.
*/
private MdFactory _factory = null;
/**
* Default constructor
*/
public MdTesterExamples()
{
// Call the factory’s constructor.
initializeFactory();
}
// Sets the output streams for logging. The logging output can be
// directed to any OutputStream, including a file.
54 Chapter 6 • Using the SAS Java Metadata Interface
_factory.getUtil().setOutputStream(System.out);
_factory.getUtil().setLogStream(System.out);
}
// To be notified when changes have been persisted to the SAS Metadata Server
// within this factory (this includes adding objects, updating objects, and
// deleting objects), we can add a listener to the factory here.
// See MdFactory.addMdFactoryListener()
// A listener is not needed for this example.
}
catch (Exception e)
{
e.printStackTrace();
}
}
/**
* The following statements make a connection to the SAS Metadata Server
* and check exceptions if there is an error connecting. The server name,
* port, user, and password variables must be substituted with actual values.
* @return true if the connection was successful.
*/
public boolean connectToServer()
{
String serverName = "MACHINE_NAME";
String serverPort = "8561";
String serverUser = "USERNAME";
String serverPass = "PASSWORD";
try
{
MdOMRConnection connection = _factory.getConnection();
{
// If there is an invalid port number or host name:
System.out.println(e.getLocalizedMessage());
}
else if (t instanceof org.omg.CORBA.NO_PERMISSION)
{
// If there is an invalid user ID or password:
System.out.println(e.getLocalizedMessage());
}
}
else
{
// If we cannot find a nested exception, get message and print.
System.out.println(e.getLocalizedMessage());
}
// If there is an error, print the entire stack trace.
e.printStackTrace();
return false;
}
catch (RemoteException e)
{
// Unknown exception.
e.printStackTrace();
return false;
}
// If no errors occur, then a connection is made.
return true;
}
/**
* The following statements get and display the status and version
* of the SAS Metadata Server.
*/
public void displayServerInformation()
{
try
{
MdOMRConnection connection = _factory.getConnection();
/**
* The following statements get information about the foundation repository.
* @return the foundation repository
*/
public CMetadata getFoundationRepository()
{
try
{
System.out.println("\nGetting the Foundation repository...");
/**
* The following statements list the repositories that are registered
* on the SAS Metadata Server.
* @return the list of available repository (list of CMetadata objects)
*/
public List<CMetadata> getAllRepositories()
{
try
{
System.out.println("\nThe repositories contained on this SAS Metadata " +
"Server are:");
repository.getName()
+ " (" + repository.getFQID() +")");
}
return reposList;
}
catch (MdException e)
{
e.printStackTrace();
}
catch (RemoteException e)
{
e.printStackTrace();
}
return Collections.emptyList();
}
/**
* The following statements list the metadata types available on the
* SAS Metadata Server and their descriptions.
*/
public void displayMetadataTypes()
{
try
{
System.out.println("\nThe object types contained on this SAS Metadata " +
"Server are:");
/**
* The following statements create a table, column, and keyword on the column.
58 Chapter 6 • Using the SAS Java Metadata Interface
// Before creating any objects, we must verify that the Table does
// not already exist within the parent folder. The table cannot be
// created if it is not unique within the folder.
if (!isUnique(myFolder, tableName, tableType))
{
// Create a PhysicalTable object named "TableTest".
PhysicalTable table = (PhysicalTable) _factory.createComplexMetadataObject
(store,
null,
"TableTest",
MetadataObjects.PHYSICALTABLE,
shortReposID);
null,
"ColumnTest",
MetadataObjects.COLUMN,
shortReposID);
/**
* isUnique() is a private method that determines whether an object is unique
* within a given folder.
* @param folder is the name of the parent folder
* @param name is the Name value of the object
* @param type is the PublicType value of the object
* @return true if an object with the specified name and type exists within
60 Chapter 6 • Using the SAS Java Metadata Interface
* the folder.
*/
private boolean isUnique(Tree folder, String name, String type)
throws RemoteException, MdException
{
// Now, retrieve the objects in the folder and make sure that the folder doesn’t
// already contain this table. The object’s Name and PublicType attribute values
// are used to determine if it is unique.
List members = folder.getMembers();
for (Iterator iter = members.iterator(); iter.hasNext(); )
{
CMetadata meta = (CMetadata) iter.next();
if (meta instanceof PrimaryType)
{
// Verify that the types and object names match
// A case-insensitive match should be used when comparing the names.
if (type.equals(((PrimaryType) meta).getPublicType()) &&
name.equals(meta.getName()))
{
// We found a match.
return true;
}
}
}
return false;
}
/**
* The following statements read the newly created objects back from the
* SAS Metadata Server.
* @param repository identifies the repository from which to read our objects.
*/
public void readTable(CMetadata repository)
{
if(repository != null)
{
try
{
System.out.println("\nReading objects from the server...");
"<PhysicalTable>" +
"<Columns/>" +
"</PhysicalTable>" +
"<Column>" +
"<Keywords/>" +
"</Column>" +
"</Templates>";
/**
* The following statements delete the objects that we created.
* @param repository
*/
public void deleteTable(CMetadata repository)
{
if(repository != null)
{
try
{
System.out.println("\nDeleting the objects from the server...");
MdObjectStore store = _factory.createObjectStore();
// Note: Since the object has a valid PublicType value, the SAS
// Metadata Server automatically deletes all objects associated
// with the table, such as its Column and Keyword objects, when the table
// is deleted. There is no need to specify a template to delete
// the associated objects.
Sample Program 63
/**
* The following statements display the PhysicalTable objects in the repository.
* @param repository CMetadata identifies the repository from which to read
* the objects.
*/
public void displayAllTables(CMetadata repository)
{
try
{
// Print a descriptive message about the request.
System.out.println("\nRetrieving all PhysicalTable objects contained in " +
" repository " + repository.getName());
// Use the OMI_ALL_SIMPLE flag to get all attributes for each table
// that is returned.
int flags = MdOMIUtil.OMI_GET_METADATA | MdOMIUtil.OMI_ALL_SIMPLE;
List tables = _factory.getOMIUtil().getMetadataObjectsSubset
(store,
reposID, // Repository to search
MetadataObjects.PHYSICALTABLE, // Metadata type to search for
flags,
"" );
/**
* The following statements retrieve detailed information for a
* specific PhysicalTable object.
* @param table the table to retrieve
*/
public void getTableInformation(PhysicalTable table)
{
try
{
// Print a descriptive message about the request.
System.out.println("\nRetrieving information for a specific PhysicalTable");
"</PhysicalTable>" +
"</Templates>";
// Use the OMI_ALL_SIMPLE flag to get all attributes for the table.
int flags = MdOMIUtil.OMI_GET_METADATA | MdOMIUtil.OMI_ALL_SIMPLE |
MdOMIUtil.OMI_TEMPLATE;
table = (PhysicalTable) _factory.getOMIUtil().getMetadataAllDepths
(table,
null,
null,
template,
flags);
/**
* The main method for the class
*/
public static void main(String[] args)
{
MdTesterExamples tester = new MdTesterExamples();
return;
}
System.exit(1);
}
}
67
Part 3
Server Interfaces
Chapter 7
Metadata Access (IOMI Interface) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Chapter 8
Authorization (ISecurity Interface) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
Chapter 9
Security Administration (ISecurityAdmin Interface) . . . . . . . . . . . . . . 171
Chapter 10
Server Control (IServer Interface) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
68
69
Chapter 7
Metadata Access (IOMI Interface)
GetResponsibleParty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
GetSubtypes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
GetTypeProperties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
GetTypes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
GetUserFolders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
IsSubtypeOf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
UpdateMetadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
Audience
The SAS Open Metadata Interface defines a set of methods that read and write metadata
(the IOMI server interface), a set of methods for controlling the SAS Metadata Server
(the IServer server interface), a set of methods for requesting authorization decisions
from the authorization facility (the ISecurity server interface), and a set of methods for
defining and administering access controls (the ISecurityAdmin server interface). This
section describes the methods for reading and writing metadata.
We recommend that Java clients use the SAS Java Metadata Interface to read and write
metadata instead of using the IOMI server interface directly. Information about IOMI
methods is provided for users of PROC METADATA, which enables users to submit
IOMI method calls that are formatted for the DoRequest method from the IN= argument.
This section also provides background information for users of the SAS Java Metadata
Interface and SAS metadata DATA step functions.
Return Code
The return code is a Boolean operator that indicates whether the method communicated
with the SAS Metadata Server. A 0 indicates that communication was established. A 1
indicates that communication was not established. The return code does not indicate the
success or failure of the method call itself. It is the responsibility of SAS Open Metadata
Interface clients to provide error codes.
The SAS Metadata Model defines the association names that are supported for every
metadata type, as well as the associated metadata types that are valid for each
association name. In this example, the first nested element, Columns, is the
association name subelement. The association name is a label that describes the
relationship between the main XML element and the associated object subelement.
The second nested element, Column, is the associated object subelement. The
associated object subelement specifies the associated metadata type that you are
interested in. The Columns association name supports associated objects of the
metadata types Column and ColumnRange. By specifying Column in the property
string, you indicate to the SAS Metadata Server that you are interested only in
associated objects of this metadata type.
The attributes that you specify in the input metadata property string depend on the
method in which it will be used. For example, a metadata property string that is
submitted to the AddMetadata method would not specify the Id attribute, as the server
assigns a value for this attribute when the metadata object is created. The main element
in a metadata property string for the UpdateMetadata and GetMetadata methods must
specify the Id attribute.
CAUTION:
To meet XML parsing rules, the metadata type, attribute, association, and
associated metadata type names that you specify in the metadata property
string must exactly match those published in the metadata type documentation.
< = <
> = >
Functional Index to IOMI Methods 73
& = &
Identifying Metadata
The documentation refers to "general, identifying information" about a metadata object.
This phrase refers to the object’s Id and Name attributes.
Each metadata object in a repository, such as the metadata for a particular column in a
SAS table, has a unique identifier assigned to it when the object is created. Each object
also has a name. For example, here is the Id and Name for a SAS table column, as
returned by the GetMetadata method.
<Column Id="A2345678.A3000001" Name="New Column"/>
Id
refers to the unique identifier assigned to a metadata object. It has the form
reposid.instanceid. For example, in the previous example, the Id for the Column
object is A2345678.A3000001.
The reposid is assigned to a metadata repository by the SAS Metadata Server when
the repository is created. A reposid is a unique character string that identifies the
metadata repository that stores the object.
The instanceid is assigned to a metadata object by the SAS Metadata Server when
the object is created. An instanceid is a unique character string that distinguishes one
metadata object from other metadata objects of the same metadata type.
Name
refers to the user-defined name of the metadata object. An object name is a non-null
value up to 60 characters. The name cannot start or end with a whitespace character,
or contain /, \, or control characters. Names can contain Unicode characters, subject
to the previously noted restrictions. In the previous example, the Name value of the
table column is New Column.
Note: Because different repository systems use different ID formats, do not make
assumptions about the internal format of the Id attribute.
CAUTION:
Do not attempt to assign Id values in a client application. Let the SAS Metadata
Server assign identifiers to new objects.
INMETADATA parameter of a GetMetadata call to filter the associated objects that are
retrieved and the OMI_ALL flag is set, GetMetadata retrieves properties only about
associated objects that meet the search criteria.
When a template is used, the properties and any search criteria specified in the template
are applied in addition to any properties requested by other GetMetadata parameters.
Numeric
Flag name Indicator Method Description
Numeric
Flag name Indicator Method Description
Numeric
Flag name Indicator Method Description
Numeric
Flag name Indicator Method Description
Numeric
Flag name Indicator Method Description
Numeric
Flag name Indicator Method Description
<DOAS> Option
This request returns only PhysicalTable objects that the user identified in the credential
handle is authorized to read.
The requested object is created only if the user who is identified in the credential handle
has WriteMetadata permission to the specified repository.
AddMetadata
Short Description
Adds metadata objects to a repository.
Category
Write methods
Syntax
rc= AddMetadata(inMetadata,reposid,outMetadata,ns,flags,options);
Parameters
flags L in OMI_TRUSTED_CLIENT=268435456
Determines whether the client can call
this method. This flag is required.
Details
The AddMetadata method creates metadata objects. It is used to create both the metadata
object that defines a repository, and the metadata objects that are within the repository.
To update an existing metadata object, whether it defines a repository or a metadata
object within the repository, use the UpdateMetadata method.
The INMETADATA parameter specifies a metadata property string that defines the
properties to be added for the object. A request that creates a repository defines an object
of the RepositoryBase metadata type and is issued in the REPOS namespace. A request
that adds an object to a repository is issued in the SAS namespace and defines SAS
namespace metadata types. Not all metadata types or their properties can be added. See
the documentation for each metadata type. AddMetadata returns an error for any
metadata type that cannot be added.
An AddMetadata request that creates the metadata object that defines a repository does
not automatically create the physical directory specified in the Path attribute. You must
create the physical directory specified in the Path attribute in advance. Or, you can pass
the <CREATEREPOSCONTAINER/> element in the AddMetadata request to create the
physical directory. The Path attribute accepts an absolute or relative pathname. Use
backslashes or forward slashes (\ and /) to indicate the directory levels.
<CREATEREPOSCONTAINER/> creates one directory, and it will be the last directory
86 Chapter 7 • Metadata Access (IOMI Interface)
in the specified path. If the other directories in the path do not exist, the SAS Metadata
Server returns an error.
The OUTMETADATA parameter mirrors the content of the INMETADATA parameter.
In addition, it returns identifiers for the requested objects. Any invalid properties in the
INMETADATA metadata property string remain in the OUTMETADATA metadata
property string. For information about the structure of the metadata property string, see
“Constructing a Metadata Property String” on page 71.
The AddMetadata method can be used to create an object only, to create an object and an
association to an existing object, or to create an object, an association, and the associated
object. Associations to objects can be made in the same repository or in a different
repository. The attributes defining the objects indicate the type of operation to be
performed. For more information, see Chapter 11, “Adding Metadata Objects,” on page
241.
Objects and associations are created subject to security constraints. For example, a
requestor must have administrative status on the SAS Metadata Server to add a
repository. A requestor must have WriteMetadata permission to a repository to add an
object to the repository. When creating an association between a new object and an
existing object, the requestor must have WriteMetadata permission either to the existing
object, or to the repository in which the existing object resides.
The SAS Metadata Server assigns object identifiers after the successful completion of an
AddMetadata request.
Check the return code of an AddMetadata method call. A nonzero return code indicates
that a failure occurred while trying to write the metadata. A nonzero return code means
none of the changes in the method call were made.
reposid= "A0000001.A2345678";
ns= "SAS";
<!-- OMI_TRUSTED_CLIENT flag -->
flags= 268435456;
options= "";
rc = AddMetadata(inMetadata,reposid,outMetadata,ns,flags,options);
Related Methods
• “UpdateMetadata” on page 124
• “GetRepositories” on page 110
AddResponsibleParty
Short Description
Creates a ResponsibleParty object for the specified identity in the repository that
contains the identity’s metadata definition.
Category
User interface helper methods
Syntax
rc=DoRequest("<AddResponsibleParty>...</AddResponsibleParty>",outMetadata);
Parameters
Details
SAS Management Console and SAS Data Integration Studio allow users to define a set
of responsibilities for an object. These product’s frameworks support two types of
responsibilities — Owner and Administrator. The AddResponsibleParty method enables
a user to easily create a ResponsibleParty object. (For example, a ResponsibleParty
object can be created that defines a user named “John Smith” as the owner of a particular
stored process.) A ResponsibleParty object can be defined for any object in metadata.
ResponsibleParty objects must be created in the same SAS Metadata Repository as the
metadata definition of the identity that they describe. Metadata definitions for individual
users (Person objects) are always created in the foundation repository. Metadata
definitions for groups (IdentityGroup objects) can be created in the foundation repository
or a custom repository. The AddMetadata method, which is provided to add objects to a
repository, requires a requestor to have WriteMetadata permission to a repository to
create an object. The AddResponsibleParty method is provided to allow users to create
ResponsibleParty objects in the appropriate repository, even if they do not have
WriteMetadata permission to that repository.
The AddResponsibleParty method is available in the DoRequest interface only. The
method and its parameters are specified in an XML input string within the
INMETADATA parameter of the DoRequest method. The method’s output is returned in
the DoRequest method’s OUTMETADATA parameter.
The XML input string consists of an <ADDRESPONSIBLEPARTY> element that
passes a metadata property string that defines a ResponsibleParty object in the following
form:
<ResponsibleParty IdentityName='name' Responsibility='role'/>
IDENTITYNAME='name'
Specifies the name, up to 60 characters, of a Person or IdentityGroup object that is
defined on the SAS Metadata Server. The SAS Metadata Server normalizes the value
before storing it in the ResponsibleParty object’s Name attribute. A null value
implies the connected user. If the specified identity or connected user is Public, an
error is returned. If the specified identity is not found in the SAS Metadata Server, an
error stating that the object was not found is returned.
RESPONSIBILITY='role'
Specifies a value, up to 100 characters, that is valid for the client. If the
RESPONSIBILITY parameter is omitted or passes a null value, the SAS Metadata
Server returns an error.
If you enter a value that is greater than the maximum character length for either the
IDENTITYNAME or RESPONSIBILITY parameters, the value is truncated.
Before creating the requested ResponsibleParty object, the AddResponsibleParty method
verifies that an object does not exist that meets the criteria. This causes additional locks
on the repository, so the AddResponsibleParty method should be called by a client only
after verifying the need to add an object with the GetResponsibleParty method.
The output of the AddResponsibleParty method mirrors the input, except the object
identifier of the new object is returned.
Example
The following is an example of a DoRequest method call that issues an
AddResponsibleParty request.
AddUserFolders 89
outMetadata=""
inMetadata =
"<AddResponsibleParty>
<ResponsibleParty IdentityName=' ' Responsibility='Owner'/>
</AddResponsibleParty>";
rc=DoRequest(inMetadata,outMetadata);
Related Methods
• “DoRequest” on page 97
• “GetResponsibleParty” on page 113
AddUserFolders
Short Description
Creates a user's home folder and subfolders.
Category
User interface helper methods
Syntax
rc=DoRequest("<AddUserFolders>...</AddUserFolders>",outMetadata);
Parameters
Details
The SAS Metadata Server supports the concept of a user folder to enable clients to
provide a consistent user interface to metadata. The user folder is a work area similar to
the My Documents area on a Windows system. Metadata that is created or accessed by a
user is stored in a subfolder of the user folder. This subfolder is named “My Folder” by
90 Chapter 7 • Metadata Access (IOMI Interface)
default. The work area also includes a subfolder named “Application Data” that stores
system information about the user for the internal use of applications.
The AddUserFolders method can be used to create one or all of these folders for a
specified user.
The AddUserFolders method is available in the DoRequest interface only. The method
and its parameters are specified in an XML input string within the INMETADATA
parameter of the DoRequest method. The method's output is returned in the DoRequest
method's OUTMETADATA parameter.
The XML input string consists of an <ADDUSERFOLDERS> element that passes a
metadata property string that defines a Tree object in the following form:
<Tree PersonName='name' FolderName='folder-type'/>
A successful AddUserFolders request creates a subfolder in the /User Folders folder that
has the name specified in the PERSONNAME parameter. The request potentially creates
one or both of the “My Folder” and “Application Data” subfolders. The names “My
Folder” and “Application Data” are localized. For example, if all possible folders were
created for a user using the US-English locale, they would be displayed in the folder tree
as follows:
• —Users
• —PersonName
• —My Folder
• —Application Data
If the French locale were active, then “My Folder” and “Application Data” would be
displayed in French. The locale used to create the Tree object's DisplayName attribute is
provided to the SAS Metadata Server in the LOCALE server invocation option or in the
sasv9.cfg file.
The AddUserFolders method automatically stores the following attribute values for each
folder:
• PublicType="Folder"
• UsageVersion="1000000"
• TreeType="BIP Folder"
• DisplayName="server-localized-version-of-folder-name"
This attribute is set only for subfolders of the user folder.
The Admin-Only Update ACT grants SAS Metadata Server administrators
WriteMetadata and Write permissions to all user home folders, and denies the Public
group WriteMetadata and Write permissions to user home folders. This enables only
administrators to create and update home folders. The Private User Folder ACT grants
SAS Metadata Server administrators full access to all "My Folder" and "Application
Data" subfolders in the directory, and denies the Public group access to the subfolders.
This ACT contains an access control entry (ACE) for each person indicated in
PERSONNAME that grants them ReadMetadata, WriteMemberMetadata, and
CheckinMetadata permissions on his or her “My Folder” and “Application Data”
folders. These permissions enable the folder owners to view and create metadata in their
user folders, but not to delete the folders.
If the administrator changes the Metadata Location for Users' Folders policy after some
user folders have been created, then any home folders and subfolders for existing users
in /User Folders will remain in this folder. Home folders for new users are created in the
new location.
Example
The following is an example of a DoRequest method call that issues an AddUserFolders
request. The request creates both a “My Folder” and home folder for user “SAS Web
Administrator.”
outMetadata=""
inMetadata=
"<AddUserFolders>
<Tree PersonName='SAS Web Administrator' FolderName='My Folder'/>
</AddUserFolders>";
92 Chapter 7 • Metadata Access (IOMI Interface)
rc=DoRequest(inMetadata,outMetadata);
Related Methods
• “DoRequest” on page 97
• “GetUserFolders” on page 121
ChangePassPhrase
Short Description
Re-encrypts all passwords in Login and SASPassword objects that are stored in the SAS
Metadata Server.
Category
User interface helper methods
Syntax
rc=DoRequest("<ChangePassPhrase>...</ChangePassPhrase>",outMetadata);
Parameters
Details
The ChangePassPhrase method enables an authorized user to re-encrypt all passwords in
Login and SASPassword objects that are stored in the SAS Metadata Server. The default
encryption algorithm for storing passwords on the metadata server is proprietary and
uses a fixed key. When SAS/SECURE is used, additional algorithms are available. The
strongest available algorithm is used by default when encrypting passwords.
When SAS/SECURE is used, a site can specify a pass phrase to use as a key for the
encryption. If passwords are compromised, they can be made safe again by simply
changing the pass phrase.
The ChangePassPhrase method updates the passwords in all repositories in the server. It
cannot be applied to a single repository. The pass phrase will be the same for all
repositories that are updated. Repositories that are offline, Read only, restored,
unregistered and re-registered, or otherwise not available can have a different pass
phrase. A repository that is using a different pass phrase from the other servers will log a
message to the server log and continue to be accessible. At some point, the
ChangePassPhrase method can be executed again to have all repositories use the same
pass phrase.
An administrator must have unrestricted authorization to run ChangePassPhrase. The
server must be paused in an ADMIN state before ChangePassPhrase is executed. When
ChangePassPhrase has completed, the server can be resumed.
The method is available in the DoRequest method only. It takes one
<PASSPHRASE>value</PASSPHRASE> XML element as a parameter. The specified
pass phrase can be 0 to 1,024 characters. The pass phrase value can be clear text,
encrypted, or blank. Encrypt the pass phrase with the PWENCODE procedure.
Specifying a blank pass phrase will encrypt the password using a fixed-key pass phrase.
The ChangePassPhrase method writes messages to the server log. This log should be
inspected after the method completes to verify the success of each repository conversion.
A repository will not be processed if the server is not paused in an ADMIN state.
The following logger can be specified in the metadata server’s log configuration file
(logconfig.xml in most installations) to identify the objects whose Login objects have
changed:
<logger name="Audit.Meta.Updates.PublicObjects">
<level value="Trace"/>
</logger>
<logger name="Audit.Meta.Updates.Projects.PublicObjects">
<level value="Debug"/>
</logger>
Object log messages are written after the objects are committed to the repository.
Example
The following is an example of a DoRequest method call that issues a ChangePassPhrase
request. The request assigns the pass phrase, “This is my pass phrase.” to all
SASPassword and Login objects on the server.
outMetadata=""
inMetadata=
"<ChangePassPhrase>
<PassPhrase>This is my pass phrase.</PassPhrase>
94 Chapter 7 • Metadata Access (IOMI Interface)
</ChangePassPhrase>";
rc=DoRequest(inMetadata,outMetadata);
DeleteMetadata
Short Description
Deletes metadata objects from a repository.
Category
Write methods
Syntax
rc=DeleteMetadata(inMetadata,outMetadata,ns,flags,options);
Parameters
flags L in OMI_DELETE=32
Valid in the REPOS namespace only.
Specifies to delete the contents of a
repository and the repository’s
registration.
OMI_IGNORE_NOTFOUND=134217728
Prevents a Delete operation from being
canceled when a request specifies to
delete an object that does not exist.
OMI_REINIT=2097152
Valid in the REPOS namespace only.
Specifies to delete the contents of a
repository, but does not remove the
repository’s registration from the SAS
Repository Manager.
OMI_RETURN_LIST=1024
Specifies to return the identifiers of any
dependent objects that were deleted, or
of any subordinate objects that were
deleted.
OMI_TEMPLATE=4
Valid in the SAS namespace only.
Checks the OPTIONS parameter for
user-defined templates that specify
associated objects to delete with the
specified metadata object. The
templates are passed in a
<TEMPLATES> element in the
OPTIONS parameter.
OMI_TRUNCATE=4194304
Valid in the REPOS namespace only.
Specifies to delete all metadata objects,
but does not delete the metadata object
containers from a repository, or remove
the repository’s registration.
OMI_TRUSTED_CLIENT=268435456
Determines whether the client can call
this method. This flag is required.
96 Chapter 7 • Metadata Access (IOMI Interface)
Details
The DeleteMetadata method deletes metadata objects from a repository. To replace or
modify the properties of a metadata object, use the UpdateMetadata method.
The DeleteMetadata method is typically issued in the SAS namespace to delete metadata
representing application elements. The method can also be issued in the REPOS
namespace on a RepositoryBase object to unregister the repository, to destroy the
repository, or to clear all objects from the repository without harming the repository’s
registration. Flags that are valid only in the REPOS namespace are provided to perform
these tasks. For more information, see “Deleting a Repository” on page 360. You must
have administrative status on the SAS Metadata Server to issue the DeleteMetadata
method in the REPOS namespace. For more information about administrative user
status, see the SAS Intelligence Platform: Security Administration Guide.
Regardless of the namespace in which it is issued (REPOS or SAS), a DeleteMetadata
method call must set the OMI_TRUSTED_CLIENT flag (268435456). The
OMI_TRUSTED_CLIENT flag is required in all method calls that write or remove
metadata.
The object to delete is primarily identified in a metadata property string that is submitted
to the method in the INMETADATA parameter. To delete multiple objects, stack their
metadata property strings in the INMETADATA parameter.
In addition to deleting specified SAS Metadata Model objects, a DeleteMetadata method
issued in the SAS namespace deletes associated objects using a type definition from the
SAS type dictionary, or, when the OMI_TEMPLATE flag is set, associated objects that
are specified in a template. For usage information, see Chapter 19, “Deleting Metadata
Objects,” on page 355.
Check the return code of a DeleteMetadata method call. A nonzero return code indicates
that a failure occurred while trying to delete the metadata objects. A nonzero return code
means none of the changes indicated by the method call were made.
DoRequest 97
<DeleteMetadata>
<Metadata>
<SASLibrary Id="A2345678.A2000001"/>
</Metadata>
<NS>SAS</NS>
<Flags>268436480</Flags>
<Options/>
</DeleteMetadata>
Related Methods
• “AddMetadata” on page 84
• “UpdateMetadata” on page 124
DoRequest
Short Description
Executes XML-formatted method calls.
Category
Messaging method
98 Chapter 7 • Metadata Access (IOMI Interface)
Syntax
rc=DoRequest(inMetadata,outMetadata);
Parameters
Details
The DoRequest method enables you to submit IOMI methods and their parameters to the
SAS Metadata Server in an input XML string. The XML string has the following form:
<MethodName>
<Parameter1>Value</Parameter1>
<Parameter2>Value</Parameter2>
<Parametern>Value</Parametern>
</MethodName>
<Parametern>Value</Parametern>
</MethodName1>
<MethodName2>
<Parameter1>Value</Parameter1>
<Parameter2>Value</Parameter2>
<Parametern>Value</Parametern>
</MethodName2>
DoRequest 99
</Multiple_Requests>
The published method parameter names must be used for all method parameters except
INMETADATA. A <METADATA> element must be used to represent the
INMETADATA parameter within method calls that support this parameter. For other
parameters, the method returns an error if parameter names other than the published
names are used. For more information about the format of this method string, see the
documentation for the method that you want to execute.
You submit the XML-formatted method calls to the SAS Metadata Server in the
DoRequest method’s INMETADATA parameter. The XML-formatted method calls are
submitted to the server as a string literal (a quoted string). To ensure that the string is
parsed correctly, it is recommended that any additional double quotation marks, such as
those enclosing XML attribute values in the metadata property string, be marked to
indicate that they should be treated as characters. Here are examples of using escape
characters in different programming environments to mark the additional double
quotation marks:
Java
"<PhysicalTable Name=\"TestTable\" Desc=\"Sample table\"/>"
Visual Basic
"<PhysicalTable Name=""TestTable"" Desc=""Sample table""/>"
Visual C++
"<PhysicalTable Name=\"TestTable\" Desc=\"Sample table\"/>"
SAS
"<PhysicalTable Name=""TestTable"" Desc=""Sample table""/>"
"<PhysicalTable Name='TestTable' Desc='Sample table'/>"
'<PhysicalTable Name="TestTable" Desc="Sample table"/>'
Any metadata-related (IOMI server interface) method can be submitted to the SAS
Metadata Server using the DoRequest method. For information about the exact format of
a method request, see the documentation for the method that you want to execute.
The DoRequest method supports requests to metadata objects in both the SAS
namespace and the REPOS namespace. Requests that call the SAS and REPOS
namespaces can be submitted within the same <MULTIPLE_REQUESTS> element.
The DoRequest method is ACID-compliant. ACID (Atomicity, Consistency, Isolation,
Durability) is a term that refers to the guarantee that all of the tasks of a transaction are
performed or none of them are. In other words, if multiple methods are submitted, and
one method in a DoRequest fails, then all of the methods specified in the XML input
string fail.
The DoRequest method’s OUTMETADATA string mirrors the INMETADATA string,
except requested values are provided.
Check the return code of a DoRequest method call. A nonzero return code indicates that
a failure occurred while trying to write metadata. A nonzero return code means none of
the changes in any of the methods in the DoRequest were made.
Example
The DoRequest method is issued in the standard interface. The following is an example
of how to issue a DoRequest method call regardless of the programming environment.
outMetadata=" ";
inMetadata="XML-method-string";
100 Chapter 7 • Metadata Access (IOMI Interface)
rc=DoRequest(inMetadata,outMetadata);
GetMetadata
Short Description
Gets specified attributes and associations for the specified metadata object.
Category
Read methods
Syntax
rc=GetMetadata(inMetadata,outMetadata,ns,flags,options);
Parameters
flags L in OMI_ALL=1
Specifies to get all of the attributes that
are documented for the requested
metadata type in its Attributes table,
and all of the associations that are
documented in its Associations table,
whether they have values stored for
them or not. The results include both
unique and inherited attributes and
associations. If the returned XML
stream includes references to any
associated objects, GetMetadata returns
only general, identifying information
for the associated objects.
OMI_ALL_SIMPLE=8
Specifies to get all of the attributes of
the requested object. If the request
returns associated objects, it gets all
attributes for those objects as well. The
results include both unique and
inherited attributes.
OMI_DEPENDENCY_USED_BY=16384
Specifies to include associations to
objects that exist in all project
repositories in the method results.
OMI_FULL_OBJECT= 2
Instructs the SAS Metadata Server to
use a type definition from the SAS type
dictionary to expand the specified
object's metadata definition. The server
reads the values in the object's
PublicType and UsageVersion attributes
to determine which type definition to
use to process the request.
OMI_INCLUDE_SUBTYPES=16
Specifies to get the specified properties
for metadata objects that are subtypes
of the specified metadata type, in
addition to the specified metadata
object. The
OMI_INCLUDE_SUBTYPES flag
must be set with the OMI_TEMPLATE
flag and a template, or the flag is
ignored.
102 Chapter 7 • Metadata Access (IOMI Interface)
OMI_LOCK=32768
Locks the specified object and any
associated objects selected by
GetMetadata flags and options from
update by everyone except the caller.
OMI_NOEXPAND_DUPS=524288
Modifies OMI_TEMPLATE and
OMI_FULL_OBJECT processing so
that objects are expanded by the
associated template (user-defined or
from the type dictionary) only once per
primary object specified in the
INMETADATA parameter.
OMI_NOFORMAT=67108864
Causes date, time, and datetime values
in the output XML stream to be
returned as raw SAS date, SAS time,
and SAS datetime floating-point values.
Without the OMI_NOFORMAT flag,
the default US-English locale is used to
format the values into recognizable
character strings.
OMI_SUCCINCT=2048
Specifies to omit attributes and
associations that do not contain a value
or that contain a null value from the
returned XML string.
OMI_TEMPLATE=4
Checks the OPTIONS parameter for
user-defined templates that specify
which metadata properties to return.
The user-specified templates are
submitted in a <TEMPLATES>
element in the OPTIONS parameter.
OMI_UNLOCK=131072
Unlocks an object lock that is held by
the caller.
OMI_UNLOCK_FORCE=262144
Unlocks an object lock that is held by
another user.
GetMetadata 103
Details
The GetMetadata method gets specified attributes and associations for the specified SAS
Metadata Model metadata object.
The method’s default behavior is to get attributes and associations that are specified in
the INMETADATA parameter of the method call. As an alternative, you can set one or
more flags that specify to get all attributes or all attributes and associations. Or you can
specify a flag (OMI_FULL_OBJECT) that instructs the SAS Metadata Server to use a
type definition from the SAS type dictionary to identify the association names to expand
when getting the specified object.
The OMI_FULL_OBJECT flag is effective only if the specified object is a PrimaryType
subtype in the SAS Metadata Model, and only if it stores the name of a type definition in
the PublicType attribute. The type definition internalizes information about the
associations that will be retrieved so that clients do not need to know the details. The
primary metadata type and associations that describe a resource in the SAS Metadata
Repository are referred to as the resource’s logical metadata definition. For more
information, see Chapter 14, “Getting the Properties of a Specified Metadata Object,” on
page 279, “GetMetadata and Logical Type Definitions” on page 280, and “Using the
OMI_FULL_OBJECT Flag” on page 298.
The GetMetadata method has no concept of a logical metadata definition unless you set
the OMI_FULL_OBJECT flag, or you specify a user-defined template that specifies
association names to expand with the specified object. The GetMetadata method
supports two template forms. For more information, see“Understanding Templates” on
page 301 and “Creating Templates for the Get Methods” on page 304.
The OMI_UNLOCK and OMI_UNLOCK_FORCE flags release object locks set with
the OMI_LOCK flag.
The GetMetadata method uses the US-English locale to format date, time, and datetime
values. Set the OMI_NOFORMAT (67108864) flag to return these values as SAS
floating-point values that you can format.
104 Chapter 7 • Metadata Access (IOMI Interface)
A GetMetadata method that requests associated objects and that is issued in a public
repository (the foundation or a custom repository) returns associated objects from all
public repositories. If you want to include associated objects that are in project
repositories in a public GetMetadata request, set the OMI_DEPENDENCY_USED_BY
flag.
The OMI_INCLUDE_SUBTYPES flag extends processing of user-defined templates to
include associated metadata objects that are subtypes of the specified metadata object.
This functionality is useful when you want to retrieve a common set of properties for
multiple SAS Metadata Model metadata objects. For more information, see “Using
GetMetadata to Get Common Properties for Sets of Objects” on page 292.
For more information about specifying GetMetadata flags, see “Using IOMI Flags” on
page 75. For information about interdependencies between GetMetadata flags, see
“Combining GetMetadata Flags” on page 297.
<GetMetadata>
<Metadata>
<PhysicalTable Id="A5345678.A500001" Name="" Desc="">
<Columns/>
</PhysicalTable>
GetMetadataObjects 105
</Metadata>
<NS>SAS</NS>
<Flags>0</Flags>
<Options/>
</GetMetadata>
Related Methods
• “GetMetadataObjects” on page 105
GetMetadataObjects
Short Description
Gets all metadata objects of the specified metadata type in the specified repository.
Category
Read methods
Syntax
rc=GetMetadataObjects(reposid,type,objects,ns,flags,options);
Parameters
flags L in OMI_DEPENDENCY_USED_BY=16384
Specifies to include objects from all
project repositories in the method
results.
OMI_DEPENDENCY_USES=8192
Specifies to include objects from all
public repositories (the foundation and
custom repositories) in the method
results.
OMI_GET_METADATA=256
Specifies to execute a GetMetadata call
for each object that is returned by the
GetMetadataObjects request.
OMI_INCLUDE_SUBTYPES=16
Specifies to get all of the metadata
objects that are subtypes of the
specified metadata type and metadata
objects of the specified metadata type.
If OMI_XMLSELECT is specified, it
affects the subtypes that are retrieved.
OMI_MATCH_CASE=512
Specifies to perform a case-sensitive
search that is based on criteria specified
in the <XMLSELECT> element. The
OMI_MATCH_CASE flag must be
used with the OMI_XMLSELECT flag,
or the flag is ignored.
OMI_XMLSELECT=128
Specifies to check the OPTIONS
parameter for search criteria that filters
the objects that are returned. The search
criteria are passed as a search string in
an <XMLSELECT> element.
Details
The GetMetadataObjects method gets a list of all metadata objects of the metadata type
specified in the TYPE parameter from the repository specified in the REPOSID
GetMetadataObjects 107
parameter. The default behavior is to get “Identifying Metadata” for each metadata
object.
Flags enable you to get additional properties and to expand or filter the objects that are
retrieved.
• OMI_INCLUDE_SUBTYPES expands the request to get subtypes of the specified
metadata type.
• OMI_GET_METADATA enables you to execute a GetMetadata call for each object
that is returned by the GetMetadataObjects request.
• The OMI_DEPENDENCY_USES and OMI_DEPENDENCY_USED_BY flags
specify additional repositories from which to get objects.
• The OMI_XMLSELECT flag and <XMLSELECT> element enable you to filter the
objects that are returned by specifying search criteria.
For usage information, see “Introduction to the GetMetadataObjects Method ” on page
317.
The default behavior of the GetMetadataObjects method is to get objects of the specified
metadata type from the specified repository. Set OMI_DEPENDENCY_USES to get
metadata objects from all public repositories (the foundation and all custom repositories)
in the method results, and to get metadata objects from the specified repository. Set
OMI_DEPENDENCY_USED_BY only if you want to get metadata objects of the
specified metadata type from all project repositories in the method results, in addition to
metadata objects from the specified repository. Setting both flags will return metadata
objects from all repositories that are registered in the SAS Metadata Server (foundation,
custom, and project).
When the GetMetadataObjects method is issued in the SAS namespace, the REPOSID
parameter is required, unless the OMI_DEPENDENCY_USED_BY flag, the
OMI_DEPENDENCY_USES flag, or both is specified. When you specify a REPOSID
value in addition to one or both of the flags, GetMetadataObjects gets metadata objects
first from the repository specified in the REPOSID parameter, and then it gets metadata
objects from the repositories specified by the flags. A request that specifies to get objects
from all registered repositories returns the specified repository first, followed by the
foundation repository, followed by custom repositories in the order in which they were
registered, followed by project repositories in the order in which they were registered.
When the GetMetadataObjects method is issued in the REPOS namespace, it ignores the
REPOSID parameter and searches the SAS Repository Manager.
When using GetMetadataObjects to list common and shared objects, use the metadata
type and TypeName value indicated in the object’s type definition in the SAS type
dictionary to identify the objects to retrieve. For more information about the SAS type
dictionary, see Chapter 3, “Using Interfaces That Read and Write Metadata in SAS 9.4,”
on page 19. Specify the metadata type in the TYPE parameter, set the
OMI_XMLSELECT flag, and specify the TypeName value in the <XMLSELECT>
element in the OPTIONS parameter as follows:
<XMLSELECT search="@PublicType=’typename’"/>
Several common and shared objects are represented in the SAS Metadata Repository by
the same metadata type. Use of the TypeName value filters the request to return only
objects of the specified type.
Use the new GetMetadata OMI_FULL_OBJECT flag and GetMetadataObjects
OMI_GET_METADATA flag with caution. The flags can return a lot of information.
New template features that are available in GetMetadata are also available in
GetMetadataObjects when you set the OMI_GET_METADATA flag and the
108 Chapter 7 • Metadata Access (IOMI Interface)
rc=GetMetadataObjects(reposid,type,objects,ns,flags,options);
<Objects>
<PhysicalTable Id="A5345678.A5000001" Name="New Table"/>
<PhysicalTable Id="A5345678.A5000002" Name="New Table2"/>
</Objects>
Related Methods
• “GetMetadata” on page 100
GetNamespaces
Short Description
Gets the namespaces defined on the SAS Metadata Server.
GetNamespaces 109
Category
Management methods
Syntax
rc=GetNamespaces(namespaces,flags,options);
Parameters
Details
A namespace specifies a group of related metadata types that can be accessed by the
SAS Open Metadata Interface. The NAMESPACES parameter returns the name of the
namespaces that are currently defined in the SAS Repository Manager.
The SAS Open Metadata Interface provides the following namespaces:
• The REPOS namespace contains the repository metadata types.
• The SAS namespace contains metadata types describing application elements.
<Namespaces>
<Ns Name="SAS"/>
<Ns Name="REPOS"/>
</Namespaces>
Related Methods
• “GetTypes” on page 119
• “GetSubtypes” on page 115
GetRepositories
Short Description
Gets the metadata repositories on the SAS Metadata Server.
Category
Repository methods
Syntax
rc=GetRepositories(repositories,flags,options);
Parameters
flags L in OMI_ALL=1
Gets information about each repository,
such as the repository’s availability,
location, format, type, engine, and
created and last updated dates. Lists
repositories.
Details
A repository is a collection of related metadata objects. Each repository is registered in
the SAS Repository Manager, which is also a SAS Metadata Repository. The SAS
Metadata Server can access only those repositories that are registered in the SAS
Repository Manager. There is one SAS Repository Manager for a SAS Metadata Server.
By default, the GetRepositories method gets “Identifying Metadata” on page 73, the
description, and the default namespace for each repository that is registered in the SAS
Repository Manager.
When issued with the OMI_ALL (1) flag set, the GetRepositories method gets
information about the SAS Repository Manager and the following additional attributes
for each repository:
Access= “value”
a descriptor that indicates the access mode that the administrator set for the
repository. Valid values are:
OMS_FULL
Specifies the repository is available to all users for Read and Write access.
OMS_ADMIN
Specifies the repository is available only to users who have administrative user
status on the SAS Metadata Server.
OMS_OFFLINE
Specifies the repository is unavailable to all users.
OMS_READONLY
Specifies the repository is only to be read.
CurrentAccess= “OMS_FULL | OMS_READONLY | OMS_ADMIN |
OMS_ADMINRO | OMS_OFFLINE”
The SAS Metadata Server manages two versions of repositories: a memory version
and a disk version. The memory version enables updates to be made available to
clients before the disk version is updated. This attribute is set by the SAS Metadata
Server on the memory version of the repository when the repository cannot be
updated by the server because the repository has an incompatible repository format
or has encountered an I/O error. This attribute is not stored in the disk version of the
repository.
112 Chapter 7 • Metadata Access (IOMI Interface)
The values that can be returned for CurrentAccess are the same as Access plus
OMA_ADMINRO (specifies the repository is only to be read by administrators).
When a problem is encountered, CurrentAccess will have fewer values compared to
Access. When the SAS Metadata Server can access a repository as intended,
GetRepositories returns a CurrentAccess value that matches the Access value.
Path= “string”
the pathname of the physical directory where the repository is located.
PauseState= “empty-string | ADMIN | ADMIN(READONLY) | READONLY |
OFFLINE”
the repository state after a server pause. This attribute is set by the Pause method and
cleared by the Resume method. If the server is not paused, the value is an empty
string. The value is usually the server Pause value (ADMIN or OFFLINE) unless the
repository is registered with a less restrictive Access value.
RepositoryFormat= “number”
a numeric double value indicating the format level of the repository. (For example,
14.0.)
RepositoryType= “FOUNDATION | CUSTOM | PROJECT”
the repository type.
Beginning in SAS 9.4, the GetRepositories method returns these attributes when
OMI_ALL is set:
Engine="BASE"
the name of the engine that created the repository. The valid value is BASE.
MetadataCreated="date"
a server-generated value that indicates the date and time the repository object was
created.
MetadataUpdated="date"
a server-generated value that indicates the date and time the repository object was
last updated.
Options="library-options"
any library options defined on the repository.
The additional attributes that are retrieved by OMI_ALL are available in the standard
interface and with the DoRequest method when the method is issued on a SAS Metadata
Server that is ONLINE or paused to an ADMIN state. A GetRepositories method that is
issued on a SAS Metadata Server that is paused to an OFFLINE state returns an error
unless the method is issued in the standard interface.
For an example that sets the OMI_ALL (1) flag, see “Using GetRepositories to Get All
Repository Attributes” on page 275.
GetResponsibleParty
Short Description
Gets the ResponsibleParty object associated with the specified Person or IdentityGroup
and responsibility.
Category
User interface helper methods
Syntax
rc=DoRequest("<GetResponsibleParty>...</GetResponsibleParty>",outMetadata);
114 Chapter 7 • Metadata Access (IOMI Interface)
Parameters
Details
The GetResponsibleParty method enables clients to get a ResponsibleParty object for a
specified identity that might exist in a SAS Metadata Repository to which the requesting
user does not have ReadMetadata permission. The method gets ResponsibleParty objects
associated with both Person and IdentityGroup objects. The GetMetadata method is
typically used to get the ResponsibleParty objects associated with an identity. However,
the GetMetadata method returns only objects which the requesting user is authorized to
read.
The GetResponsibleParty method is available in the DoRequest interface only. The
method and its parameters are specified in an XML input string within the
INMETADATA parameter of the DoRequest method. The method’s output is returned in
the DoRequest method’s OUTMETADATA parameter.
The XML input string consists of a <GETRESPONSIBLEPARTY> element that passes
a metadata property string that identifies a ResponsibleParty object in the following
form:
<ResponsibleParty IdentityName='name' Responsibility='role'/>
The GetResponsibleParty method gets the ResponsibleParty object whose Name and
Role attribute values match the specified IDENTITYNAME and RESPONSIBILITY
values.
A user who has administrative status on the SAS Metadata Server can get the
ResponsibleParty object of any user and role. A typical user can get only a
ResponsibleParty object for his or her name and role.
The name value comparison is not case sensitive as the security subsystem enforces
name-uniqueness for Person objects in the SAS Metadata Server. A null value in
IDENTITYNAME implies the connected user. If the specified or implied identity is not
found on the SAS Metadata Server, an error stating that the object was not found is
returned.
The role value comparison is performed as follows:
1. A case-sensitive comparison is performed. If a match is found, then the Id value of
the ResponsibleParty object is returned.
2. If a match is not found, a case-insensitive comparison is performed. If a match is
found, then the Id value of the ResponsibleParty object is returned.
3. If a match is not found, then the Id value of the ResponsibleParty object is not
returned. An error message is not issued.
GetSubtypes 115
Example
The following is an example of a DoRequest method call that issues a
GetResponsibleParty request.
outMetadata=""
inMetadata =
"<GetResponsibleParty>
<ResponsibleParty IdentityName=' ' Responsibility='Owner'/>
</GetResponsibleParty>";
rc=DoRequest(inMetadata,outMetadata);
In this example, the method gets the ResponsibleParty objects that store a Role value of
“Owner” for the connected user. If the requesting user is connected as Public, the
method returns an error.
Related Methods
• “DoRequest” on page 97
• “AddResponsibleParty” on page 87
GetSubtypes
Short Description
Gets all possible subtypes for a specified metadata type.
Category
Management methods
Syntax
rc=GetSubtypes(supertype,subtypes,ns,flags,options);
116 Chapter 7 • Metadata Access (IOMI Interface)
Parameters
flags L in OMI_ALL_DESCENDANTS=64
Specifies to get the descendants of the
returned subtypes and the subtypes.
Details
Subtypes are metadata types that adopt the characteristics of a specified metadata
supertype. In addition, a subtype can have subtypes of its own.
The SUBTYPES parameter returns an XML string that has the Id, Desc, and a
HasSubtypes attribute for each subtype. The HasSubtypes attribute indicates whether a
subtype has any subtypes of its own. If this attribute has a value of 0, then the subtype
does not have any subtypes of its own. If it has a value of 1, then the subtype does have
subtypes of its own.
The GetSubtypes method does not return metadata about descendants unless the
OMI_ALL_DESCENDANTS flag is set.
options= "";
rc = GetSubtypes(supertype,subtypes,ns,flags,options);
<GetSubtypes>
<Supertype>DataTable</Supertype>
<Subtypes/>
<NS>SAS</NS>
<Flags>0</Flags>
<Options/>
</GetSubtypes>
Related Methods
• “GetTypes” on page 119
• “IsSubtypeOf” on page 123
GetTypeProperties
Short Description
Gets all possible properties for a specified metadata type.
Category
Management methods
Syntax
rc=GetTypeProperties(type,properties,ns,flags,options);
118 Chapter 7 • Metadata Access (IOMI Interface)
Parameters
flags L in OMI_ALL=1
Specifies to get a description of the
supported value for each property.
Details
The GetTypeProperties method gets an XML list of the attributes and associations
defined for the specified metadata type in the SAS Metadata Model. The metadata type
is specified in the TYPE parameter.
When the OMI_ALL (1) flag is set, the method also gets a description of each property.
rc=GetTypeProperties(type,properties,ns,flags,options);
GetTypes 119
<GetTypeProperties>
<Type>Column</Type>
<Properties/>
<NS>SAS</NS>
<Flags>1</Flags>
<Options/>
</GetTypeProperties>
Related Methods
• “GetTypes” on page 119
• “GetSubtypes” on page 115
GetTypes
Short Description
Gets all of the metadata types in a namespace.
Category
Management methods
Syntax
rc=GetTypes(types,ns,flags,options);
Parameters
flags L in OMI_SUCCINCT=2048
Specifies to check the OPTIONS
parameter for a <REPOSID> element
and to list the metadata types for objects
that exist in the specified repository.
Details
The GetTypes method has two behaviors, depending on whether the OMI_SUCCINCT
(2048) flag and its corresponding <REPOSID> element are specified.
• Used without the flag, the method returns an XML string that lists all of the metadata
types defined in the specified namespace.
• Used with the flag in the SAS namespace, the method returns an XML string that
lists only metadata types for which objects exist in the specified repository.
The XML string is returned in the TYPES parameter. Each metadata type listed has a
HasSubtypes attribute that indicates whether the metadata type has any subtypes. If this
attribute has a value of 0, then the metadata type does not have any subtypes. If it has a
value of 1, then the metadata type does have subtypes.
The <REPOSID> element specifies a repository identifier in the following form:
<Reposid>A0000001.RepositoryId</Reposid>
rc=GetTypes(types,ns,flags,options);
GetUserFolders 121
Related Methods
• “GetNamespaces” on page 108
• “GetSubtypes” on page 115
GetUserFolders
Short Description
Gets a user’s home folder or subfolders.
Category
User interface helper methods
Syntax
rc=DoRequest("<GetUserFolders>...</GetUserFolders>",outMetadata);
Parameters
Details
The GetUserFolders method is available in the DoRequest interface only. The method
and its parameters are specified in an XML input string within the INMETADATA
parameter of the DoRequest method. The method’s output is returned in the DoRequest
method’s OUTMETADATA parameter.
User folders are represented in the SAS Metadata Server as Tree metadata objects. The
XML input string consists of a <GETUSERFOLDERS> element that passes a metadata
property string that identifies a Tree object in the following form:
<Tree PersonName='name' FolderName='folder-type'/>
The PERSONNAME value must specify the Name attribute value of a Person object or
be blank. If PERSONNAME is blank and the requesting user has a metadata identity, the
user folder belonging to the requesting user is returned. If an IdentityGroup name is
specified, the method will return an error. User folders are not supported for
IdentityGroups at this time.
The FOLDERNAME value must be one of “Home Folder”, “My Folder”, or
“Application Data”, or the method will return an error.
The method uses the AssociatedHomeFolder association defined for the Person object
identified by PERSONNAME to locate the folder requested by FOLDERNAME. The
method returns the Tree object’s 17-character metadata identifier and DisplayName
attribute value. The locale used to create the DisplayName value is provided to the SAS
Metadata Server in the LOCALE server invocation option or in the sasv9.cfg file.
Example
The following is an example of a DoRequest method that issues a GetUserFolders
request. The method requests to get the “My Folder” folder of a person named “SAS
Web Administrator.”
outMetadata=""
inMetadata =
"<GetUserFolders>
<Tree PersonName='SAS Web Administrator' FolderName='My Folder'/>
</GetUserFolders>";
rc=DoRequest(inMetadata,outMetadata);
Related Methods
• “DoRequest” on page 97
• “AddUserFolders” on page 89
IsSubtypeOf 123
IsSubtypeOf
Short Description
Determines whether one metadata type is a subtype of another metadata type.
Category
Management methods
Syntax
rc=IsSubTypeOf(type,supertype,result,ns,flags,options);
Parameters
<IsSubtypeOf>
<Type>WorkTable</Type>
<Supertype>DataTable</Supertype>
<Result/>
<NS>SAS</NS>
<Flags>0</Flags>
<Options/>
</IsSubtypeOf>
Related Methods
• “GetSubtypes” on page 115
UpdateMetadata
Short Description
Updates specified metadata objects in a repository.
Category
Write methods
Syntax
rc=UpdateMetadata(inMetadata,outMetadata,ns,flags,options);
UpdateMetadata 125
Parameters
flags L in OMI_IGNORE_NOTFOUND =
134217728
Prevents an Update operation from
being canceled when a request specifies
to update an object that does not exist.
OMI_RETURN_LIST = 1024
Specifies to return the identifiers of any
dependent objects that were deleted as a
result of the Update operation.
OMI_TRUSTED_CLIENT = 268435456
Determines whether the client can call
this method. This flag is required.
OMI_UNLOCK=131072
Unlocks an object lock that is held by
the caller.
OMI_UNLOCK_FORCE=262144
Unlocks an object lock that is held by
another user.
Details
The UpdateMetadata method enables you to update the properties of existing metadata
objects. It returns an error if the metadata object to be updated does not exist, unless the
OMI_IGNORE_NOTFOUND (134217728) flag is set.
You can modify an object’s attributes and associations, unless the association is
designated as "required for add" in the metadata type documentation.
When modifying an association, you must specify a directive in the association name
element in the input metadata property string. This directive indicates whether the
association is being appended, modified, removed, or replaced in the object’s association
list. Different directives are supported for single and multiple associations. For
information about these directives and general UpdateMetadata usage, see Chapter 12,
“Updating Metadata Objects,” on page 257.
You must have a metadata identity defined on the SAS Metadata Server to set the
OMI_UNLOCK (131072) and OMI_UNLOCK_FORCE (262144) flags. These flags
unlock objects that were previously locked by the OMI_LOCK flag. The OMI_LOCK
flag is set in the GetMetadata method to provide basic concurrency controls in
preparation for an update. For an overview of multi-user concurrency controls supported
by the SAS Open Metadata Interface, see Chapter 18, “Metadata Locking Options,” on
page 353. When OMI_UNLOCK or OMI_UNLOCK_FORCE is set, only specified
objects are unlocked. Associated objects are not unlocked.
Check the return code of an UpdateMetadata method call. A nonzero return code
indicates that a failure occurred while trying to write the metadata. A nonzero return
code means none of the changes in the method call were made.
rc=UpdateMetadata(inMetadata,outMetadata,ns,flags,options);
<UpdateMetadata>
<Metadata>
<PhysicalTable Id="A2345678.A2000001" Name="Sales Table"
UpdateMetadata 127
Related Methods
• “DeleteMetadata” on page 94
• “GetMetadata” on page 100
128 Chapter 7 • Metadata Access (IOMI Interface)
129
Chapter 8
Authorization (ISecurity Interface)
ISecurity methods are available only through the standard interface. For more
information, see “Communicating with the SAS Metadata Server” on page 14.
Two versions of the ISecurity server interface are supported.
• ISecurity 1.0 enables SAS 9.1 clients to work the same way they worked in SAS 9.1.
Only methods that were supported in SAS 9.1 are available in ISecurity 1.0.
• ISecurity 1.1 provides versions of the SAS 9.1 methods that work in SAS 9.2 and
later environments. SAS 9.2 introduced support for server authentication via internal
user accounts as well as the traditional external user accounts. It also added security
administration methods that were not available in SAS 9.1.
The following information applies to all of the ISecurity methods.
• Errors are surfaced through the exception-handling in IOM. Each method returns a
set of documented exceptions. Use TRY and CATCH logic in your Java programs to
determine when an exception is returned.
• The methods make authorization decisions based on user and access control
metadata that is stored in metadata repositories. Appropriate metadata must be
defined for authorization decisions to be meaningful.
User metadata is defined by using the SAS Management Console User Manager
plug-in or by extracting user and group definitions from an enterprise source with
macros. For information about the plug-ins, see SAS Management Console
documentation.
Access control metadata is defined by using the SAS Management Console
Authorization Manager plug-in or by using ISecurityAdmin methods. For
information about ISecurityAdmin methods, see Chapter 9, “Security Administration
(ISecurityAdmin Interface),” on page 171.
For information about access controls supported by the SAS Open Metadata
Architecture authorization facility and enterprise user import macros, see the SAS
Intelligence Platform: Security Administration Guide.
• The methods assume the calling user and any user IDs specified by the calling
program have been authenticated before calling the SAS Metadata Server. A caller
that is invoking ISecurity methods for itself does not have to be a trusted user. A
caller that is invoking the GetCredential method for another user, or is using the
credential handle obtained from GetCredentials for another user, must be a trusted
user.
• In the examples, iSecurity is an instantiation of the ISecurity interface.
The ISecurity server interface is provided in the sas.oma.omi.jar file in the SAS Platform
VJR. A Java client accesses the ISecurity server interface by importing the appropriate
com.sas.meta.SASOMI packages.
The ISecurity interface versions are designed so that existing SAS clients can continue to
work unchanged.
• To use SAS 9.1 methods only, import com.sas.meta.SASOMI.ISecurity and
com.sas.meta.SASOMI.ISecurityPackage.
• To use SAS 9.1 methods and methods introduced after that release, import
com.sas.meta.SASOMI.ISecurity_1_1 and
com.sas.meta.SASOMI.ISecurity_1_1Package.
The SAS Java Metadata Interface provides the MdFactory interface to instantiate an
object factory for the SAS Metadata Server and the MdOMRConnection interface for
connecting to the SAS Metadata Server. Use the MdOMRConnection interface's
makeISecurityConnection method to connect to the server with the ISecurity server
interface.
REPOSID:_reposID
OMSOBJ indicates that the request is to the SAS namespace of the SAS Metadata
Model. The SAS namespace contains metadata types that describe application elements.
MetadataType is one of the SAS namespace metadata types. For a list of supported
metadata types, see the SAS Metadata Model documentation. ObjectId is the requested
object's 17–character metadata object identifier. The first eight characters of the object
identifier are a repository identifier; the remaining eight characters are the unique object
instance identifier.
REPOSID indicates the request is to the REPOS namespace of the SAS Metadata
Model. The REPOS namespaces contains metadata types that describe a repository. The
first eight characters of a repository ID are the SAS Repository Manager identifier
A0000001, which is the same for all repositories. Therefore, you need specify only a
repository's unique 8–character object instance identifier in _reposID.
Identifying Users
The SAS Metadata Server supports user identities of metadata type Person,
IdentityGroup, and Role.
Most ISecurity methods accept a credential handle or use the user ID of the calling user
to identify the identity for which to return an authorization or information. A credential
handle is a token representing an identity's authorizations on the SAS Metadata Server .
A handle is obtained with the GetCredentials method. For more information, see
“GetCredentials” on page 144.
The following methods support additional ways to specify the identity for which to
process a request:
132 Chapter 8 • Authorization (ISecurity Interface)
DeleteInternalLogin
Short Description
Deletes the InternalLogin object that is associated with the specified user.
134 Chapter 8 • Authorization (ISecurity Interface)
Category
Internal authentication methods
Interface Version
ISecurity 1.1
Syntax
DeleteInternalLogin(personName);
Parameters
Details
You must have user administration capabilities on the SAS Metadata Server to delete an
InternalLogin object. For information about user administration capabilities, see “Users,
Groups, and Roles: Main Administrative Roles” in the SAS Intelligence Platform:
Security Administration Guide.
The DeleteInternalLogin method deletes the InternalLogin object that is associated with
the specified user. Use the DeleteMetadata method to delete the Person object that is
associated with the InternalLogin object.
Exceptions Thrown
The DeleteInternalLogin method does not return any exceptions.
Examples
The following is a Java example of a DeleteInternalLogin method call:
// Assumes a Person object with Name='testId' exists
// and has an InternalLogin object associated with it
String personName = "testId";
iSecurity.DeleteInternalLogin(personName);
FreeCredentials 135
Related Methods
• “SetInternalLoginUserOptions” on page 166
FreeCredentials
Short Description
Frees the handle returned by GetCredentials.
Category
Authorization methods
Interface Version
ISecurity 1.0
Syntax
FreeCredentials(credHandle);
Parameters
Details
The FreeCredentials method frees the SAS Metadata Server credentials associated with
the handle returned by the GetCredentials method. Each handle returned by the
GetCredentials method should be freed.
Exceptions Thrown
The FreeCredentials method does not return any exceptions.
Example
The following is a Java example of a FreeCredentials method call:
136 Chapter 8 • Authorization (ISecurity Interface)
Related Methods
• “GetCredentials” on page 144
GetApplicationActionsAuthorizations
Short Description
Returns authorizations for ApplicationActions in a SoftwareComponent object.
Category
Generalized authorization methods
Interface Version
ISecurity 1.1
Syntax
GetApplicationActionsAuthorizations(credHandle,applicationContext,options,output);
Parameters
Details
The GetApplicationActionsAuthorizations method returns authorizations based on
ApplicationAction objects that are associated with a SoftwareComponent object. These
authorizations indicate the actions that a user can perform in the application that is
represented by the SoftwareComponent object.
The expected use is that applications define ApplicationAction objects that are valid for
their application, as well as for a user context. The GetApplicationActionAuthorizations
method lists the ApplicationActions for which the specified user has been granted
Execute permission.
When a credential handle is used, the method returns authorizations for the identity that
corresponds to the specified handle. If the CREDHANDLE parameter is an empty string,
the method returns authorizations for the calling user.
If authorization is requested based on role membership, you should specify the Role
name in the form ROLE_rolename. In the string ROLE_rolename:
• ROLE_ is a character constant prefix.
• rolename is the Name value of a Role object on the SAS Metadata Server.
The PERMCOND option returns any PermissionCondition objects that have been
defined to qualify an authorization.
138 Chapter 8 • Authorization (ISecurity Interface)
The ALLATTRS option returns the following attributes about each granted
ApplicationAction:
ActionIdentifier
fixed system name of the ApplicationAction
Name
localizable name of the ApplicationAction
ActionType
optional application-specific descriptor for the ApplicationAction
ObjectIdentifier
metadata identifier of the ApplicationAction object
Exceptions Thrown
The SAS Open Metadata Interface explicitly returns the following exceptions for the
GetApplicationActionsAuthorizations method:
• NotTrustedUser
• InvalidCredHandle—This exception is also returned when the ROLE_rolename
value is invalid or does not exist.
• InvalidResourceSpec
Related Methods
“IsInRole” on page 164
GetAuthorizations
Short Description
Gets authorization information for a resource, depending on the type of authorization
requested.
Category
Authorization methods
Interface Version
ISecurity 1.0
Syntax
GetAuthorizations(authType,credHandle,resource,permission,authorizations);
GetAuthorizations 139
Parameters
Details
The GetAuthorizations method performs authorization queries. The input for processing
the query, and the format and content of the information returned, are determined by the
AUTHTYPE parameter.
An AUTHTYPE value of Cube returns a two-dimensional string array. The number of
rows depends on the structure of the cube. Each row has the following four columns:
Type
Indicates the metadata type in the row. This is either Hierarchy, Dimension,
SharedDimension, Measure, or Level.
Name
Returns the Name attribute of the metadata type instance.
Authorized
Returns a Y or N, indicating whether the permission being requested has been
granted to the user in this cube component.
PermissionCondition
When the Authorized column has a value of Y, this column returns a condition that
must be enforced on the cube component to allow access. For more information, see
the description of the PERMISSIONCONDITION parameter in “IsAuthorized” on
page 160.
An AUTHTYPE value of SharedDimension returns a two-dimensional string array. In
this case, the first row of output contains the aforementioned column values for the
SharedDimension, itself. Subsequent rows contain column values for each Level and
Hierarchy object associated to the SharedDimension.
140 Chapter 8 • Authorization (ISecurity Interface)
Exceptions Thrown
The SAS Open Metadata Interface explicitly returns the following exceptions for the
GetAuthorizations method:
• NotTrustedUser
• InvalidCredHandle
• InvalidResourceSpec
• InvalidAuthType
Examples
The following is a Java example of a GetAuthorizations method. The method call gets
authorizations for a cube. Code is included that formats and prints the results of the
request.
public void getAuthorizationsforCube() throws Exception {
try
{
// Issue GetAuthorizations on a predefined cube. Assume that a credential
// handle was obtained earlier. Supported authType values are “Cube”
// or "SharedDimension". This call gets authorizations for a cube.
// “Read” is the permission being sought.
System.out.println();
// Specifies to print a title and parameter values.
System.out.println("<<<<<< getAuthorizations() call parameters
(Read Permission) with results >>>>>>");
System.out.println("credHandle=" + credHandle.value);
System.out.println("resourceURN=" + cube_URN);
System.out.println("permission=Read");
catch (Exception e) {
System.out.println("GetAuthorizations: GetInfo: other Exception");
e.printStackTrace();
throw e;
}
Related Methods
• “IsAuthorized” on page 160
GetAuthorizationsforObjects
Short Description
Gets authorizations for a specified set of objects and permissions.
Category
Generalized authorization methods
Interface Version
ISecurity 1.1
Syntax
GetAuthorizationsforObjects(credHandle,permissions,resources,permMask,GRANT,
conditionNDXs,conditionPermMasks,conditions);
142 Chapter 8 • Authorization (ISecurity Interface)
Parameters
Details
The GetAuthorizationsforObject method reduces the number of calls to the SAS
Metadata Server for authorization decisions that require permissions on multiple
metadata objects to be evaluated. For the specified set of metadata objects and a
corresponding set of permissions (which can be different for each object), the method
returns GRANT or a null value, and any PermissionCondition objects that are associated
with a GRANT. A null value indicates that the permission was denied or not specified
for the object.
When an empty string is passed in CREDHANDLE, the method evaluates authorizations
for the calling user.
This is an example of a PERMISSIONS array:
144 Chapter 8 • Authorization (ISecurity Interface)
For information about the format of a resource identifier, see “Identifying Resources to
ISecurity Methods” on page 131.
This is an example of a RESOURCES array:
{
"OMSOBJ:Library/A5DRX6L4.AQ000001",
"OMSOBJ:Table/A5DRX6L4.AT000001",
"OMSOBJ:Column/A5DRX6L4.AU000006",
"OMSOBJ:Column/A5DRX6L4.AU000007"
}
Using information from the previous examples, the PERMMASK array indicates the
following:
• the Read, Write, and Create Table permissions are enforced for OMSOBJ:Library/
A5DRX6L4.AQ000001
• the Read, Write, Create Table, and Select permissions are enforced for
"OMSOBJ:Table/A5DRX6L4.AT000001"
• the Read permission is enforced for OMSOBJ:Column/A5DRX6L4.AU000006
• the Write permission is enforced for OMSOBJ:Column/A5DRX6L4.AU000007
Exceptions Thrown
The SAS Open Metadata Interface explicitly returns the following exceptions for the
GetAuthorizationsforObjects method:
• InvalidCredHandle
• PermissionDoesNotExist
• InvalidObjectSpecification
• ObjectDoesNotExist
• InvalidPermMask
Related Methods
• “GetAuthorizations” on page 138
• “GetApplicationActionsAuthorizations” on page 136
GetCredentials
Short Description
Returns a handle to a credential.
GetCredentials 145
Category
Authorization methods
Interface Version
ISecurity 1.0
Syntax
GetCredentials(userid,credHandle);
Parameters
Details
The GetCredentials method returns a credential handle for the user identified in the
USERID parameter. If the USERID parameter contains an empty string, a credential
handle is returned for the user making the request.
A credential handle is a token representing an identity’s authorizations on the SAS
Metadata Server. Clients get and use the handle to reduce the number of authorization
requests made to the SAS Metadata Server on behalf of a user.
Every credential handle that is returned by the GetCredentials method should be freed
using the FreeCredentials method when it is no longer needed.
Exceptions Thrown
The SAS Open Metadata Interface explicitly returns the following exceptions for the
GetCredentials method:
• NoCredential
• NotTrustedUser
Example
The following is a Java example of a GetCredentials method call:
146 Chapter 8 • Authorization (ISecurity Interface)
iSecurity.GetCredentials(testUserId,credHandle);
}
catch (Exception e) {
System.out.println(”GetCredentials: Exceptions”);
e.printStackTrace();
throw e;
}
Related Methods
• “FreeCredentials” on page 135
• “GetIdentity” on page 146
GetIdentity
Short Description
Gets identity metadata for the specified user.
Category
Authorization methods
Interface Version
ISecurity 1.0
Syntax
GetIdentity(credHandle,identity);
GetIdentity 147
Parameters
Details
By specifying a credential handle to the GetIdentity method, it returns a URN-like string
describing the identity that corresponds to the specified handle. An identity refers to a
Person or IdentityGroup object describing a user in a SAS Metadata Repository. The
URN-like string is in the following form:
OMSOBJ: MetadataType/ObjectId
where
• MetadataType is Person or IdentityGroup.
• ObjectId is a unique metadata object instance identifier in the form
Reposid.ObjectId.
If the CREDHANDLE parameter is an empty string, the output is identity metadata for
the requesting user.
If the call is being made on behalf of a user whose user ID is known, specify it in the
form LOGINID:userid to eliminate the need to issue GetCredentials and FreeCredentials
calls before GetIdentity. In the LOGINID:userid string:
• LOGINID is a keyword that specifies to search Login objects.
• userid is the value of a Login object’s UserID attribute.
Exceptions Thrown
The SAS Open Metadata Interface explicitly returns the following exception for the
GetIdentity method:
• InvalidCredHandle
Examples
The following are Java examples that show the three ways a GetIdentity call can be
issued:
// GetIdentity() returns a URN-like string representing the metadata
// object identifier of an identity specified in the first parameter. The
148 Chapter 8 • Authorization (ISecurity Interface)
iSecurity.GetIdentity("",identityValue);
iSecurity.GetIdentity(credHandle.value,identityValue);
Related Methods
• “GetCredentials” on page 144
GetInfo
Short Description
Retrieves identity information, depending on the value in the INFOTYPE parameter,
including the origin of a specified user’s privileges, the value of active enterprise
policies, and so on.
Category
Generalized authorization methods
Interface Version
ISecurity 1.1
Syntax
GetInfo("infoType",credHandle,options,output);
GetInfo 149
Parameters
Details
CREDHANDLE Options
If CREDHANDLE is an empty string, then “INFOTYPE” requests information for the
connected user. If CREDHANDLE is a credential handle and the connected user is a
trusted user, or it is a URN-like or IdentityType: Name identifier, then information is
returned for the specified identity. For information about the format of a URN, see
“Identifying Resources to ISecurity Methods” on page 131. When an identifier other
than a credential handle is used, the connected user does not have to be a trusted user.
150 Chapter 8 • Authorization (ISecurity Interface)
AuthenticatedUserid
Returns the domain-qualified user ID used to make the connection to the SAS
Metadata Server, or the domain-qualified user ID corresponding to the specified
CREDHANDLE.
IdentityName
Returns the Name attribute value of the Person or IdentityGroup object that
corresponds to the authenticated user ID.
IdentityType
Returns Person or IdentityGroup.
IdentityObjectID
Returns the 17–character metadata object identifier of the specified identity.
UnrestrictedSource
Valid values are Role, ConfigFile, or 'Role, ConfigFile'.
INFOTYPE=“SASPW_Alias” Output
The “SASPW_Alias” value has no option keywords. It returns the
AuthenticationDomain alias of the SASPassword authentication provider. The default
value is saspw. However, if the AUTHPROVIDERDOMAIN start-up option is used to
specify a different alias, then this INFOTYPE value returns the alias.
Exceptions Thrown
The SAS Open Metadata Interface explicitly returns the following exceptions for the
GetInfo method:
• InvalidCredHandle
• InvalidInfoType
• InvalidOptionName
• InvalidOptionValue
Examples
The following is a Java example of a GetInfo method call. The method is issued twice.
The first time it is issued, it gets identity information for the connected user. The second
time, it gets identity information for a credentialed user. The example includes code that
formats and prints the information returned by the two requests:
public void getInfo() throws Exception {
try
152 Chapter 8 • Authorization (ISecurity Interface)
{
// Defines the GetIdentityInfo “ReturnUnrestrictedSource” option.
final String[][] options ={{"ReturnUnrestrictedSource",""}};
// Issues the GetInfo method for the current iSecurity connection user.
iSecurity.GetInfo("GetIdentityInfo","", options, info);
String[][] returnArray = info.value;
System.out.println();
// Specifies a title for the output.
System.out.println("<<<<<< getInfo() for ISecurity Connection User >>>>>>");
System.out.println("credHandle=''");
for (int i=0; i< returnArray.length; i++ )
{
System.out.println(returnArray[i][0] + "=" + returnArray[i][1]);
}
// Defines a stringholder for the credential handle.
StringHolder credHandle = new StringHolder();
System.out.println();
// Skip one line
// Specifies a title to print in the output.
System.out.println("<<<<<< getInfo() for Credentialed User >>>>>>");
System.out.println("credHandle=" + credHandle.value);
for (int i=0; i< returnArray.length; i++ )
{
System.out.println(returnArray[i][0] + "=" + returnArray[i][1]);
}
System.out.println("");
// Skip a line
System.out.println("<<<< End getInfo() >>>>" );
}
// The following code catches the method’s exceptions.
catch (Exception e) {
System.out.println("GetInfo: Exceptions");
e.printStackTrace();
throw e;
}
}
GetInternalLoginSitePolicies 153
Related Methods
• “GetInternalLoginUserInfo” on page 155
GetInternalLoginSitePolicies
Short Description
Returns the active server-level internal authentication policies.
Category
Internal authentication methods
Interface Version
ISecurity 1.1
Syntax
GetInternalLoginSitePolicies(siteMinPasswordLength,siteIsDigitRequired,
siteIsMixedCaseRequired,siteSizeHistoryList,sitePasswordChangeDelayInMinutes,
siteExpirationDays,siteNumFailuresForLockout,siteLockoutInMinutes,
siteDaysToSuspension);
154 Chapter 8 • Authorization (ISecurity Interface)
Parameters
Details
Parameters are holders for receiving output values, and all parameters are required. That
is, the caller must specify all parameters to get values back. A caller cannot leave any
variables empty to indicate that he or she doesn’t want a value for that parameter.
Exceptions Thrown
The GetInternalLoginSitePolicies method does not return any exceptions.
GetInternalLoginUserInfo 155
Examples
The following is a Java example of a GetInternalLoginSitePolicies method call:
IntHolder siteMinPasswordLength = new IntHolder();
BooleanHolder siteIsDigitRequired = new BooleanHolder();
BooleanHolder siteIsMixedCaseRequired = new BooleanHolder();
IntHolder siteSizeHistoryList = new IntHolder();
IntHolder sitePasswordChangeDelayInMinutes = new IntHolder();
IntHolder siteExpirationDays = new IntHolder();
IntHolder siteNumFailuresForLockout = new IntHolder();
IntHolder siteLockoutInMinutes = new IntHolder();
IntHolder siteDaysToSuspension = new IntHolder();
iSecurity.GetInternalLoginSitePolicies( siteMinPasswordLength,
siteIsDigitRequired,
siteIsMixedCaseRequired,
siteSizeHistoryList,
sitePasswordChangeDelayInMinutes,
siteExpirationDays,
siteNumFailuresForLockout,
siteLockoutInMinutes,
siteDaysToSuspension );
Related Methods
• “GetInternalLoginUserInfo” on page 155
• “SetInternalLoginUserOptions” on page 166
GetInternalLoginUserInfo
Short Description
Gets availability information and internal authentication settings for the specified user.
Category
Internal authentication methods
Interface Version
ISecurity 1.1
Syntax
GetInternalLoginUserInfo(personName,hasInternalLogin,isDisabled,bypassStrength,
bypassHistory,useStdExpirationDays,expirationDays,bypassLockout,
bypassInactivitySuspension,doesAccountExpire,accountExpirationDate,
156 Chapter 8 • Authorization (ISecurity Interface)
lastPasswordChange,lastLogin,numFailuresSinceLogin,
lastLockout,isLockedOut,isExpired,isSuspend,isAccountExpired);
Parameters
Details
Except for PERSONNAME, parameters are holders for receiving output values.
If an internal user account suddenly becomes unavailable, use the
GetInternalLoginUserInfo method to determine why the account is unavailable. In
addition to returning the specified Person object’s internal authentication policy settings,
output parameters indicate whether the account is active, disabled, expired, locked out
because of unsuccessful authentication, or suspended because of inactivity.
Exceptions Thrown
The GetInternalLoginUserInfo method does not return any exceptions.
Examples
The following is a Java example of a GetInternalLoginUserInfo method call:
// Assumes a Person object with Name='Test1' exists
// and has an InternalLogin object associated with it
String personName ="Test1";
BooleanHolder hasInternalLogin = new BooleanHolder();
BooleanHolder isDisabled = new BooleanHolder();
BooleanHolder bypassStrength = new BooleanHolder();
BooleanHolder bypassHistory = new BooleanHolder();
BooleanHolder useStdExpirationDays = new BooleanHolder();
IntHolder expirationDays = new IntHolder();
BooleanHolder bypassLockout = new BooleanHolder();
158 Chapter 8 • Authorization (ISecurity Interface)
GetInternalLoginUserInfo( personName,
hasInternalLogin,
isDisabled,
bypassStrength,
bypassHistory,
useStdExpirationDays,
expirationDays,
bypassLockout,
bypassInactivitySuspension,
doesAccountExpire,
accountExpirationDate,
lastPasswordChange,
lastLogin,
numFailuresSinceLogin,
lastLockout,
isLockedOut,
isExpired,
isSuspended,
isAccountExpired );
Related Methods
• “SetInternalLoginUserOptions” on page 166
• “GetInternalLoginSitePolicies” on page 153
GetLoginsforAuthDomain
Short Description
Retrieves the logins for the connected user for the specified authentication domain in
order of identity precedence.
Category
Category: Generalized authorization methods
GetLoginsforAuthDomain 159
Interface Version
ISecurity 1.1
Syntax
GetLoginsforAuthDomain(credHandle,authDomain,options,output);
Parameters
Details
CREDHANDLE identifies the user identity for whom logins are being requested. When
this value is an empty string, the user identity of the caller is used.
Logins are returned in priority order following identity precedence. For information
about identity precedence, see the SAS Intelligence Platform: Security Administration
Guide.
Exceptions Thrown
The SAS Open Metadata Interface explicitly returns the following exceptions for the
GetLoginsforAuthDomain method:
• InvalidCredHandle
• InvalidOptionName
• InvalidOptionValue
• AuthDomainDoesNotExist
Related Methods
• “GetCredentials” on page 144
• “GetInfo” on page 148
IsAuthorized
Short Description
Determines whether an authenticated user is authorized to access a resource with a
specific permission.
IsAuthorized 161
Category
Authorization methods
Interface Version
ISecurity 1.0
Syntax
IsAuthorized(credHandle,resource,permission,permissionCondition,authorized);
Parameters
Details
If the CREDHANDLE parameter is an empty string, authorization is returned for the
requesting user.
The RESOURCE parameter identifies the object to which access is requested. The
parameter accepts two types of input:
• A URN that specifies an application element in the following form:
OMSOBJ: MetadataType/ObjectId
repository ACT controls whether a user can create objects in the repository. A client can
use the URN to determine whether the user represented by the CREDHANDLE
parameter is granted or denied WriteMetadata, which determines whether the user can
create objects in the repository. Group memberships are evaluated when making the
decision. For example, if the requesting user is not specifically denied WriteMetadata
permission in the repository ACT, and a group to which he belongs is granted
WriteMetadata permission in the repository ACT, then he is allowed to create objects in
the repository. For more information about identity precedence, see SAS Intelligence
Platform: Security Administration Guide.
The PERMISSION parameter specifies the permission to check for. A single permission
value can be passed to the IsAuthorized method.
The PERMISSIONCONDITION parameter is used with data permissions, such as Read
and Write. A value returned in this parameter indicates that a permission is granted, but
only if the condition specified in an associated PermissionCondition object is met. The
syntax of a permission condition is not defined. It is specific to the resource being
protected and to the technology responsible for enforcing the security of the resource.
For example, a PermissionCondition object for a table would contain an SQL WHERE
clause, but for an OLAP dimension, it would contain an MDX expression identifying the
level members that can be accessed in the OLAP dimension.
It is possible for a user to have multiple permission conditions associated with his or her
access to a resource. In this case, the PERMISSIONCONDITION parameter is returned
with multiple strings embedded. Each embedded condition is separated from the
preceding condition by the string <!--CONDITION-->. If you receive a
PERMISSIONCONDITION output string, you must check to see whether it contains
multiple permission conditions by searching for <!--CONDITION--> in the returned
string. If multiple permission conditions are found, then they should be used to filter data
so the resulting data is a union of the data returned for each permission condition
individually. In other words, the permission conditions would have the OR operation
performed on them.
Exceptions Thrown
The SAS Open Metadata Interface explicitly returns the following exceptions for the
isAuthorized method:
• NotTrustedUser
• InvalidCredHandle
• InvalidResourceSpec
Example
The following is a Java example of the IsAuthorized method. The method is issued to
determine whether the credentialed user has Read permission to the requested table. The
example includes code that formats and prints the results of the request.
public void isAuthorized() throws Exception {
try
{
System.out.println("");
// Skip a line
System.out.println("<<<< Begin isAuthorized() >>>>" );
IsAuthorized 163
System.out.println();
// Specify a title for the output and to print parameter
// values along with the isAuthorized result.
System.out.println("<<<<<< isAuthorized() call parameters with
(Read Permission) results >>>>>>");
System.out.print("credHandle=" + credHandle.value + ", ");
System.out.print("resourceURN=" + table_URN + ", ");
System.out.print("permission=Read, ");
System.out.print("permissonCondition=" + permCond.value + ", ");
System.out.print("isAuth=" + isAuth.value);
System.out.println();
// force NewLine
The user represented by the credential handle has Read permission to PhysicalTable
A5CY5BIY.AO000003.
Related Methods
• “GetAuthorizations” on page 138
164 Chapter 8 • Authorization (ISecurity Interface)
IsInRole
Short Description
Returns the TRUE value when the user specified in CREDHANDLE is in a role.
Category
Generalized authorization methods
Interface Version
ISecurity 1.1
Syntax
IsInRole(credHandle,roleSpec,options,inRole);
Parameters
Details
The IsInRole method determines whether a user is in the specified role. The role is
identified by the value in the Role object’s Name attribute or by its metadata object
identifier.
IsInRole 165
Exceptions Thrown
The SAS Open Metadata Interface explicitly returns the following exceptions for the
IsInRole method:
• NotTrustedUser
• InvalidCredHandle
• InvalidResourceSpec
Examples
The following is a Java example of the IsInRole method. The method requests to know
whether the Person object named testUser has membership in the User and Group
Administrators role. The example includes code that formats and prints the results of the
request.
public void isInRole() throws Exception {
try
{
// Define a two-dimensional string array for options
final String[][] options ={{"",""}};
System.out.println("");
// Skip a line
System.out.println("<<<< Begin isInRole() >>>>" );
iSecurity.FreeCredentials(credHandle.value);
System.out.println("");
// Skip a line
System.out.println("<<<< End isInRole() >>>>" );
}
// Catch the method’s exceptions.
catch (Exception e) {
System.out.println("IsInRole: GetInfo: Exceptions");
e.printStackTrace();
throw e;
}
Related Methods
• “GetApplicationActionsAuthorizations” on page 136
SetInternalLoginUserOptions
Short Description
Customizes internal authentication policies for the specified user.
Category
Internal authentication methods
Interface Version
ISecurity 1.1
Syntax
SetInternalLoginUserOptions(personName,isDisabled,bypassStrength,bypassHistory,
useStdPasswordExpirationDate,passwordExpirationDays,bypassLockout,
bypassInactivitySuspension,expireAccount,accountExpirationDate);
SetInternalLoginUserOptions 167
Parameters
Details
You must have user administration capabilities on the SAS Metadata Server to modify
the properties of an internal user account. For information about user administration
capabilities, see “Users, Groups, and Roles: Main Administrative Roles” in the SAS
Intelligence Platform: Security Administration Guide.
An internal account has a Person object with a simple name value. For example,
Name="Joe". It also has an associated InternalLogin object, whose Name attribute is
person@saspw. For example, Name="Joe@saspw." All SAS internal accounts must use
the suffix @saspw.
The Person object is created with the AddMetadata method. Its attributes are modified
with the UpdateMetadata method. An InternalLogin object is created with the
SetInternalPassword method. Its attributes are modified with the
SetInternalLoginUserOptions method.
By default, new InternalLogin objects are created with the active server-level internal
account policies. The active server-level account policies are the system defaults as
modified by omaconfig.xml options. The SetInternalLoginUserOptions method enables
you to customize the server-level policies for a particular internal account.
For information about system defaults, see “How to Change Internal Account Policies”
in the SAS Intelligence Platform: Security Administration Guide. To determine what the
active policy settings are after the omaconfig.xml options are applied, use the
GetInternalLoginSitePolicies method.
New InternalLogin objects are created with a 30–day password expiration period. If you
change the USESTDPASSWORDEXPIRATIONDAYS parameter to F, then the
password does not expire and the integer value in passwordExpirationDays is ignored.
To view the policy settings on an existing internal account, use the
GetInternalLoginUserInfo method. The GetInternalLoginUserInfo method also reports
the status of the internal account. For example, returned values indicate whether the
account is active, disabled, locked out because of unsuccessful authentication, or
suspended because of inactivity.
Exceptions Thrown
The SetInternalLoginUserOptions method does not return any exceptions.
Examples
The following is a Java example of a SetInternalLoginUserOptions method call:
// Assumes a Person object with Name='testId' already exists
// and has an InternalLogin object associated with it
iSecurity.SetInternalLoginUserOptions( testId, // username
SetInternalPassword 169
false, // isDisabled
false, // bypassStrength
true, // bypassHistory
false, // useStdPasswordExpirationDays
30, // passwordExpirationDays
false, // bypassLockout
true, // bypassInactivitySuspension
false, // expireAccount
0 // accountExpirationDate );
Related Methods
• “GetInternalLoginSitePolicies” on page 153
• “GetInternalLoginUserInfo” on page 155
• “DeleteInternalLogin” on page 133
SetInternalPassword
Short Description
Creates an InternalLogin object for the specified user.
Category
Internal authentication methods
Interface Version
ISecurity 1.1
Syntax
SetInternalPassword(personName,passwordValue);
Parameters
Details
You must have user administration capabilities on the SAS Metadata Server to create an
InternalLogin object. For information about user administration capabilities, see “Users,
Groups, and Roles: Main Administrative Roles” in the SAS Intelligence Platform:
Security Administration Guide.
Internal logins are not intended for regular users. They are intended for metadata
administrators and some service identities. For more information, see “SAS Internal
Authentication” in the SAS Intelligence Platform: Security Administration Guide.
The SetInternalPassword method creates an InternalLogin object and associates it with
the specified Person object. Together, the two objects define an internal account. The
new InternalLogin object is created with the site’s internal authentication policies. To
determine what the active policy settings are, use the GetInternalLoginSitePolicies
method. Or, use the GetInternalLoginUserInfo method to list the new object’s properties.
New InternalLogin objects are created with a 30-day password expiration period. To
deactivate the password expiration period or customize its length, or to customize other
internal authentication settings, use the SetInternalLoginUserOptions method. If the
ExpirePasswordonReset option is set in the site’s omaconfig.xml file, the user will have
to reset the initial password before the internal account can be used.
Exceptions Thrown
The SetInternalPassword method does not return any exceptions.
Examples
The following is a Java example of a SetInternalPassword method call:
// Defines parameters personName and passwordValue assuming
// a Person object with Name='testId' already exists
String personName = "testId";
String passwordValue = "pw1234";
iSecurity.SetInternalPassword(personName,passwordValue);
Related Methods
• “GetInternalLoginSitePolicies” on page 153
• “GetInternalLoginUserInfo” on page 155
• “SetInternalLoginUserOptions” on page 166
171
Chapter 9
Security Administration
(ISecurityAdmin Interface)
The ISecurityAdmin interface is provided in the sas.oma.omi.jar file in the SAS Platform
VJR. A Java client accesses the ISecurityAdmin interface by importing the appropriate
com.sas.meta.SASOMI packages. Import com.sas.meta.SASOMI.ISecurityAdmin,
com.sas.meta.SASOMI.ISecurityAdminPackage, and com.sas.metadata.remote into your
client.
The SAS Java Metadata Interface provides the MdFactory interface to instantiate an
object factory for the SAS Metadata Server and the MdOMRConnection interface for
connecting to the SAS Metadata Server. Use the MdOMRConnection interface’s
makeISecurityAdminConnection method to connect to the server with the
ISecurityAdmin interface.
GetAccessControlTemplateList
Lists all ACTs in the specified repository or in all public repositories. For more
information, see “GetAccessControlTemplateList” on page 187.
SetAccessControlTemplateAttribs
Changes the attributes of an ACT. For more information, see
“SetAccessControlTemplateAttribs” on page 200.
ApplyACTToObj
Short Description
Applies the authorizations defined in an ACT to the specified resource.
Category
General authorization administration methods
Syntax
ApplyACTToObj(tCtxt,resource,flags,ACTresource);
Parameters
Details
The ACT must exist before you can apply it with the ApplyACTToObj method. You can
create an ACT with the CreateAccessControlTemplate method.
When TCTXT is set to a valid value, the permanent application of the ACT is deferred
until the EndTransactionContext method is invoked on a resource with the
176 Chapter 9 • Security Administration (ISecurityAdmin Interface)
Exceptions Thrown
The SAS Open Metadata Interface explicitly returns the following exceptions for the
ApplyACTToObj method:
• SECAD_INVALID_TC_HANDLE
• SECAD_INVALID_RESOURCE_SPEC
• SECAD_INVALID_ACTION
• SECAD_OBJECT_NOT_ACT
• SECAD_ACT_DOES_NOT_EXIST
• SECAD_ACT_IN_DEPENDENT_REPOSITORY
• SECAD_NOT_AUTHORIZED
Examples
The following code fragment shows how the ApplyACTToObj method is issued in a
Java environment:
public void applyAccessControlTemplateToObj(String transCtxt, String resource,
int options, String ACTspec ) throws Exception {
try
{
SecurityAdmin.ApplyACTToObj(transCtxt, resource, options, ACTspec);
}
catch (Exception e)
{
System.out.println("ApplyACTToObj: Exceptions");
e.printStackTrace();
throw e;
}
}
The following example issues the ApplyACTToObj method to apply a predefined ACT
to an existing Tree object that represents a folder. The ACT is identified by ACTSPEC:
public void ApplyACTToObj() throws Exception {
// Define an object variable for the Tree
Tree_URN = "OMSOBJ:Tree/metadata-identifier";
// Apply the ACT to a Tree. Because resource is used, the tCtxt parameter is null.
iSecurityAdmin.ApplyAccessControlTemplateToObj("",Tree_URN, 0, ACTspec);
}
catch (Exception e)
{
throw e;
}
}
Related Methods
• “CreateAccessControlTemplate” on page 179
• “RemoveACTFromObj” on page 198
• “DestroyAccessControlTemplate” on page 181
BeginTransactionContext
Short Description
Creates a transaction context for an authorization request.
Category
Transaction context methods
Syntax
BeginTransactionContext(resource,flags,tCtxt);
Parameters
Details
The BeginTransactionContext method gets a transaction context for the metadata object
specified in RESOURCE. A handle to the new transaction context is returned in the
output TCTXT parameter. Use this handle to identify the pertinent transaction context in
general authorization administration methods and ACT administration methods.
If the target resource is not immediately known, submit the method with an empty string
in the RESOURCE parameter. You can identify the target resource for the authorization
changes in the EndTransactionContext method.
Exceptions Thrown
The SAS Open Metadata Interface explicitly returns the following exceptions for the
BeginTransactionContext method:
• SECAD_INVALID_RESOURCE_SPEC
• SECAD_NOT_AUTHORIZED
Examples
The following code fragment shows how the BeginTransactionContext method is issued
in a Java environment:
public void beginTransactionContext (String obj, StringHolder tCtxt) throws Exception
{
try
{
iSecurityAdmin.BeginTransactionContext (obj, 0, tCtxt);
}
catch (Exception e)
{
System.out.println("BeginTransactionContext: Exceptions");
e.printStackTrace();
throw e;
}
}
Related Methods
• “EndTransactionContext” on page 183
CreateAccessControlTemplate 179
CreateAccessControlTemplate
Short Description
Creates an ACT.
Category
ACT administration methods
Syntax
CreateAccessControlTemplate(tCtxt,REPOSresource,ACT_attributes);
Parameters
Details
The CreateAccessControlTemplate method creates an ACT object. You must use the
SetAuthorizationOnObjs method with the SETACTCONTENTS parameter set to TRUE
to add or remove authorizations on the ACT object.
Only the Name attribute is required to be defined in ACT_ATTRIBUTES to create an
ACT object. The Name value must be unique in the target repository.
Two other attributes are supported in ACT_ATTRIBUTES:
Desc="text"
Specifies a description of the ACT. A string up to 200 characters is supported.
180 Chapter 9 • Security Administration (ISecurityAdmin Interface)
Use="null | REPOS"
Specifies an empty string or the value REPOS. An empty string indicates the ACT is
applied to one or more objects in the repository. The value REPOS sets the ACT as
the repository default ACT.
To change the attributes of an existing ACT, use the SetAccessControlTemplateAttribs
method.
TCTXT identifies an optional transaction context in which to execute the request. When
TCTXT is null, the ACT is immediately persisted to the SAS Metadata Server instead of
being cached in a transaction context.
Exceptions Thrown
The SAS Open Metadata Interface explicitly returns the following exceptions for the
CreateAccessControlTemplate method:
• SECAD_INVALID_TC_HANDLE
• SECAD_INVALID_REPOS_SPEC
• SECAD_ACT_ALREADY_EXISTS
• SECAD_NOT_AUTHORIZED
Examples
The following code fragment shows how the CreateAccessControlTemplate method is
issued in a Java environment:
public void createAccessControlTemplate(String transCtxt, String repository,
String[][] ACTattributes ) throws Exception {
try
{
iSecurityAdmin.CreateAccessControlTemplate(transCtxt, repository, ACTattributes);
}
catch (Exception e) {
System.out.println("CreateAccessControlTemplate: Exceptions");
e.printStackTrace();
throw e;
}
}
ActAttribs);
}
catch (Exception e ){
throw e;
}
}
Related Methods
• “SetAuthorizationsOnObj” on page 201
• “SetAccessControlTemplateAttribs” on page 200
• “DestroyAccessControlTemplate” on page 181
DestroyAccessControlTemplate
Short Description
Destroys an ACT and removes references to it from all associated objects.
Category
ACT administration methods
Syntax
DestroyAccessControlTemplate(tCtxt,ACTresource);
Parameters
Details
The DestroyAccessControlTemplate method destroys an ACT object and removes all
references to it from all associated objects.
182 Chapter 9 • Security Administration (ISecurityAdmin Interface)
When TCTXT is set to a valid value, the destruction of the ACT and removal of its
references is deferred until the EndTransactionControl method is invoked on a resource
with the SECAD_COMMIT_TC flag.
When TCTXT is null and ACTRESOURCE is set to a valid value, the ACT is destroyed
immediately, along with all references. For instructions on how to format a URN for the
ACTRESOURCE parameter, see “Using the ISecurityAdmin Server Interface” on page
172.
Exceptions Thrown
The SAS Open Metadata Interface explicitly returns the following exceptions for the
DestroyAccessControlTemplate method:
• OK
• SECAD_INVALID_TC_HANDLE
• SECAD_INVALID_RESOURCE_SPEC
• SECAD_OBJECT_NOT_ACT
• SECAD_ACT_DOES_NOT_EXIST
• SECAD_NOT_AUTHORIZED
Examples
The following code fragment shows how the DestroyAccessControlTemplate method is
issued in a Java environment:
public void destroyAccessControlTemplate(String transCtxt, String
ACTSpec)
throws Exception {
try
{
iSecurityAdmin.DestroyAccessControlTemplate(transCtxt, ACTSpec);
}
catch (Exception e) {
System.out.println("DestroyAccessControlTemplate: Exceptions");
e.printStackTrace();
throw e;
}
}
try {
iSecurityAdmin.destroyAccessControlTemplate("", ACTspec);
}
catch (Exception e)
{
throw e;
}
}
EndTransactionContext 183
Related Methods
• “CreateAccessControlTemplate” on page 179
• “RemoveACTFromObj” on page 198
EndTransactionContext
Short Description
Terminates the transaction context for the specified TCTXT handle.
Category
Transaction context methods
Syntax
EndTransactionContext(tCtxt,resource,flags);
Parameters
resource string in Passed resource identifier for the object for which
the transaction context is to be terminated, if
TCTXT was obtained using a null value.
Details
The EndTransactionContext method terminates the transaction context on the specified
resource.
184 Chapter 9 • Security Administration (ISecurityAdmin Interface)
Exceptions Thrown
The SAS Open Metadata Interface explicitly returns the following exceptions for the
EndTransactionContext method:
• SECAD_INVALID_TC_HANDLE
• SECAD_INVALID_ACTION
• SECAD_NOT_AUTHORIZED
Examples
The following code fragment shows how the EndTransactionContext method is issued in
a Java environment:
public void endTransactionContext (String transCtxt, int options) throws
Exception
{
try
{
iSecurityAdmin.EndTransactionContext (transCtxt, "", options);
}
catch (Exception e)
{
System.out.println("EndTransactionContext: Exceptions");
e.printStackTrace();
throw e;
}
}
Related Methods
• “BeginTransactionContext” on page 177
GetAccessControlTemplatesOnObj 185
GetAccessControlTemplatesOnObj
Short Description
Lists the ACTs that are associated with a resource.
Category
General authorization administration methods
Syntax
GetAccessControlTemplatesOnObj(tCtxt,resource,flags,ACT_list);
Parameters
Details
The GetAccessControlTemplatesOnObj method returns ACT_LIST when TCTXT or
RESOURCE is specified, even if there are no ACTs (an empty list is returned).
When TCTXT is specified and previous calls to the ApplyACTToObj or
RemoveACTFromObj method on this TCTXT modified the list of ACTs protecting the
resource, then the modified list is returned. Until the EndTransactionContext method is
executed on the TCTXT with SECAD_COMMIT_TC, the content of ACT_LIST might
not reflect the actual ACTs currently protecting the resource.
When RESOURCE is specified in the GetAccessControlTemplatesOnObj method, then
ACT_LIST returns the actual ACTs protecting the resource.
Exceptions Thrown
The SAS Open Metadata Interface explicitly returns the following exceptions for the
GetAccessControlTemplatesOnObj method:
• SECAD_INVALID_TC_HANDLE
• SECAD_INVALID_RESOURCE_SPEC
• SECAD_INVALID_ACTION
• SECAD_NOT_AUTHORIZED
Related Methods
• “ApplyACTToObj” on page 175
• “RemoveACTFromObj” on page 198
• “CreateAccessControlTemplate” on page 179
GetAccessControlTemplateAttribs
Short Description
Retrieves the attributes of an ACT.
Category
ACT administration methods
Syntax
GetAccessControlTemplateAttribs(tCtxt,ACTresource,ACT_attributes);
GetAccessControlTemplateList 187
Parameters
Details
The GetAccessControlTemplateAttribs method retrieves the attributes of the specified
ACT object. The requested attributes are returned in the ACT_ATTRIBUTES parameter.
For a description of the ACT attributes, see “CreateAccessControlTemplate” on page
179.
Exceptions Thrown
The SAS Open Metadata Interface explicitly returns the following exceptions for the
GetAccessControlTemplateAttribs method:
• SECAD_INVALID_TC_HANDLE
• SECAD_INVALID_RESOURCE_SPEC
• SECAD_OBJECT_NOT_ACT
• SECAD_ACT_DOES_NOT_EXIST
• SECAD_NOT_AUTHORIZED
Related Methods
• “SetAccessControlTemplateAttribs” on page 200
GetAccessControlTemplateList
Short Description
Lists all ACTs in the specified repository or in all public repositories.
188 Chapter 9 • Security Administration (ISecurityAdmin Interface)
Category
ACT administration methods
Syntax
GetAccessControlTemplateList(tCtxt,REPOSresource,flags,ACT_list);
Parameters
Details
The GetAccessControlTemplateList method can return a large number of objects,
especially if the SECAD_REPOSITORY_DEPENDENCY_USES flag is set. Use of this
method within a transaction context is not recommended because of the overhead
associated with the method.
Exceptions Thrown
The SAS Open Metadata Interface explicitly returns the following exceptions for the
GetAccessControlTemplateList method:
• OK
• SECAD_INVALID_TC_HANDLE
• SECAD_INVALID_RESOURCE_SPEC
• SECAD_NOT_AUTHORIZED
Examples
The following code fragment shows how the GetAccessControlTemplateList method is
issued in a Java environment:
public void getAccessControlTemplateList(String transCtxt, String repositorySpec,
int options, VariableArray2dOfStringHolder ACTlist) throws Exception {
try
{
iSecurityAdmin.GetAccessControlTemplateList(transCtxt, repositorySpec,
options, ACTlist);
}
catch (Exception e) {
System.out.println("GetAccessControlTemplateList: Exceptions");
e.printStackTrace();
throw e;
}
}
{
try
{
iSecurityAdmin.GetAccessControlTemplateList("", "REPOSID:" + reposId, 0, ACTlist);
}
catch (Exception e) {
e.printStackTrace();
throw e;
}
}
190 Chapter 9 • Security Administration (ISecurityAdmin Interface)
Related Methods
• “GetAccessControlTemplateAttribs” on page 186
GetAuthorizationsOnObj
Short Description
Returns the authorizations that apply to a resource for specified identities and
permissions.
Category
General authorization administration methods
Syntax
GetAuthorizationsOnObj(tCtxt,resource,flags,identities,permissions,authorizations);
Parameters
Details
The GetAuthorizationsOnObj method returns authorizations for the resource specified
by the TCTXT or RESOURCE parameter.
Grant or denial of a permission for an identity is indicated by an integer in column 2 of
the array that is returned in the AUTHORIZATIONS parameter. Nine integer values are
supported, which correspond with a symbol that indicates the origin of the authorization
GetAuthorizationsOnObj 193
and whether the permission is granted. The integer values are described in the following
table.
Exceptions Thrown
The SAS Open Metadata Interface explicitly returns the following exceptions for the
GetAuthorizationsOnObj method:
• SECAD_INVALID_TC_HANDLE
• SECAD_INVALID_RESOURCE_SPEC
• SECAD_INVALID_ACTION
• SECAD_INVALID_IDENTITY_SPEC
• SECAD_IDENTITY_DOES_NOT_EXIST
• SECAD_INVALID_PERMISSION_SPEC
194 Chapter 9 • Security Administration (ISecurityAdmin Interface)
• SECAD_NOT_AUTHORIZED
Examples
The following code fragment shows how the GetAuthorizationsOnObj method is issued
in a Java environment:
public void getAccessControlTemplateList(String transCtxt, String repositorySpec,
int options, VariableArray2dOfStringHolder ACTlist ) throws Exception {
try
{
iSecurityAdmin.GetAccessControlTemplateList(transCtxt,
repositorySpec,
options,
ACTlist
);
}
catch (Exception e) {
System.out.println("GetAccessControlTemplateList: Exceptions");
e.printStackTrace();
throw e;
}
}
Related Methods
• “SetAuthorizationsOnObj” on page 201
GetIdentitiesOnObj 195
GetIdentitiesOnObj
Short Description
Returns Person, IdentityGroup, and Role objects associated with a specified resource.
Category
General authorization administration methods
Syntax
GetIdentitiesOnObj(tCtxt,resource,flags,id_List);
Parameters
Details
The GetIdentitiesOnObj method returns Person, IdentityGroup, and Role objects that
have permissions defined on a specified resource. Flags can be set to return the identity’s
DisplayName value and a value describing the origin of the permission.
When the specified resource is an ACT object, the method lists the identities that are
assigned permissions to protect the ACT, unless the SECAD_ACT_CONTENTS flag is
set. When this flag is set, the method lists identities that have permissions defined in the
ACT.
Exceptions Thrown
The SAS Open Metadata Interface explicitly returns the following exceptions for the
GetIdentitiesOnObj method:
• SECAD_INVALID_TC_HANDLE
• SECAD_INVALID_RESOURCE_SPEC
198 Chapter 9 • Security Administration (ISecurityAdmin Interface)
• SECAD_INVALID_ACTION
• SECAD_NOT_AUTHORIZED
Related Methods
• “GetAuthorizationsOnObj” on page 190
RemoveACTFromObj
Short Description
Removes the authorizations defined by an ACT from the specified resource.
Category
General authorization administration methods
Syntax
RemoveACTFromObj(tCtxt,resource,flags,ACTresource);
Parameters
resource string in Passed resource identifier for the object from which
the ACT should be removed. If TCTXT is used, do
not specify a value in RESOURCE.
Details
The RemoveACTFromObj method disassociates an ACT from a resource, while leaving
the ACT intact. Use the DestroyAccessControlTemplate method to destroy the ACT.
RemoveACTFromObj 199
Exceptions Thrown
The SAS Open Metadata Interface explicitly returns the following exceptions for the
RemoveACTFromObj method:
• SECAD_INVALID_TC_HANDLE
• SECAD_INVALID_RESOURCE_SPEC
• SECAD_INVALID_ACTION
• SECAD_OBJECT_NOT_ACT
• SECAD_ACT_DOES_NOT_EXIST
• SECAD_ACT_NOT_REMOVED
• SECAD_NOT_AUTHORIZED
Examples
The following code fragment shows how the RemoveACTFromObj method is issued
from a Java environment:
public void removeAccessControlTemplateFromObj(String transCtxt, String resource,
int options, String ACTspec ) throws Exception {
try
{
iSecurityAdmin.RemoveACTFromObj(transCtxt, resource, options, ACTspec);
}
catch (Exception e) {
System.out.println("RemoveACTFromObj: Exceptions");
e.printStackTrace();
throw e;
}
}
The following example removes the ACT identified by ACTspec from a Tree object
identified by Tree_URN:
public void RemoveAccessControlTemplateFromObj() throws Exception {
try
{
// Remove the ACT from the Tree to see the impact on authorizations
iSecurityAdmin.RemoveAccessControlTemplateFromObj "",Tree_URN, 0, ACTspec);
}
catch(Exception e)
{
e.printStackTrace();
throw e;
}
}
Related Methods
• “DestroyAccessControlTemplate” on page 181
200 Chapter 9 • Security Administration (ISecurityAdmin Interface)
SetAccessControlTemplateAttribs
Short Description
Changes the attributes of an ACT.
Category
ACT administration methods
Syntax
SetAccessControlTemplateAttribs(tCtxt,ACTresource,ACT_attributes);
Parameters
Details
The SetAccessControlTemplateAttribs method can be used to rename an ACT, modify
its description, and add or remove the ACT as the current default repository ACT. These
changes are made by specifying new values for the Name, Desc, and Use attributes.
The specified values replace the current values for the ACT identified by TCTXT or in
ACTRESOURCE. For information about the attributes, see
“CreateAccessControlTemplate” on page 179.
SetAuthorizationsOnObj 201
Exceptions Thrown
The SAS Open Metadata Interface explicitly returns the following exceptions for the
SetAccessControlTemplateAttribs method:
• SECAD_INVALID_TC_HANDLE
• SECAD_INVALID_RESOURCE_SPEC
• SECAD_OBJECT_NOT_ACT
• SECAD_ACT_ALREADY_EXISTS
• SECAD_ACT_DOES_NOT_EXIST
• SECAD_NOT_AUTHORIZED
Related Methods
• “CreateAccessControlTemplate” on page 179
• “GetAccessControlTemplateAttribs” on page 186
SetAuthorizationsOnObj
Short Description
Sets permissions for identities on a resource.
Category
General authorization administration methods
Syntax
SetAuthorizationsOnObj(tCtxt,resource,flags,authorizations);
Parameters
Details
The SetAuthorizationsOnObj method adds or removes permissions for an identity on a
resource. The TCTXT or RESOURCE parameter and the AUTHORIZATIONS
parameter are required. Other parameters can have a null value.
TCTXT or RESOURCE can specify an application metadata object or an ACT. When
RESOURCE is an ACT, be aware that the SECAD_ACT_CONTENTS flag changes the
behavior of the method. When this flag is set, the permission changes that you specified
in AUTHORIZATIONS are applied to the contents that define the ACT. As a result, the
changes affect all objects with which the ACT is associated. When this flag is not set, the
permission changes are applied to the authorizations that protect the ACT object.
Use the AUTHORIZATIONS string to specify which identities are affected and the
permissions that should be added or removed. The method uses this input to define or
modify ACT and ACE objects on the SAS Metadata Server. Any permission conditions
that you specify define or modify PermissionCondition objects.
The SetAuthorizationsOnObj method fails if the requesting user does not have
ReadMetadata and WriteMetadata permissions on the target resource.
SetAuthorizationsOnObj 203
Exceptions Thrown
The SAS Open Metadata Interface explicitly returns the following exceptions for the
SetAuthorizationsOnObj method:
• SECAD_INVALID_TC_HANDLE
• SECAD_INVALID_RESOURCE_SPEC
• SECAD_INVALID_ACTION
• SECAD_INVALID_IDENTITY_SPEC
• SECAD_IDENTITY_DOES_NOT_EXIST
• SECAD_INVALID_PERMISSION_SPEC
• SECAD_NOT_AUTHORIZED
Examples
The following code fragment shows how the SetAuthorizationsOnObj method is issued
in a Java environment:
public void setAuthorizationsOnObj(String transCtxt, String resource, int options,
String[][] auths ) throws Exception {
try
{
iSecurityAdmin.SetAuthorizationsOnObj(transCtxt,
resource,
options,
auths
);
}
catch (Exceptions e) {
System.out.println("SetAuthorizationsOnObj: Exceptions");
e.printStackTrace();
throw e;
}
}
try {
// Set the authorizations defined in ACTauths on the ACT identified by ACTspec.
// Note that tCtxt is null, because resource has a value.
iSecurityAdmin. setAuthorizationsOnObj("", ACTspec, ISecurityAdmin.SECAD_ACT_CONTENTS,
204 Chapter 9 • Security Administration (ISecurityAdmin Interface)
ACTauths);
}
catch (Exception e ){
throw e;
}
}
Related Methods
• “GetAuthorizationsOnObj” on page 190
• “CreateAccessControlTemplate” on page 179
205
Chapter 10
Server Control (IServer Interface)
regular operation of the SAS Metadata Server. The facility can perform scheduled and ad
hoc backups, restores, and optional roll-forward recoveries of the SAS Metadata Server
from the SAS Metadata Server journal.
The server backup facility always performs a full backup of the SAS Metadata Server. A
full backup includes all configuration files in the SASMeta/MetadataServer
directory and all SAS metadata repositories that are registered on the SAS Metadata
Server, regardless of their registered access modes.
Regular server backups are configured during the SAS Metadata Server installation by
the SAS Deployment Wizard. See the SAS Intelligence Platform: System Administration
Guide for information about the default backup schedule.
The facility supports automated restores from a backup with optional roll-forward
recovery to a specified point in time.
IServer methods implement the server-based facility and can be used to manage backup
and recovery.
• Options in the Refresh method are used to set and modify the default backup
configuration and backup schedule and to enable clients to execute ad hoc backups
and restores.
• XML elements in the Status method return requested information about the backup
configuration, backup schedule, backup history, and specific backups and restores.
• A <FORCE/> XML element in the Pause or Resume method enables administrators
to regain control of the server in the event that it does not respond during a recovery.
However, the recommended interface for managing backups and performing restores is
SAS Management Console. SAS Management Console provides a graphical user
interface for managing backups. For information about the SAS Management Console
interface, see “Backing Up and Recovering the SAS Metadata Server” on page 16.
For information about IServer backup and recovery options, see “Refresh” on page 211,
“Status” on page 222, “Pause” on page 208, and “Resume” on page 220.
Pause
Short Description
Temporarily limits the availability of the SAS Metadata Server.
Category
Server control methods
Syntax
rc=Pause(options);
Pause 209
options C in <CLUSTER/>
Specifies to execute the Pause request
on all SAS Metadata Servers in the
cluster. In a single SAS Metadata Server
configuration, this option is ignored.
<FORCE/>
Regains control of the SAS Metadata
Server in the unlikely event that it does
not respond during recovery processing.
<PAUSECOMMENT>
Enables administrators to set a free-
form text comment that is retrieved with
server status queries.
<SERVER STATE="value"/>
Specifies to change the availability of
the SAS Metadata Server to the
specified server state. Valid values are
ADMIN, READONLY, or OFFLINE. If
a STATE value is not specified or the
<SERVER> option is omitted from the
Pause request, the default value is
<SERVER STATE="OFFLINE"/>.
<SINGLE_SERVER/>
Specifies to execute the Pause request
on the connected SAS Metadata Server
only.
Details
A user must have administrative user status on the SAS Metadata Server to issue the
Pause method.
The Pause method is issued on a running SAS Metadata Server to temporarily change
the server to a more restrictive state. The method downgrades the availability of all
repositories on the server, unless a repository is registered with a more restrictive Access
value than the one specified. You cannot change the state of a specific repository with
Pause. To limit a metadata repository’s availability, use the UpdateMetadata method to
change the value in the repository’s Access attribute.
When the <SINGLE_SERVER/> element is specified, the method affects the SAS
Metadata Server on which it is executed. When the <CLUSTER/> element is specified,
the method affects all SAS Metadata Servers that are configured in the server cluster. A
user is encouraged to specify one of these elements. If neither element is specified, the
behavior is undefined. If <CLUSTER/> is specified but a server cluster is not
configured, then the method is executed locally.
210 Chapter 10 • Server Control (IServer Interface)
Note: Pausing and resuming an individual metadata server in a cluster can result in
undesirable behavior. The preferred method for making an individual metadata
server temporarily unavailable is to stop the server. For more information, see “Stop”
on page 237.
Six states are supported for a running SAS Metadata Server:
ONLINE
This is the normal state of a running SAS Metadata Server. It indicates the server is
available for reading and writing to all users.
ADMIN
The SAS Metadata Server is available for reading and writing, but only to users who
have administrative user status on the SAS Metadata Server.
READONLY
The SAS Metadata Server is available for reading only to all users.
ADMIN(READONLY)
The SAS Metadata Server is available for reading only to users who have
administrative user status on the SAS Metadata Server.
RECOVERY
The SAS Metadata Server is unavailable for reading and writing to all users, except
for the backup recovery process.
OFFLINE
The SAS Metadata Server is running but is temporarily unavailable to all users.
The ADMIN, READONLY, and OFFLINE states are set with the Pause method.
The ADMIN(READONLY) and RECOVERY states are set by internal server recovery
processes. In the unlikely event the metadata server fails to respond during the recovery
process, administrators can use the Pause method with the <FORCE/> option to regain
control of the server. When the server is in the RECOVERY state, Pause requests
without the <FORCE/> option are rejected. By default, <FORCE/> changes the server to
an OFFLINE state. The <FORCE/> option should be used with the <SERVER
STATE="ADMIN"/> option to enable administrators to examine the server before
making it available to users.
The ADMIN(READONLY) state is set by internal server recovery processes that fail if
the server was in a READONLY state when the recovery process was started. From this
state, administrators can troubleshoot the failure before making the server available to
users.
When the server has been changed to another state by the Pause method or by internal
server recovery processes, the Resume method must be used to return the server to an
ONLINE state. For more information, see “Resume” on page 220.
The <PAUSECOMMENT> element enables administrators to set a free-form text
comment with the Pause request. The comment is retrieved with server status queries.
The <PAUSECOMMENT> element is specified as follows:
<PauseComment>This is a test of the Pause method. </PauseComment>
The state of the SAS Metadata Server is obtained by issuing the Status method. For more
information, see “Status” on page 222.
Examples
The following example pauses all SAS Metadata Servers in the cluster to an OFFLINE
state:
<!-- Pause the current server to OFFLINE -->
options='<Cluster/>';
rc=serverObject.Pause(options);
OFFLINE is the default value when the Pause method is issued without the <SERVER
STATE="value"/> element.
The following example pauses all SAS Metadata Servers in the cluster to an ADMIN
state and includes a <PAUSECOMMENT> to explain why the cluster is unavailable:
<!-- Pause all servers in the cluster to ADMIN -->
options='<Server State="ADMIN"/><Cluster/><PauseComment>This is a test of the
Pause method. Client activity on the SAS Metadata Server cluster will be resumed
shortly.</PauseComment>';
rc=serverObject.Pause(options);
Refresh
Short Description
Changes certain SAS Metadata Server invocation and configuration options on a running
server. This method can also be used to quickly recover memory on the SAS Metadata
Server.
Category
Server control methods
Syntax
rc=Refresh(options);
options C in <alert-email-option(s)/>
Includes XML elements that enable you to
send test alert e-mails and temporarily
change the alert e-mail recipients and
configuration. For more information, see
“Alert E-Mail Options” on page 215.
<ARM system-option(s)/>
Invokes specified ARM logging system
options. For more information, see “ARM
Configuration Options” on page 216.
<Backup-option(s)/>
Set or modify the server backup
configuration and server backup schedule
for the server-based backup and recovery
facility, execute ad hoc backups, and
maintain the scheduler thread. For more
information, see “Backup Options” on
page 216.
<CLUSTER/>
Specifies to execute the Refresh request
on all SAS Metadata Servers in the
cluster. In a single SAS Metadata Server
configuration, this option is ignored.
<OMA JOURNALPATH="filename"/>
Specifies to stop writing journal entries to
the journal file in the current location and
resume writing journal entries in a new
journal file in the specified location. This
option is valid only when the metadata
server is configured with <OMA
JOURNALTYPE="SINGLE"/> in the
omaconfig.xml file. If the metadata server
is configured with any other journal type
value, this option returns an error.
Refresh 213
<RECOVER options/>
Restores the SAS Metadata Server from a
specified server backup and can perform a
roll-forward recovery from the metadata
server journal file. For more information,
see “Recover Option” on page 218.
<REPOSITORY Id="repository-identifier"/>
Specifies to close and reopen the specified
metadata repository to recover memory.
<RPOSMGR ACCESS="ONLINE"/>
Specifies to resume the SAS Repository
Manager to an ONLINE state. When the
SAS Repository Manager is resumed,
metadata repositories are returned to their
registered Access values.
<SERVER/>
Specifies to close and reopen all of the
metadata repositories that are managed by
the SAS Metadata Server to recover
memory.
<SINGLE_SERVER/>
Specifies to execute the Refresh request
on the connected SAS Metadata Server
only.
Details
General Operation
A user must have administrative user status on the SAS Metadata Server to issue the
Refresh method. The Refresh method accepts instruction from XML elements that are
specified in the OPTIONS= parameter.
At least one OPTIONS= XML element must be specified for the Refresh method to have
an effect. The method supports a memory recovery option, an alert e-mail testing option,
and four categories of optional configuration elements: alert e-mail system options,
ARM system options, a journal option, and server backup and recovery options. None of
the configuration elements affect memory size.
When the <SINGLE_SERVER/> element is specified with an XML element, the action
is performed on the SAS Metadata Server on which it is executed. When the
<CLUSTER/> element is specified with an XML element, the action is performed on all
SAS Metadata Servers that are configured in the server cluster.
A user is encouraged to specify either <CLUSTER/> or <SINGLE_SERVER/> with the
other XML elements. If neither element is specified, the behavior is undefined. If
<CLUSTER/> is specified but a server cluster is not configured, then the method is
executed locally.
The memory recovery options are the only XML elements with which a user might want
to specify the <SINGLE_SERVER/> element. For all other XML elements, the
<CLUSTER/> element is appropriate. The <CLUSTER/> element instructs the Refresh
214 Chapter 10 • Server Control (IServer Interface)
method to take the appropriate action for the element in the server cluster. Specifically,
when <CLUSTER/> is specified and the server is running in a clustered environment:
• ARM logging is invoked on the master SAS Metadata Server.
• The server backup facility backs up the master SAS Metadata Server.
• Backup configuration and scheduling information is stored centrally, where all SAS
Metadata Servers can access it.
• Alert e-mail settings are temporarily changed for all SAS Metadata Servers in the
cluster.
• Options that replace or restructure repository data sets, such as the <RECOVER
options/> option and the backup REORG option, are not honored unless the SAS
Metadata Server on which they are executed is running in stand-alone mode. A
server is running in stand-alone mode when it is started with the
STARTNOCLUSTER option. For more information about restore and recovery in a
server cluster, see SAS Language Interfaces to Metadata.
• The <OMA JOURNALPATH="filename"/> option is ignored.
The SAS Metadata Server must refresh repositories when there is no other activity on
the SAS Metadata Server, so it automatically delays other user requests until the Refresh
method completes. This might have a small effect on server performance.
REPOSID
Specifies the unique 8-character or two-part 17-character metadata identifier of a
metadata repository. Multiple repositories can be refreshed at once by stacking
<REPOSITORY/> elements in the OPTIONS parameter.
Note: The foundation repository should not be refreshed without also refreshing all
metadata repositories that depend on it.
REPOSMGR
Specifies the SAS Repository Manager.
ALL
Includes all metadata repositories, including the SAS Repository Manager. ALL is
the default value if <REPOSITORY/> is specified without the Id= attribute and has
the same effect as specifying the <SERVER/> element.
Refresh 215
option(s)/> to change the e-mail server’s configuration while the metadata server is
running and test again until the test succeeds.
The Refresh method changes the alert e-mail settings for the duration of the server
session. To permanently change alert e-mail recipients, you must modify the
omaconfig.xml file. To permanently change e-mail system options for the alert e-mail
server, you must modify the sasv9.cfg file. You must stop the metadata server to modify
these files.
To get the current values of the e-mail system options, use the Status method. For more
information, see “Status” on page 222. For more information about the metadata
server’s alert e-mail notification system, see the SAS Intelligence Platform: System
Administration Guide.
The ARMSUBSYS system option enables or disables ARM logging on the server.
Specify "(ARM_OMA)" to enable ARM logging. Specify "(ARM_NONE)" to
disable ARM logging. ARM logging is disabled by default.
The ARMLOC system option specifies a location for the log. ARMLOC should be
specified with ARMSUBSYS when you enable ARM logging. If ARM logging is
already enabled, specifying just ARMLOC="filename" writes the ARM log to a new
location. Absolute and relative pathnames are read as different locations. For more
information about ARM logging, see “Using the ARM_OMA Subsystem” in the SAS
Intelligence Platform: System Administration Guide.
Backup Options
The server backup XML elements include:
<BACKUP optional-attributes/>
Invokes an ad hoc server backup to the backup location indicated in the
MetadataServerBackupConfiguration.xml file. The backup is named with a datetime
stamp in a modified ISO-8601 format (server-local datetime value followed by the
GMT offset). The <BACKUP/> element supports two optional attributes:
COMMENT= "text"
Specifies a text string of an unlimited length to describe the reason for the ad hoc
backup. The text string is recorded in the backup history.
REORG="Y|N"
Specifies whether repository data sets should be rebuilt to remove unused disk
space. The default value is "N" (No). Use of this option in ad hoc backups is
discouraged because the REORG process pauses and resumes repositories, which
interrupts the regular operation of the metadata server.
Note: This option is ignored in a running clustered server configuration. To
execute REORG in a clustered server configuration, you must stop the cluster
and run the process on a server that is running in stand-alone mode.
<BACKUPCONFIGURATION parameters/>
Sets or modifies the value of a specified server backup parameter in the
MetadataServerBackupConfiguration.xml file. The parameters are:
Refresh 217
BACKUPLOCATION="directory"
Specifies backups will be stored in a directory of the specified name in the
SASMeta/MetadataServer directory of your SAS configuration. The default
backup directory is named Backups. If the specified directory does not exist, the
metadata server will create it for you. To create the directory in a location other
than SASMeta/MetadataServer or on a different drive, specify an absolute
pathname that is meaningful to the computer that hosts the SAS Metadata Server.
The server will create one directory for backups. If a pathname is specified, the
other directory levels must already exist.
RUNSCHEDULEDBACKUPS="Y|N"
Controls the scheduler thread. A value of "Y" activates scheduled backups; a
value of "N" turns them off.
DAYSTORETAINBACKUPS="number"
Specifies the number of days to keep backups before they are deleted from the
SAS Metadata Server host. The default value is "7". To never delete any backups,
specify "0" in this attribute. Specifying a value of 0 is not recommended because
it can cause disk space issues.
<SCHEDULE EVENT= "Backup" WEEKDAYn= "time-valueR"/>
Sets or modifies the server backup schedule. The server backup schedule is stored in
the MetadataServerBackupConfiguration.xml file.
EVENT= "Backup"
Specifies the event to schedule. "Backup" is the valid value.
WEEKDAYn= "time-value"
The server backup facility supports daily backups, specified on a weekly
schedule, where the attribute Weekday1="time-value" is Sunday and the attribute
Weekday7="time-value" is the following Saturday. Appropriately numbered
Weekdayn="time-value" attributes represent the other days of the week. Backup
times are specified using four-digit time values indicating hours and minutes
based on a 24-hour clock in server-local time; for example, 0100 is 1 a.m and
1300 is 1 p.m. To schedule a backup, specify the appropriate Weekdayn="time-
value" attribute with a time value. To schedule more than one backup in a day,
specify multiple time values and separate them with semicolons.
R
Is optional and requests a REORG operation. The REORG option rebuilds
repositories to remove unused disk space. It is a resource-intensive operation that
pauses the server, so it should be used sparingly. It is recommended that a
REORG be performed no more than once a week.
Note: The REORG option is ignored in a running clustered server configuration.
To execute a REORG in a clustered server configuration, you must stop the
cluster, and then run the process on a server that is running in stand-alone
mode.
<SCHEDULER/>
When server backups are configured, a scheduler thread runs continuously from the
time the SAS Metadata Server is started. It buffers the schedule in 48-hour
increments. Specifying the <SCHEDULER/> XML element with a <REBUILD/>
subelement forces the scheduler thread to rebuild its in-memory linked list of events.
Specifying <SCHEDULER/> with a <RESTART/> subelement causes the current
scheduler thread to stop and start a new thread.
218 Chapter 10 • Server Control (IServer Interface)
Recover Option
<RECOVER required-and-optional-parameters/>
Restores SAS metadata repositories using the backup specified in a
BACKUPNAME="name" or in a BACKUPPATH="pathname" attribute with the
options indicated in optional attributes. The specified backup is recovered to the
current metadata server directory. If the server path was different when the backup
was made, the repository pathnames in the backup are changed to relative pathnames
to enable the server to function in the new location.
BACKUPNAME or BACKUPATH is a required parameter.
BACKUPNAME="name"
Specifies the name of a backup to use to recover the server. The backup is
assumed to be located in the backup location indicated in the
MetadataServerBackupConfiguration.xml file. To use a backup from a different
location to recover the server, either use the BACKUPPATH attribute instead of
BACKUPNAME or specify the BACKUPLOCATION attribute with the
BACKUPNAME attribute.
BACKUPLOCATION="directory"
Specifies the name of the directory that contains the backup specified in
BACKUPNAME.
BACKUPPATH="pathname"
Specifies the full or relative pathname to a backup. Relative pathnames are
mapped to the SASMeta/MetadataServer directory.
Optional parameters include:
COMMENT="text"
Specifies a character string of unlimited length that contains an explanation for
the recovery. The text is recorded in the backup history.
PAUSECOMMENT="text"
Specifies a character string of unlimited length that is displayed as a recovery
notification to clients.
IGNOREVERIFY= "Y | N"
Specifies whether to perform a validation process to determine whether the
content of the backup matches the record of the backup in the
METADATASERVERBACKUPMANIFEST.xml file. The recovery is stopped if
it does not match. The value "N" instructs the server to perform the validation.
This is the recommended setting. The value "Y" instructs the metadata server to
perform the recovery and skip the validation.
CAUTION:
You should evaluate your backup very carefully before you set
IGNOREVERIFY="Y". If the backup is missing a critical component like the
repository manager (A0000001) or a repository, your server might not start
after recovery.
INCLUDEALLCONFIGFILES= "Y|N"
Specifies whether to replace all configuration files in the server directory with
the configuration files present in the directory when the backup was made.
CAUTION:
This option should not be set in a clustered environment. Configuration
files contains host-specific paths. In a clustered server configuration, a
backup might be restored on a different host than the one on which it was
made.
Refresh 219
CAUTION:
When INCLUDEALLCONFIGFILES="Y", all files in the server directory
will be deleted and replaced with the configuration files in the backup.
Any files added to the directory since the backup will be lost.
ROLL_FORWARD= "blank | _ALL_ | datetime"
Specifies whether the metadata server journal should be used to recover metadata
server transactions that were recorded beyond those recovered in the restored
image. It also specifies whether to recover all transactions or only transactions up
to a specified point from the journal. Omission of this parameter or specifying
the parameter with a blank value specifies not to recover transactions from the
journal.
Examples
The following example shows how ARM_OMA logging is enabled on the SAS
Metadata Server:
options='<ARM armbsubsys="(ARM_OMA)" armloc="myARM.log"/><CLUSTER/>';
rc=serverObject.Refresh(options);
The following example shows how ARM_OMA logging is disabled on the SAS
Metadata Server:
options='<ARM armbsubsys="(ARM_NONE)"/><CLUSTER/>';
rc=serverObject.Refresh(options);
The following example shows how to close and reopen all metadata repositories on one
SAS Metadata Server to recover memory.
options='<SERVER/><SINGLE_SERVER/>';
rc=serverObject.Refresh(options);
The following example shows how to close and reopen all metadata repositories on all
SAS Metadata Servers in the cluster to recover memory:
options='<SERVER/><CLUSTER/>';
rc=serverObject.Refresh(options);
The following example shows how to request an ad hoc backup in a clustered server
environment:
options='<Backup Comment="Ad hoc backup started by the backup.sas job."/><CLUSTER/>';
rc=serverObject.Refresh(options);
The following example shows how to modify the server backup schedule on the cluster:
options='<Schedule Event="Backup" Weekday1="0010;1700"
Weekday2="0010R;1700" Weekday3="0010;1500" Weekday4="0010;1500" Weekday5="0010;1700"
Weekday6="0010;1700" Weekday7="0010"/><CLUSTER/>'
rc=serverObject.Refresh(options);
220 Chapter 10 • Server Control (IServer Interface)
Resume
Short Description
Returns a paused SAS Metadata Server to an ONLINE state.
Category
Server control methods
Syntax
rc=Resume(options);
options C in <CLUSTER/>
Specifies to execute the Resume request on
all SAS Metadata Servers in the cluster. In a
single SAS Metadata Server configuration,
this option is ignored.
<FORCE/>
Regains control of the SAS Metadata Server
in the unlikely event that it does not respond
during recovery processing. <SERVER/>
must be specified with <FORCE/>.
<SERVER/>
Specifies to return the SAS Metadata Server
to an ONLINE state.
<SINGLE_SERVER/>
Specifies to execute the Resume request on
the connected SAS Metadata Server only.
Details
A user must have administrative user status on the SAS Metadata Server to issue the
Resume method.
The Resume method returns a SAS Metadata Server that has been paused to the
ONLINE state. The ONLINE state makes the server available to process user requests.
Individual metadata repositories are returned to the persisted access modes indicated in
their Access attributes.
Resume 221
When the <SINGLE_SERVER/> element is specified, the method affects the SAS
Metadata Server on which it is executed. When the <CLUSTER/> element is specified,
the method affects all SAS Metadata Servers that are configured in the server cluster.
A user is encouraged to specify one of these elements. If neither element is specified, the
behavior is undefined. If <CLUSTER/> is specified but a server cluster is not
configured, then the method is executed locally.
Note: Pausing and resuming an individual metadata server in a cluster can result in
undesirable behavior. The preferred method for making an individual metadata
server temporarily unavailable is to stop the server. For more information, see “Stop”
on page 237.
The Resume method cannot be used to change the availability of a metadata repository.
To return a specific metadata repository to an ONLINE state, use the UpdateMetadata
method to change the value in the repository’s Access attribute.
If the Resume method is issued without options, the method operates as if the
<SERVER/> element was specified. However, if you specify the <FORCE/> option, the
<SERVER/> element must be specified as well.
The <FORCE/> option regains control of the SAS Metadata Server in the unlikely event
that it fails to respond during the recovery process. A server unresponsive if it remains it
does not change from the RECOVERY state. For more information about the
RECOVERY state, see “Pause” on page 208.
Example
The following example shows how to execute the Resume method on the current SAS
Metadata Server only:
<!-- Resume one server to an ONLINE state -->
options='<SINGLE_SERVER/>';
rc=serverObject.Resume(options);
The following example shows how to execute the Resume method on all SAS Metadata
Servers in a cluster:
<!-- Resume all servers in the cluster to an ONLINE state -->
options='<CLUSTER/>';
rc=serverObject.Resume(options);
Status
Short Description
Polls the SAS Metadata Server for server availability and configuration information,
cluster information, backup information, and journaling and server usage statistics.
Category
Server control methods
Syntax
rc=Status(inmeta,outmeta,options);
rc N out Return code for the method. Indicates whether the SAS
Metadata Server ran the method call. RC=0 means that it
did, RC=1 means that it did not.
<OMA alert-email-option(s)/>
Return the current value of the specified alert e-mail
option. The SAS Metadata Server uses alert e-mail
omaconfig.xml options and e-mail system options to
send alert e-mails. For more information, see “Alert
E-Mail Options” on page 228.
<OMA journal-statistic(s)/>
Return the specified statistic about the SAS Metadata
Server journal file. See “Journal Statistics Elements”
on page 229 for information about the available
statistics.
<OMA server-process-statistic(s)/>
Return the value of the specified server process
statistic. For more information, see “Server Process
Statistics Elements” on page 231.
<omaconfig-option(s)/>
Return the current value of the specified <OMA> or
<RPOSMGR> configuration option whether it was
set in the omaconfig.xml configuration file at start-up
or whether it was modified after start-up with the
Refresh method. For more information, see
“Requesting omaconfig.xml Values” on page 232.
<Scheduler/>
Supports an attribute and an optional XML element to
check the status of the thread scheduler and alert
conditions. For more information, see “<Scheduler/>
XML Element” on page 234.
<server-backup-and-recovery-option(s)/>
Return information about the metadata server backup
facility. XML elements are available to get
information about the current backup or recovery
process, the last backup, the last recovery, the backup
configuration, the backup schedule, the backup
history, and the status of the backup scheduler thread.
For more information, see “Server Backup and
Recovery Options” on page 232.
<STATUS/>
Is the default option if the method is issued without
options. For more information, see “Default Status
Elements” on page 224.
outmeta string out Mirrors the content in the INMETA parameter with the
exception that return values are filled in.
224 Chapter 10 • Server Control (IServer Interface)
options C in <CLUSTER/>
in a clustered metadata server configuration, sends
the query in the INMETA parameter to the master
server. In a single server configuration, this parameter
is ignored. Use <CLUSTER/> when you want to list
information about all nodes in the cluster.
Note: This option is
available beginning
with the third
maintenance release
for SAS 9.4.
Details
<SERVERSTATE/>
Returns the SAS Metadata Server’s current state. Valid values are ONLINE,
ADMIN, ADMIN(READONLY), READONLY, RECOVERY, or OFFLINE. No
response means that the server is down.
<STATUS/>
This is the default option if the method is issued without options. This option returns
values for <MODELVERSION/>, <PLATFORMVERSION/>, <SERVERSTATE/>,
<PAUSECOMMENT/>, and <SERVERLOCALE/> in one request.
Note: The Status method reports the availability of the SAS Metadata Server to service
client requests. It cannot be used to check the state of a specific metadata repository.
If you need to know why a specific metadata repository is not available, check the
repository’s Access and State values in the SAS Management Console Metadata
Manager or issue a GetRepositories method that sets the OMI_ALL (1) flag. For
more information, see “GetRepositories” on page 110.
server. The Self attribute identifies the receiving server with a “Y” or “N”. The
Flags attribute indicates whether the node is a slave server or the master server.
By default, Status requests are processed by a slave server. To get meaningful
information for the CURRENT_NODES= and LIST= attributes, you must direct
<CLUSTER attribute/> requests to the master server. Beginning in the third
maintenance release of SAS 9.4, this can be done by specifying a <CLUSTER/>
XML element in the OPTIONS parameter of the Status method call. In previous
versions of SAS 9.4, you had to use the METADATA Procedure to direct requests to
a specific server. When METHOD=STATUS is used, PROC METADATA supports a
NOREDIRECT argument that executes the status request on the connected server.
For more information, see METADATA Procedure in the SAS Language Interfaces
to Metadata.
<CLUSTERSTATE/>
Returns information about the cluster’s availability. Valid return values are
STARTING, QUORUM, or LOSTQUORUM. STARTING means that the cluster is
waiting for more server nodes to come up and complete the quorum. QUORUM
means that a sufficient number of servers are operating for the cluster to remain in
service. LOSTQUORUM means that the cluster does not have enough server nodes
to remain in service.
<OMA MAXIMUM_CLUSTER_NODES=" "/>
Returns the maximum number of servers that are supported in the cluster as
configured in the omaconfig.xml file. Fewer servers are initially defined than are
supported. A customer can later add servers up to this number plus one (the
additional slot is for the master server). If you have a need to exceed this number,
contact SAS Technical Support.
Beginning in the third maintenance release for SAS 9.4, the SAS Metadata Server cluster
has a synchronization check feature. This feature is available through the SAS
Management Console Metadata Manager Analyze/Repair wizard and the sas-analyze-
metadata batch tool. When invoked, this feature compares salient statistics in the
metadata type containers of the specified repository on the master server to
corresponding statistics for the same repository on each of the slave nodes. When the
results do not match, an alert e-mail is sent to the administrator of the node that had the
inconsistency, and an alert condition is raised for that repository. The best action for the
administrator is to make sure the problem node is not critical to the quorum, and then
stop and restart the problem node. The Status method supports the following XML
element to return information about a synchronization check. The results of a
synchronization check are available until the queried node is restarted.
<SynchCheck><Results OptionalAttribute(s)=" "/></SynchCheck>
reports the results of the last synchronization check on the slave node that received
the Status query. By default, the query returns the Id value and Name value of all
repositories that were examined and a <Container/> XML element that specifies the
name of any metadata type container in which an error was found, as follows:
<SynchCheck>
<Results>
<Repository Id="A0000001" Name="REPOSMGR"/>
<Repository Id="A5DST1OY" Name="Foundation">
<Container Name="testleg" Status="ERROR" RecordCountDifference="-1"
HighIdDifference="Y"/>
</Repository>
</Results>
</SynchCheck>
Status 227
The results indicate that the container named TestLeg has one record less on the
queried node than on the master server.
The optional attributes are the following:
Detail="FULL"
specifies to return comprehensive information about the synchronization check.
The Status query returns <Container/> XML elements similar to the following
for every metadata type container in every repository that was examined.
This XML element shows the information that is returned for a container that has
a problem:
<Container Name="testleg" Status="ERROR" RecordCountDifference="-1"
HighIdDifference="Y" Sample="01Jan1960:00:00:00,06Jan2015:20:24:26"
Master="2,0,AS000001,AS000002,19Dec2014:23:02:40,19Dec2014:23:02:40,3469298726.99,"
Slave="1,0,AS000001,AS000001,19Dec2014:23:02:40,19Dec2014:23:02:40,1734649360.2,"/>
This XML element shows the information that is returned for a container that
passed the synchronization check:
<Container Name="testms" Status="OK" Sample="01Jan1960:00:00:00,06Jan2015:20:24:26"
Master="2,0,AR000001,AR000002,19Dec2014:23:02:40,19Dec2014:23:02:40,3469298726.95,"
Slave="2,0,AR000001,AR000002,19Dec2014:23:02:40,19Dec2014:23:02:40,3469298726.95,"/>
DOTERM
indicates that the SAS Metadata Server is accepting journal entries. However, the
process that applies the updated transactions to repositories on disk will be
terminated after the current transaction is processed. It is a good idea to check
journal messages in the server log when you receive this keyword.
FORCETERM
indicates that the SAS Metadata Server is accepting journal entries. However, the
process that applies the updated transactions to repositories on disk is in the
process of being forcefully terminated, perhaps in the middle of a transaction. It
is a good idea to check journal messages in the server log when you receive this
keyword.
TERMDONE
indicates that a DOTERM or FORCETERM was successfully processed. The
SAS Metadata Server continues to accept entries in the journal file. However, it
is not applying the updated transactions to repositories on disk. It is a good idea
to check journal messages in the server log when you receive this keyword.
WAIT_IDLE
indicates that the SAS Metadata Server is waiting to perform a request (such as
changing a repository’s properties) that cannot occur until all outstanding journal
entries have been applied to repositories on disk. When all pending transactions
have been applied, journaling is returned to an IDLE state.
CRASH_RECOVERY
indicates that the SAS Metadata Server is using journal entries to recover from a
server crash.
are integrated with the metadata server journal to support roll-forward recovery up to a
specified point in time since the restored backup image.
The SAS Metadata Server is installed with a default backup configuration and backup
schedule.
The SAS Metadata Server uses four system files to manage backup and recovery
processes. In a single SAS Metadata Server configuration, these files are stored in the
SASMeta/MetadataServer directory. In a clustered SAS Metadata Server
configuration, these files are stored in the shared backup location.
MetadataServerBackupConfiguration.xml
Contains the backup configuration and backup schedule.
MetadataServerBackupHistory.xml
Contains a history of backup and recovery activity.
MetadataServerBackupManifest.xml
Contains a record of the repositories and files copied in a backup. This file is created
for each backup in the backup’s directory and it can be used to validate the backup.
A copy of this file for the most recent backup is also kept in the server directory.
MetadataServerRecoveryManifest.xml
Contains a record of the repositories and files copied in a recovery. This file can be
used to validate the recovery. The facility overwrites the last file with the new file
each time a recovery is performed.
CAUTION:
These four system files should never be opened directly.
The Status method provides the following elements to get information about server
backups and about the contents of the files:
<BACKUP attribute(s)/>
queries the progress of an active server backup or server recovery operation. Valid
attributes are BYTESTOCOPY=" ", BYTESCOPIED=" ", and ISRUNNING=" ".
<BACKUPCONFIGURATION/>
Returns the active server backup configuration from the
MetadataServerBackupConfiguration.xml file.
<METADATASERVERBACKUPCONFIGURATION/>
Returns the active server backup configuration and the backup schedule from the
MetadataServerBackupConfiguration.xml file.
<METADATASERVERBACKUPHISTORY/>
Returns a history of the backup and recovery activity on the SAS Metadata Server
from the MetadataServerBackupHistory.xml file.
<METADATASERVERBACKUPMANIFEST optional-attribute/>
lists the metadata repositories, metadata server journal file, and configuration files
copied in the last backup from the MetadataServerBackupManifest.xml file. To get
the MetadataServerBackupManifest.xml file from an earlier backup, include an
optional BACKUPNAME="name" or BACKUPPATH="pathname" attribute in
<METADATASERVERBACKUPMANIFEST/>. BACKUPNAME="name" gets the
file for the backup of the specified name from the active backup location.
BACKUPPATH="pathname" gets the file for a backup that is stored in a location
other than the active backup location. Pathnames are considered to be relative to the
SASMeta/MetadataServer directory. To get a backup from another backup
location, specify an absolute pathname.
234 Chapter 10 • Server Control (IServer Interface)
<METADATASERVERRECOVERYMANIFEST/>
lists the metadata repositories, metadata server journal file, and configuration files
copied in the last recovery from the MetadataServerRecoveryManifest.xml file.
<SCHEDULE EVENT="Backup" WEEKDAYn=" "/>
Returns the backup times stored in the backup schedule for the specified days. The
facility has a weekly backup schedule that specifies backup times in
WeekDayn="timevalue" attributes, where n represents a day of the week. WeekDay1
is Sunday and WeekDay7 is Saturday. To get the backup schedule for a particular
day, specify the WeekDayn=" " attribute with an appropriate number. The facility
returns four-digit time values based on a 24-hour clock in the time zone in which the
server is running. If more than one backup is scheduled in a day, the time values are
separated by semicolons. An “R” appended to a time value indicates that a REORG
is scheduled to be performed with the backup.
To enable clients to retrieve specific records from the history and manifest files, the
XML elements requesting these files support limited XPATH search syntax specified in
an XPATH=" " attribute. Two syntax elements are supported: XPATH
[POSITION()=LAST()] and XPATH [@ATTRIBUTE='value']. The XPATH
[POSITION()=LAST()] syntax can be specified in a
<METADATASERVERBACKUPHISTORY/> request to get the last backup in the
MetadataServerBackupHistory.xml file.
<MetadataServerBackupHistory XPath="MetadataServerBackupManifest/Backups/
Backup[POSITION()=LAST()]" />
The XPATH [@ATTRIBUTE='value'] syntax can return information about specific files
in a backup or recovery. For example, the following request gets information about the
adminUsers.txt file from the MetadataServerBackupManifest.xml file:
<MetadataServerBackupManifest XPath="MetadataServerBackupManifest/Backups/
Backup/ConfigurationFiles/File[@Name='adminUsers.txt'" />
You must familiarize yourself with the structure of the history and manifest files to build
XPATH queries.
See “<Scheduler/> XML Element” on page 234 for information about how to check the
health of the server backup thread.
Examples
rc=serverObject.Status(inmeta,outmeta,options);
The Status method is issued without specifying options in the INMETA parameter to
show the default behavior of the method. The following is the output from the request:
<ModelVersion>15.01</ModelVersion>
<PlatformVersion>9.4.0.0</PlatformVersion>
<ServerState>ONLINE</ServerState>
<PauseComment/>
<ServerLocale>en_US</ServerLocale>
DoRequest Examples
The following examples are formatted for the INMETADATA parameter of the
DoRequest interface.
This is the same method call that was issued in the standard interface example.
<!-- Get default values returned by the Status method -->
<Status>
<Metadata/>
<Options/>
</Status>
This Status method call requests the value of the omaconfig.xml <OMA
JOURNALTYPE="SINGLE | ROLL_FORWARD | NONE"/> server configuration
option and journaling statistics:
<!-- Get journaling statistics-->
236 Chapter 10 • Server Control (IServer Interface)
<Status>
<Metadata>
<OMA JOURNALTYPE=""
JOURNALPATH=""
JOURNALSTATE=""
JOURNALQUEUELENGTH=""
JOURNALDATAAVAILABLE=""
JOURNALSPACEAVAILABLE=""
JOURNALENTRYCOUNTER=""/>
</Metadata>
<Options/>
</Status>
The following Status request gets the backup parameters and backup schedule that are
active on the SAS Metadata Server:
<!-- Get server backup configuration and schedule -->
<Status>
<Metadata>
<MetadataServerBackupConfiguration/>
</Metadata>
<Options/>
</Status>
The following Status request gets the backup schedule for Tuesday:
<!-- Get the Tuesday backup schedule -->
<Status>
<Metadata>
<Schedule Event="Backup" Weekday3=""/>
</Metadata>
<Options/>
</Status>
This Status method call gets information about how long the metadata server has been
running:
<!-- Get server process statistics -->
<Status>
<Metadata>
<OMA Server_Started=""/>
<OMA Server_Uptime=""/>
</Metadata>
</Status>
The following Status method call gets detailed information about the last
synchronization check that was performed on the connected server node. It queries the
node to see whether any alert conditions have been recorded and whether a termination
time has been scheduled for the node:
<Status>
<Metadata>
<SynchCheck>
<Results Detail="FULL"/>
</SynchCheck>
<Scheduler Ping=" ">
<AlertConditions/>
</Scheduler>
</Metadata>
</Status>
Stop 237
Related Methods
• “GetInternalLoginSitePolicies” on page 153
Stop
Short Description
Shuts down the SAS Metadata Server.
Category
Server control methods
Syntax
rc=Stop(options);
options C in <CLUSTER/>
Specifies to execute the Stop request on all SAS
Metadata Servers in the cluster. In a single SAS
Metadata Server configuration, this option is
ignored.
<SINGLE_SERVER/>
Specifies to execute the Stop request on the
connected SAS Metadata Server only.
Details
A user must have administrative user status on the SAS Metadata Server to issue the
Stop method.
When the <SINGLE_SERVER/> element is specified, the method affects the SAS
Metadata Server on which it is executed. When the <CLUSTER/> element is specified,
the method affects all SAS Metadata Servers that are configured in the server cluster.
A user is encouraged to specify one of these elements. If neither element is specified, the
behavior is undefined. If <CLUSTER/> is specified but a server cluster is not
configured, then the method is executed locally.
The Stop method is the recommended way to make an individual metadata server in a
cluster temporarily available. If the metadata server needs maintenance, it can be
restarted in stand-alone mode with the -STARTNOCLUSTER option, and then returned
to the cluster after maintenance is performed. For more information about maintaining
238 Chapter 10 • Server Control (IServer Interface)
metadata servers in a cluster, see the SAS Intelligence Platform: System Administration
Guide.
A return code of 0 indicates that the SAS Metadata Server was successfully stopped. A
return code other than 0 indicates that the SAS Metadata Server failed to stop.
The Stop method is available only in the standard interface.
Examples
The following example shows how to stop the connected SAS Metadata Server:
<!-- Stops the current metadata server -->
options='<SINGLE_SERVER/>'
rc=serverObject.Stop(options);
The following example shows how to stop all SAS Metadata Servers in the cluster:
<!-- Stop all servers in the cluster-->
options='<CLUSTER/>'
rc=serverObject.Stop(options);
Part 4
Chapter 11
Adding Metadata Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
Chapter 12
Updating Metadata Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
Chapter 13
Overview of Querying Metadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
Chapter 14
Getting the Properties of a Specified Metadata Object . . . . . . . . . . . 279
Chapter 15
Using Templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
Chapter 16
Getting All Metadata of a Specified Metadata Type . . . . . . . . . . . . . . . 317
Chapter 17
Filtering a GetMetadataObjects Request . . . . . . . . . . . . . . . . . . . . . . . . . 333
Chapter 18
Metadata Locking Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353
Chapter 19
Deleting Metadata Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355
240
241
Chapter 11
Adding Metadata Objects
Most resources and information assets that are managed in a SAS Metadata Repository
are described by a set of associated SAS Metadata Model metadata types, rather than by
just one metadata type. This set of associated metadata types is referred to as a logical
metadata definition.
SAS uses an object type dictionary, called the SAS type dictionary, to ensure consistency
among the logical metadata definitions that represent common and shared objects in
SAS applications. The SAS type dictionary is described in Chapter 3, “Using Interfaces
That Read and Write Metadata in SAS 9.4,” on page 19.
A logical metadata definition that you create with AddMetadata is considered a custom
definition. It might not conform to the SAS type dictionary. To create object definitions
that conform to the dictionary, SAS recommends that you use SAS wizards and
procedures to create metadata instead.
The information in this chapter is provided as background information about the internal
processes that create metadata and for customers who want to create metadata that is not
managed by the SAS type dictionary.
<Metadata>metadata_property_string</Metadata>
<Reposid>repository_identifier</Reposid>
<Ns>namespace</Ns>
<Flags>268435456</Flags>
<Options/>
</AddMetadata>
To create a metadata object describing an application element, you specify the following
information:
• a metadata property string that defines a SAS Metadata Model metadata object in the
<METADATA> element. The property string defines attribute values for the object
and associations between this object and important related objects.
• a metadata repository identifier in the <REPOSID> element
Using the AddMetadata Method 243
The AddMetadata method creates a new object for every property string that is
submitted in the <METADATA> element, unless the ObjRef attribute is included in the
property string. ObjRef is supported only in a nested property string. It specifies that the
object instance is an existing metadata object. It instructs the SAS Metadata Server to
create an object reference to the specified object without modifying the specified object's
other properties.
The SAS Metadata Server creates a new associated object in all of the following cases:
• When you omit the Id attribute from the metadata property string.
• When you specify the Id attribute with a null value (Id=" ").
• When you specify a symbolic name in the Id attribute (Id="$Table").
• When you specify a real value in the Id attribute (Id="A1000001").
244 Chapter 11 • Adding Metadata Objects
Symbolic Names
A symbolic name is an alias that is preceded by a dollar sign ($). You assign a symbolic
name to a metadata object to reference it before it is created. Symbolic names are used to
create associations and new associated objects in other repositories. They also enable
you to create references between multiple, unrelated metadata objects in a single XML
request. For more information about this type of usage, see “Example of an
AddMetadata Request That Creates Multiple, Unrelated Metadata Objects” on page
251.
When used to create an association and a new associated object in another repository, the
symbolic name has the form Reposid.$Alias. It is specified in the Id attribute of the XML
subelement that defines the associated object.
When used to create multiple, unrelated metadata objects in the same repository, the
simple form $Alias is used.
Alias can be any name, as long as it is preceded by a dollar sign ($). After the successful
completion of AddMetadata or UpdateMetadata processing, the alias and any references
to it are automatically replaced with a real object identifier.
Note the use of the ObjRef attribute and the fact that no other attributes are specified.
When ObjRef is used, the SAS Metadata Server ignores any additional attributes that
might be specified. The object identifier in the ObjRef attribute includes both the
repository identifier and the object instance identifier of the target object.
The following is an example of a metadata property string that creates a SAS Metadata
Model object, an association, and a new associated SAS Metadata Model object in
another repository:
<MetadataType Name="Name-of-primary-object" Desc="New object created using AddMetadata">
<AssociationName>
<AssociatedMetadataType Id="Reposid.$SymbolicName" Name="Name-of-associated-object"
Desc="Associated object that is created by AddMetadata"/>
</AssociationName>
</MetadataType>
The portion of the property string that identifies the associated object specifies the Id
attribute with the repository identifier and a symbolic name for the new object. (You can
determine the available repositories and their unique identifiers by issuing the
GetRepositories method. For more information, see “Using GetRepositories to List the
Registered Repositories” on page 275.) Because a new object is created, you must
specify at least a Name value for the associated object and you should include values for
other attributes.
</MetadataType2>
</Metadata>
The output string mirrors the input string, with the exception that a two-part object
instance identifier is assigned to the new object in the form:
Reposid.Objectid
Reposid is the unique repository identifier. Objectid is the unique object instance
identifier. You will use this unique object identifier any time you need to reference the
metadata object. In “Example of an AddMetadata Request That Creates an Object and an
Association to an Existing Object” on page 248, this identifier is used to create an
association to the object.
248 Chapter 11 • Adding Metadata Objects
In this method call, the <REPOSID>, <NS>, and <FLAGS> elements contain the same
values as in “Example of an AddMetadata Request That Creates a SAS Metadata Model
Object” on page 247. In the <METADATA> property string, note the following:
• <RESPONSIBLEPARTY> is the metadata type. Name, Desc, and Role are attributes
of the ResponsibleParty metadata type. Name and Role are required attributes.
• <OBJECTS> is the association name and is specified as a subelement of
<RESPONSIBLEPARTY>.
• <SASLIBRARY> is the metadata type of the associated metadata object and is
specified as a subelement of <OBJECTS>. The ObjRef attribute in the
<SASLIBRARY> subelement informs the SAS Metadata Server that the SASLibrary
object is an existing object. The server creates the association without modifying any
of the object's other properties.
Here is an example of the output returned by the SAS Metadata Server:
<!-- Using the ADDMETADATA method. -->
The output string mirrors the input string with the exception that a two-part metadata
object identifier is assigned to the ResponsibleParty object.
Example of an AddMetadata Request That Creates Multiple, Related Metadata Objects
249
SASFormat="$Char32."
SASInformat="$32."
PublicType="Column"/>
<Column
Name="Employees"
Desc="Number of employees"
ColumnName="Employees"
SASColumnName="Employees"
ColumnType="6"
SASColumnType="N"
ColumnLength="3"
SASColumnLength="3"
SASFormat="3.2"
SASInformat="3.2"
PublicType="Column"/>
</Columns>
</PhysicalTable>
</Metadata>
<Reposid>A0000001.A53TPPVI</Reposid>
<NS>SAS</NS>
<Flags>268435456</Flags>
<Options/>
</AddMetadata>
In the request, the <REPOSID>, <NS>, and <FLAGS> elements contain the same values
as in “Example of an AddMetadata Request That Creates a SAS Metadata Model
Object” on page 247. In the <METADATA> property string, note the following:
• <PHYSICALTABLE> is the metadata type. Name, Desc, and PublicType are
attributes of the PhysicalTable metadata type.
• <TABLEPACKAGES> is the association name that creates the association to the
SASLibrary object. The ObjRef attribute in the <SASLIBRARY> subelement
informs the SAS Metadata Server that the association is being created to an existing
object.
• <COLUMNS> is the association name that creates the associations to the Column
objects. The column definitions are nested under the Columns association name.
• Four Column objects are created. For each object, consider the following:
• Name is a required attribute.
• The ColumnName, ColumnType, and ColumnLength attributes describe the
names and values of the items in a DBMS.
• The SASColumnName, SASColumnType, and SASColumnLength attributes
indicate their corresponding values in a SAS table.
• A ColumnType value of 12 indicates VARCHAR. A ColumnType value of 6
indicates FLOAT.
For more information about the properties for the PhysicalTable and Column
metadata types, see the SAS Metadata Model documentation.
Here is an example of the output returned by the SAS Metadata Server:
<!-- Using the ADDMETADATA method. -->
The output string mirrors the input string, with the exception that a two-part metadata
object identifier is assigned to each new metadata object.
<Column
Name="Name"
Desc="Name of employee"
ColumnName="Employee_Name"
SASColumnName="Employee"
ColumnType="12"
SASColumnType="C"
ColumnLength="32"
SASColumnLength="32"
SASFormat="$Char32."
SASInformat="$32."
PublicType="Column" >
<Table>
<PhysicalTable ObjRef="$Employees"/>
</Table>
</Column>
<Column
Name="Address"
Desc="Home Address"
ColumnName="Employee_Address"
SASColumnName="Home_Address"
ColumnType="12"
SASColumnType="C"
ColumnLength="32"
SASColumnLength="32"
SASFormat="$Char32."
SASInformat="$32."
PublicType="Column">
<Table>
<PhysicalTable ObjRef="$Employees"/>
</Table>
</Column>
<Column
Name="Title"
Desc="Job grade"
ColumnName="Title"
SASColumnName="Title"
ColumnType="12"
SASColumnType="C"
ColumnLength="32"
SASColumnLength="32"
SASFormat="$Char32."
SASInformat="$32."
PublicType="Column">
<Table>
<PhysicalTable ObjRef="$Employees"/>
</Table>
</Column>
Example of an AddMetadata Request That Creates Multiple, Unrelated Metadata Objects
253
</Metadata>
<Reposid>A0000001.A53TPPVI</Reposid>
<NS>SAS</NS>
<Flags>268435456</Flags>
<Options/>
</AddMetadata>
In this method call, the <REPOSID>, <NS>, and <FLAGS> elements contain the same
values as in “Example of an AddMetadata Request That Creates a SAS Metadata Model
Object” on page 247. In the <METADATA> element, note the following:
• There are multiple metadata property strings, stacked one on top of the other.
• The metadata property string defining the PhysicalTable object is the topmost string.
This property string includes an Id attribute that assigns the symbolic name
$Employees. Name and PublicType are required attributes.
• Separate metadata property strings define each Column object. Each string defines
the unique attributes of the column and the global Name and PublicType attributes.
• Each Column definition defines a Table association to the PhysicalTable object by
specifying the ObjRef attribute and referencing the symbolic name $Employees.
Here is an example of the output returned by the SAS Metadata Server:
<!-- Using the ADDMETADATA method. -->
The symbolic name is replaced with the PhysicalTable object's unique object identifier in
the output everywhere that it was used.
254 Chapter 11 • Adding Metadata Objects
Chapter 12
Updating Metadata Objects
The <METADATA> parameter identifies the metadata type, object instance, association
name, and associated object affected. In this metadata property string, note the
following:
• The association name subelement specifies a Function attribute and a directive. The
Function attribute specifies how the SAS Metadata Server should process the
associated object definition.
• The associated object subelement supports a choice of associated object identifiers.
The associated object identifier that you choose to specify indicates whether a new
association will be made to an existing object, whether a new association and a new
associated object will be created, or whether an existing associated object will be
modified.
extension2
extension3
extension4
APPEND never modifies existing associations. Any new associations are added to the
end of the existing association list. Any associations that you attempt to modify are
treated as new and listed as truly new associations. Extension1 was copied, assigned a
new Id value, and added to the end of the list as extension6.
If we were to issue the same UpdateMetadata method call, except with
Function=“MERGE,” the directive would change the association list as follows:
extension2
extension3
extension4
extension5
extension1
Like APPEND, MERGE adds new associations to the end of the existing association list.
Unlike APPEND, however, it modifies and moves specified existing associations instead
of just copying them. Extension1 is moved to the end of the association list.
Function="MODIFY" would have no effect in this UpdateMetadata method call.
MODIFY is not supported for multiple associations.
If we were to issue the same UpdateMetadata method call, except with
Function=“REPLACE,” the directive would cause the following changes to the
association list:
extension5
extension1
The existing association list is deleted and replaced with a new list that lists new
associations first, and any existing associations in the order that is specified. The old
extension1 is replaced with the modified extension1.
If we were to issue the same UpdateMetadata method call with Function=“REMOVE,”
the directive would cause the following changes to the association list:
extension2
extension3
extension4
The extension1 association is removed from the association list. The UpdateMetadata
method returns an error message regarding extension5, because it was not in the list.
• To add new associations and modify the properties of the existing associated objects,
specify Function="MERGE".
• To delete an existing association or association list with a new association or
association list, specify Function="REPLACE".
• To remove an association without modifying any of the other associations in an
existing association list, specify Function="REMOVE".
• To modify the properties of the associated object in a single association, specify
Function="MODIFY".
Usage Examples
The following is an example of an association name and an associated object definition
that adds an association to an existing object in the same repository:
<AssociationName Function="Directive">
<AssociatedMetadataType ObjRef="Objectid"/>
</AssociationName>
Note the use of the ObjRef attribute and an object identifier in the associated object
definition. If you specify additional attributes, the method ignores them.
The following is an example of an association name and an associated object definition
that adds an association and a new object in the same repository:
<AssociationName Function="Directive">
<AssociatedMetadataType Id="" Name="Name"/>
</AssociationName>
Using the UpdateMetadata Method 263
Note the use of the Id attribute with a null value in the associated object definition.
Another way to create the associated object is to omit an object identifier from the
associated object definition.
The following is an example of an association name and an associated object definition
that modifies an existing associated object in the same repository:
<AssociationName Function="Directive">
<AssociatedMetadataType Id="Objectid" Name="Name"
Desc="This is a new description for this associated object."/>
</AssociationName>
Note the use of the Id attribute with a real object identifier in the associated object
definition.
To create an association to an existing object in another repository using the
UpdateMetadata method, specify the ObjRef attribute and include the object’s repository
identifier in the object instance identifier of the associated object definition. For
example:
<AssociationName Function="Directive">
<AssociatedMetadataType ObjRef="Reposid.Objectid"/>
</AssociationName>
To create an association and a new object in another repository, specify the Id attribute, a
repository identifier, and a symbolic name in the object instance identifier of the
associated object definition. For example:
<AssociationName Function="Directive">
<AssociatedMetadataType Id="Reposid.$SymbolicName" Name="Name"/>
</AssociationName>
Deleting Associations
To delete an association, specify the REPLACE or REMOVE directives in the Function
attribute of the association name element.
• The REPLACE directive replaces any existing associations with the specified
associated object definition or list of associated object definitions. Use this directive
with caution to prevent accidentally overwriting associations that you want to keep.
• The REMOVE directive removes the specified associated object definition from the
list of associations maintained for that association name without affecting other
associations.
Deleting an association does not delete the associated object, unless the associated object
is a dependent object. If you want to delete an object’s associated objects and its
associations, you must delete each associated object individually using the
DeleteMetadata method. For more information, see Chapter 19, “Deleting Metadata
Objects,” on page 355.
The UpdateMetadata method does not print dependent objects that it might have deleted
in its output by default. To include the dependent objects deleted by an Update operation
in the output, set the OMI_RETURN_LIST (1024) flag in the UpdateMetadata method
call.
For an example of deleting an association, see “Example of an UpdateMetadata Request
That Deletes an Association” on page 268.
264 Chapter 12 • Updating Metadata Objects
</UpdateMetadata>
</ForeignKey>
</ForeignKeys>
</UniqueKey>
</UniqueKeys>
</PhysicalTable>
</Metadata>
<NS>SAS</NS>
<!-- OMI_TRUSTED_CLIENT Flag -->
<Flags>268435456</Flags>
<Options/>
</UpdateMetadata>
<PhysicalTable Id="A53TPPVI.A4000002">
<UniqueKeys>
<UniqueKey Id="A53TPPVI.A8000001" Name="Sales
Associates in NW Region">
<KeyedColumns>
<Column ObjRef="A53TPPVI.A5000005"/>
</KeyedColumns>
<ForeignKeys>
<ForeignKey Id="A53TPPVI.A9000001" Name="Link to Sales
Associates table">
<Table>
<PhysicalTable ObjRef="A53TPPVI.A4000001"/>
</Table>
<KeyedColumns>
<Column ObjRef="A53TPPVI.A5000004"/>
</KeyedColumns>
<PartnerUniqueKey>
<UniqueKey ObjRef="A53TPPVI.A8000001"/>
</PartnerUniqueKey>
</ForeignKey>
</ForeignKeys>
<Table>
<PhysicalTable ObjRef="A53TPPVI.A4000002"/>
Example of an UpdateMetadata Request That Merges Associations 267
</Table>
</UniqueKey>
</UniqueKeys>
</PhysicalTable>
The request created seven associations and two new objects (UniqueKey and
ForeignKey).
The following example updates the UniqueKey object created in the previous request. It
modifies the Name attribute of the key column and adds an association to a second key
column.
<UpdateMetadata>
<Metadata>
<UniqueKey Id="A53TPPVI.A8000001">
<KeyedColumns>
<Column Id="A53TPPVI.A5000005"
Name="EmployeeName"/>
<Column ObjRef="A53TPPVI.A5000006"/>
</KeyedColumns>
</UniqueKey>
</Metadata>
<NS>SAS</NS>
<!-- OMI_TRUSTED_CLIENT Flag -->
<Flags>268435456</Flags>
<Options/>
</UpdateMetadata>
Two Column objects are returned. Column A53TPPVI.A5000005’s Name attribute was
changed from Name to EmployeeName.
268 Chapter 12 • Updating Metadata Objects
The Function="REMOVE" directive instructs the SAS Metadata Server to remove the
specified association from the UniqueKey object’s KeyedColumns association list. If
Function="REPLACE" had been specified, the existing KeyedColumns association list
would have been replaced with the specified association.
Here are the results of a GetMetadata call that gets a revised KeyedColumns associations
list:
<!-- Using the GETMETADATA method. -->
For more information about the use of REMOVE versus REPLACE, see “Deleting
Associations” on page 263.
</Columns>
</PhysicalTable>
</Metadata>
<NS>SAS</NS>
<!-- OMI_TRUSTED_CLIENT Flag -->
<Flags>268435456</Flags>
<Options/>
</UpdateMetadata>
In the example, the null Id value in the associated object definition indicates the
associated object is to be created. Here is an example of the output returned by the SAS
Metadata Server:
<!-- Using the UPDATEMETADATA method. -->
<PhysicalTable Id="A53TPPVI.A4000002">
<Columns Function="Append">
<Column Id="A53TPPVI.A500002U" Name="Salary">
<Table>
<PhysicalTable ObjRef="A53TPPVI.A4000002"/>
</Table>
</Column>
</Columns>
</PhysicalTable>
The association to the new Column object is added to the existing association list
without affecting other associated objects. Here are the results of a GetMetadata request
that lists the Column objects associated with PhysicalTable A53TPPVI.A4000002:
<!-- Using the GETMETADATA method. -->
Chapter 13
Overview of Querying Metadata
Supported Queries
Overview
The SAS Open Metadata Interface provides methods to get information about the SAS
Metadata Server's availability and configuration, namespaces, metadata repositories, and
metadata objects.
Querying Namespaces
A namespace refers to the set of metadata types that can be accessed by the SAS
Metadata Server. The SAS Open Metadata Interface defines two namespaces:
• The REPOS namespace contains metadata types that describe metadata repositories.
• The SAS namespace contains all metadata types that describe application elements.
SAS provides the GetNamespaces method to enable you to get the namespaces
programmatically. For more information, see “GetNamespaces” on page 108. The
GetTypes method gets all of the metadata types in a namespace. For more information,
see “GetTypes” on page 119. The GetTypeProperties method gets all possible properties
for a specified metadata type. For more information, see “GetTypeProperties” on page
117.
The SAS Metadata Model is a hierarchical model. The GetSubtypes method gets
subtypes of a specified metadata type. For more information, see “GetSubtypes” on page
115. The IsSubtypeOf method determines whether on metadata type is a subtype of
another metadata type.For more information, see “IsSubtypeOf” on page 123. All of
these methods are referred to as management methods because they enable you to get
information about the metadata environment. This information provides useful
background information when preparing to create metadata objects.
See also:“Using GetTypes to Get the Metadata Types in a Namespace” on page 273.
Querying Repositories
When a repository is created, it is registered in a SAS Repository Manager. The SAS
Repository Manager is itself a repository, which maintains information that enables the
SAS Metadata Server to access the repositories, metadata programmers to create
metadata in the repositories, and administrators to administer the availability of the
repositories.
You can determine the repositories that have been registered in a SAS Repository
Manager by using the GetRepositories method. For more information, see
“GetRepositories” on page 110. The GetRepositories method lists the Id, Name, Desc,
and DefaultNS attributes of the repositories registered in the SAS Repository Manager.
A repository identifier is required to add metadata to a repository. For usage information,
see “Using GetRepositories to List the Registered Repositories” on page 275.
The SAS Repository Manager also stores Path, RepositoryType, RepositoryFormat,
Access, PauseState, and CurrentAccess attributes for a repository. To get the values of
these attributes, you can issue the GetRepositories method with the OMI_ALL (1) flag
set. For usage information, see “Using GetRepositories to Get All Repository Attributes”
on page 275.
A repository is described by a metadata type just like any other metadata object. To get
values for global attributes that are stored for all metadata types, you can use the same
methods that you use to read application objects. For more information, see “Querying
Using GetTypes to Get the Metadata Types in a Namespace 273
Metadata Objects” below. Issue the GetMetadata and GetMetadataObjects method calls
on the REPOS namespace and specify the RepositoryBase metadata type. For more
information, see “Using GetMetadata to Get Only a Repository's Regular Attributes” on
page 277.
The <NS>, <FLAGS>, and <OPTIONS> elements are input parameters. This example
does not specify any flags or options. The <TYPES> element is an output parameter.
The <TYPES> element lists the metadata types in the specified namespace.
To get all of the metadata types in the SAS Metadata Model, issue the GetTypes method
on both the SAS and REPOS namespaces.
274 Chapter 13 • Overview of Querying Metadata
The following is an example of the method output. Only the first line of the output is
shown:
<Type Id="AbstractExtension" Desc="Abstract Extension"
HasSubtypes="1"/>
The <NS>, <FLAGS>, <OPTIONS>, and <REPOSID> elements are input parameters.
• The <NS> element specifies the namespace.
• The <FLAGS> element sets the OMI_SUCCINCT flag (2048).
• The <OPTIONS> element passes the <REPOSID> element to the SAS Metadata
Server.
• The <REPOSID> element specifies the target repository identifier.
The <TYPES> element is an output parameter. Here is an example of the output returned
by the SAS Metadata Server:
<!-- Using the GETTYPES method. -->
<Types>
<Type Id="Column" Desc="Columns" HasSubtypes="0"/>
<Type Id="PhysicalTable" Desc="Physical Table" HasSubtypes="1"/>
<Type Id="ResponsibleParty" Desc="Responsible Party" HasSubtypes="0"/>
<Type Id="SASLibrary" Desc="SAS Library" HasSubtypes="0"/>
Using GetRepositories to Get All Repository Attributes 275
</Types>
The repository contains metadata objects of four metadata types: Column, PhysicalTable,
ResponsibleParty, and SASLibrary.
• Id specifies the metadata type.
• Desc returns a system-supplied description of the metadata type.
• When OMI_SUCCINCT is set, the HasSubtypes attribute has no meaning.
To list the actual metadata objects of each metadata type, you must use the
GetMetadataObjects method. For more information, see “GetMetadataObjects” on page
105.
The request gets the Id, Name, Desc and DefaultNS attributes of all repositories
registered on the SAS Metadata Server. Here is an example of the output returned by the
SAS Metadata Server, formatted for readability:
<GetRepositories>
<Repositories>
<Repository Id="A0000001.A529QDG2" Name="Foundation" Desc="" DefaultNS="SAS"/>
<Repository Id="A0000001.A5M41IFE" Name="BILineage" Desc="BILineage" DefaultNS="SAS"/>
</Repositories>
<Flags>0</Flags>
<Options/>
</GetRepositories>
The current SAS Repository Manager has two repositories registered in it: Foundation
and BILineage.
Here is an example of the output returned by the SAS Metadata Server, formatted for
readability:
<GetRepositories>
<Repositories>
<Repository Id="A0000001.A0000001" Name="REPOSMGR" Desc="The Repository Manager"
DefaultNS="REPOS" RepositoryType="" RepositoryFormat="15" Access="OMS_FULL"
CurrentAccess="OMS_FULL" PauseState="" Path="rposmgr" Engine="" Options=""
MetadataCreated="01Jan1960:00:00:00" MetadataUpdated="01Jan1960:00:00:00"/>
<Repository Id="A0000001.A529QDG2" Name="Foundation" Desc="" DefaultNS="SAS"
RepositoryType="FOUNDATION" RepositoryFormat="15" Access="OMS_FULL"
CurrentAccess="OMS_FULL" PauseState="" Path="MetadataRepositories/Foundation"
Engine="BASE Options="" MetadataCreated="26Jul2012:20:12:12"
MetadataUpdated="26Jul2012:20:12:12"/>
<Repository Id="A0000001.A5M41IFE" Name="BILineage" Desc="BILineage" DefaultNS="SAS"
RepositoryType="CUSTOM" RepositoryFormat="15" Access="OMS_FULL"
CurrentAccess="OMS_FULL" PauseState="" Path="MetadataRepositories/BILineage"
Engine="BASE" Options="" MetadataCreated="27Jul2012:00:05:28"
MetadataUpdated="27Jul2012:00:05:28"/>
</Repositories>
<Flags>1</Flags>
<Options/>
</GetRepositories>
Chapter 14
Getting the Properties of a
Specified Metadata Object
Overview
To get the attributes and associations for a metadata object, the SAS Open Metadata
Interface provides the GetMetadata method. The default behavior of the GetMetadata
method is to get the specified metadata object with whatever attributes and associations
are specified in the INMETADATA parameter.
The GetMetadata method also supports flags. Flags are provided that:
• get all of the attributes and associations that are documented for the specified
metadata type.
280 Chapter 14 • Getting the Properties of a Specified Metadata Object
• get all of the attributes of the specified metadata object and any associated objects
that are returned by the GetMetadata request.
• get specified attributes and associations for subtypes of the specified object.
• get the logical metadata definition for the specified metadata object as defined in the
SAS type dictionary. The specified object must be a PublicType subtype, and it must
store the name of a type definition in the PublicType attribute.
• enable you to submit templates which specify attributes and associations to get for
associated objects.
The SAS Metadata Server returns values for the requested attributes of the specified
Column object, and general, identifying information (Id, Name, and Desc) about the
associated PhysicalTable object. See the model documentation for a description of the
attribute values.
To get additional properties for the specified Column object and its associated objects,
the GetMetadata method supports the following flags:
282 Chapter 14 • Getting the Properties of a Specified Metadata Object
• OMI_ALL_SIMPLE (8)—Gets all of the XML attributes of the specified object and
of any associated objects that are returned. For more information, see “Expanding a
GetMetadata Request to Get All Attributes” on page 282.
• OMI_ALL (1)—Gets all of the attributes and associations that are documented for
the specified metadata type in the SAS Metadata Model. For any associated objects
that are found, it returns general, identifying information. For more information, see
“Expanding a GetMetadata Request to Get All Attributes and Associations” on page
283.
• OMI_SUCCINCT (2048)—Omits attributes that do not contain a value or that
contain a null value from the returned XML string.
• OMI_TEMPLATE (4)—Instructs the SAS Metadata Server to check the OPTIONS
parameter for one or more user-defined templates that specify additional attributes or
associations to return. The templates can request additional attributes and
associations for the primary metadata type in the INMETADATA parameter.
Templates can also be used to return attributes and associations for associated objects
in the INMETADATA parameter or in another template. Templates are specified in a
<TEMPLATES> element. For more information, see “Getting Attributes and
Associations of Associated Objects” on page 285 and Chapter 15, “Using
Templates,” on page 301.
• OMI_FULL_OBJECT (2)—Specifies to expand the associations for the specified
object based on the type definition for that object type in the SAS type dictionary.
The request is valid only if the specified object is a PrimaryType subtype in the SAS
Metadata Model, and if it stores a valid value in the PublicType attribute. For more
information, see “Using the OMI_FULL_OBJECT Flag” on page 298.
Note the similarity of this request to example shown in “Basic GetMetadata Request” on
page 281.
Expanding a GetMetadata Request to Get All Attributes and Associations 283
The GetMetadata method gets all of the attributes of the specified Column object,
including the names of attributes for which values have not been defined. It also gets all
of the attributes of the PhysicalTable object that is returned through the Table association
name.
To limit the output to attributes that have values defined, you can also set the
OMI_SUCCINCT (2048) flag. Add the value of OMI_SUCCINCT to
OMI_ALL_SIMPLE (2048 + 8 = 2056) and specify the sum in the FLAGS parameter.
The OMI_SUCCINCT flag instructs the SAS Metadata Server to omit any attributes that
do not contain a value or that contain a null value from the output.
<Trees/>
<TSObjectNamespace/>
<UniqueKeyAssociations/>
<UsedByPrototypes/>
<UsingPrototype/>
<Variables/>
<XPaths/></Column>
The output includes all attributes and associations that are documented for the Column
metadata type, including attributes and associations for which values have not been
defined. To limit the output to attributes and associations that have values, also set the
OMI_SUCCINCT (2048) flag. The OMI_SUCCINCT flag instructs the SAS Metadata
Server to omit any attributes and associations that do not contain a value or that contain
a null value from the output.
This Column object has three associated objects defined: an Index object is associated to
the Column through the Indexes association name; a UniqueKey object is associated
with the Column through the Keys association name; and a PhysicalTable object is
associated to the Column through the Table association name. The OMI_ALL flag
returns the Id, Name, and Desc values for associated objects.
<Options>
<Templates>
<Column Id="" ColumnLength="" BeginPosition="" EndPosition=""/>
<PhysicalTable Id="" Name="" Desc="" DBMSType="" MemberType=""/>
</Templates>
</Options>
</GetMetadata>
The GetMetadata method gets the values of the Name, Desc, ColumnType, SASFormat,
ColumnLength, BeginPosition, and EndPosition attributes of the specified Column
object. In addition, it gets the Id, Name, Desc, DBMSType, and MemberType attributes
of the Column object's associated PhysicalTable object.
<AssociationName search="Object"/>
<AssociationName search="Object[Criteria]"/>
• Object can be an * (asterisk) or a SAS Metadata Model metadata type that is valid
for the specified association name.
Specifying an * instructs the SAS Metadata Server to get objects of all metadata
types that are valid for AssociationName.
Specifying a metadata type instructs the SAS Metadata Server to get only associated
objects of the specified metadata type.
• [Criteria] is a search specification that conforms to the syntax documented for the
<XMLSELECT> option. For information about the syntax, see “<XMLSELECT
search="criteria"/> Syntax” on page 335. When search criteria are specified,
GetMetadata retrieves only associated objects indicated by Object that also meet the
specified criteria.
<Metadata>
<MetadataType>
<AssociationName search="Object[AttributeCriteria]"/>
</MetadataType>
</Metadata>
To understand the filtering that occurs, consider the following requests. In the first
request, the <METADATA> element specifies to get the Document metadata object that
has Id="A52WE4LI.AT0000RZ" and all objects that are associated with it through the
Objects association name (all metadata types):
<GetMetadata>
<Metadata>
<Document Id="A52WE4LI.AT0000RZ">
<Objects search="*"/>
</Document>
</Metadata>
<NS>SAS</NS>
<Flags>0</Flags>
<Options/>
</GetMetadata>
The request is the same as specifying the association name without search criteria:
<GetMetadata>
<Metadata>
<Document Id="A52WE4LI.AT0000RZ">
<Objects/>
</Document>
</Metadata>
288 Chapter 14 • Getting the Properties of a Specified Metadata Object
<NS>SAS</NS>
<Flags>0</Flags>
<Options/>
</GetMetadata>
In both requests, the GetMetadata method specifies to get requested attributes for the
specified Document object (Id only in this case) and all objects that are associated with it
through the Objects association name. Here is an example of the output from the
requests:
<!-- Using the GETMETADATA method. -->
<Document Id="A52WE4LI.AT0000RZ">
<Objects>
<PhysicalTable Id="A52WE4LI.B60000RT" Name="Table1" Desc="Sales table"/>
<PhysicalTable Id="A52WE4LI.B60000RU" Name="Table2" Desc="Human Resources table"/>
<ExternalTable Id="A52WE4LI.BA000001" Name="Oracle Sales" Desc="Sales information
from Oracle database"/>
<ExternalTable Id="A52WE4LI.BA000002" Name="Oracle HR" Desc="Human Resources
information from Oracle database"/>
</Objects>
</Document>
The specified Document object has four objects associated with it through the Objects
association name: two PhysicalTable objects and two ExternalTable objects. By default,
the GetMetadata method returns the Id, Name and Desc values of the associated objects.
In this second request, a search string is used in the Objects association name of the
<METADATA> element to filter the request to get only PhysicalTable objects that are
associated with the specified Document object through the Objects association:
<GetMetadata>
<Metadata>
<Document Id="A52WE4LI.AT0000RZ">
<Objects search="PhysicalTable"/>
</Document>
</Metadata>
<NS>SAS</NS>
<Flags>0</Flags>
<Options/>
</GetMetadata>
<Document Id="A52WE4LI.AT0000RZ">
<Objects>
<PhysicalTable Id="A52WE4LI.B60000RT" Name="Table1" Desc="Sales table"/>
<PhysicalTable Id="A52WE4LI.B60000RU" Name="Table2" Desc="Human Resources table"/>
</Objects>
</Document>
The ExternalTable objects that were returned in the first example are excluded from the
output of this example.
In this third request, attribute criteria are added to the search criteria string in the
<METADATA> element to further filter the request. The request specifies to get
PhysicalTable objects that are associated with the specified Document object through the
Objects association whose Desc attribute value has the word Sales in it:
Filtering the Associated Objects That Are Returned by a GetMetadata Request 289
<GetMetadata>
<Metadata>
<Document Id="A52WE4LI.AT0000RZ">
<Objects search="PhysicalTable[@Desc ? 'Sales']"/>
</Document>
</Metadata>
<NS>SAS</NS>
<Flags>0</Flags>
<Options/>
</GetMetadata>
<Document Id="A52WE4LI.AT0000RZ">
<Objects>
<PhysicalTable Id="A52WE4LI.B60000RT" Name="Table1" Desc="Sales table"/>
</Objects>
</Document>
to the specified Document through the Objects association and whose Desc attribute
has the words Human Resources in it.
Here is an example of the output from the request:
<!-- Using the GETMETADATA method. -->
Note: When the OMI_TEMPLATE flag is set, GetMetadata gets only the Id attribute for
associated objects. If you want to get additional attributes, you need to specify them
in another template, or set a flag such as OMI_ALL_SIMPLE (8), which gets all
attributes for the specified object and all associated objects.
ignored. Because the OMI_TEMPLATE flag is set, the SAS Metadata Server returns
only the Id value of the specified object and its associated objects.
Now, consider the following request:
<GetMetadata>
<Metadata>
<Document Id="A52WE4LI.AT0000RZ">
<ResponsibleParties search="ResponsibleParty[@Name ? 'Writer']"/>
</Document>
</Metadata>
<NS>SAS</NS>
<!-- OMI_TEMPLATE + OMI_ALL_SIMPLE + OMI_SUCCINCT flags -->
<Flags>2060</Flags>
<Options>
<Templates>
<ResponsibleParty>
<Persons search="*"/>
</ResponsibleParty>
</Templates>
</Options>
</GetMetadata>
The results show that one ResponsibleParty object is associated with Document
A52WE4LI.AT0000RZ through the ResponsibleParties association that has the word
Writer in its Name attribute. In turn, this ResponsibleParty object has one object
associated with it through the Persons association that describes a person named Melissa
Mark.
• The GetMetadata method returned the Name, Desc, and UsageVersion attribute
values for all of the objects specified in the <METADATA> element.
• The PhysicalTable object had no Extension objects associated with it through the
Extensions association. The Person, Event, WorkTable, and Document objects each
had two Extension objects defined through the Extensions association.
• The method attempted to list Extension objects that were associated to the Extension
objects (because Extension is a subtype of Root), but none were found.
• The values of Name, Desc, and UsageVersion attributes were also returned for the
Extension objects (because Extension is a subtype of Root).
The following is an example of a GetMetadata method call that sets the
OMI_INCLUDE_SUBTYPES flag and specifies multiple templates in the
<TEMPLATES> element. When you specify more than one template in the
<TEMPLATES> element, the order in which the templates are specified is important.
The templates are applied in the order specified. If two or more templates apply to the
same metadata type, the first template found is applied. The other templates are ignored.
For example:
<GetMetadata>
<Metadata>
<PhysicalTable Id="A58SW16P.B1000001"/>
<Person Id="A58SW16P.AP0001JL"/>
<Event Id="A58SW16P.B3000001"/>
<WorkTable Id="A58SW16P.B4000001"/>
<Document Id="A58SW16P.AY0000RT"/>
</Metadata>
<NS>SAS</NS>
<!-- OMI_TEMPLATE + OMI_INCLUDE_SUBTYPES -->
<Flags>20</Flags>
<Options>
<Templates>
<DataTable Name="" UsageVersion="">
<Documents/>
<Columns/>
</DataTable>
<Root Name="" Desc="" UsageVersion="">
<Extensions/>
</Root>
<Document Name="" Desc=""/>
</Templates>
</Options>
</GetMetadata
This method call specifies three templates in the <TEMPLATES> element. One template
is for the DataTable metadata type. One template is for the Root metadata type. And, one
template is for the Document metadata type. Because OMI_INCLUDE_SUBTYPES is
set, the GetMetadata method processes the templates as follows:
1. DataTable is the supertype of the PhysicalTable and WorkTable metadata types.
Therefore, the method returns the requested Name and UsageVersion attributes for
all of these objects, and any objects associated to them through the Documents and
Columns associations.
2. Because the first template did not specify what properties to get for any associated
Document and Column objects, the method consults the second template. Because
the Root metadata type is the supertype of all metadata types, the properties
requested for the Root object are retrieved for the Document and Column objects that
Using GetMetadata to Get Common Properties for Sets of Objects 295
were retrieved by the first template. The properties are also retrieved for the
remaining objects identified in the <METADATA> element.
3. Because the third template specifies a metadata object that has already been
processed by the second template, it is ignored.
The following is an example of the output returned by the SAS Metadata Server:
<Metadata>
<PhysicalTable Id="A58SW16P.B1000001" Name="Patient Information"
UsageVersion="0">
<Documents/>
<Columns>
<Column Id="A58SW16P.B2000001" Name="Patient ID" Desc="Patient Information"
UsageVersion="0"><Extensions/></Column><Column Id="A58SW16P.B2000002"
Name="Initials" Desc="Patient Initials" UsageVersion="0">
<Extensions/>
</Column>
<Column Id="A58SW16P.B2000003" Name="Sex" Desc="Sex of Patient"
UsageVersion="0"><Extensions/></Column>
<Column Id="A58SW16P.B2000004" Name="Date Of Birth" Desc="Date Of Birth"
UsageVersion="0">
<Extensions/>
</Column>
<Column Id="A58SW16P.B2000005" Name="Sponsor Patient ID"
Desc="Sponsor Patient Information" UsageVersion="0">
<Extensions/>
</Column>
<Column Id="A58SW16P.B2000006" Name="Weight In Pounds" Desc="Patient
Weight In Pounds" UsageVersion="0">
<Extensions/>
</Column>
<Column Id="A58SW16P.B2000007" Name="Weight In Kilograms" Desc="Patient
Weight In Kilograms" UsageVersion="0">
<Extensions>
<Extension Id="A58SW16P.AC0000RU" Name="Algorithm" Desc="Algorithm
for column." UsageVersion="0">
<Extensions/>
</Extension>
</Extensions>
</Column>
</Columns>
</PhysicalTable>
<Person Id="A58SW16P.AP0001JL" Name="Created Person 1 for getmet"
Desc="getmet07" UsageVersion="0">
<Extensions>
<Extension Id="A58SW16P.AC0001JL" Name="Attrib 1" Desc="First attribute"
UsageVersion="0">
<Extensions/>
</Extension>
<Extension Id="A58SW16P.AC0001JM" Name="Attrib 2" Desc="Second attribute"
UsageVersion="0">
<Extensions/>
</Extension>
</Extensions>
</Person>
296 Chapter 14 • Getting the Properties of a Specified Metadata Object
In the output, the PhysicalTable object has no associated Document objects and has
seven associated Column objects. One of the Column objects has an Extension object
defined for it. The WorkTable object has no associated Document or Column objects.
The method returned the properties requested for the Root metadata type for all
remaining objects. If the OMI_INCLUDE_SUBTYPES flag had not been set in the
method call, the results would have been different. In that case, the templates would
have been applied in the order given, but the templates that specify the DataTable and
Root metadata types would have been ignored.
SAS includes a second template form that enables you to map templates to the metadata
types that they are meant to expand. For more information, see “New Get Template
Form” on page 308 and “Templates and the OMI_INCLUDE_SUBTYPES Flag” on
page 315.
Combining GetMetadata Flags 297
Chapter 15
Using Templates
Understanding Templates
Description of a Template
A template is a metadata property string that you specify in the <TEMPLATES> element
in the OPTIONS parameter of a GetMetadata, GetMetadataObjects, or DeleteMetadata
method call. The template is submitted to the SAS Metadata Server with the
OMI_TEMPLATE (4) flag. In GetMetadataObjects, you must set the
OMI_GET_METADATA (256) flag in addition to OMI_TEMPLATE.
A template enables you to exactly specify the attributes and associations that you want to
retrieve for a specified metadata type. The specified metadata type can be the main
metadata type in the request or an associated metadata type. To request associations of
associated objects, you specify additional templates.
Prior to SAS 9.3, user-defined templates were the only way to retrieve information about
the associations of associated objects. Then, SAS added the OMI_FULL_OBJECT (2)
flag. The OMI_FULL_OBJECT flag returns the full logical metadata definition of
objects that are managed by the SAS type dictionary. For more information, see “Using
the OMI_FULL_OBJECT Flag” on page 298.
User-defined templates can be used to expand the logical metadata definitions of objects
that are not managed by the SAS type dictionary. You can also use templates to get a
portion of the information that would be returned by the OMI_FULL_OBJECT flag.
Template Attributes
The following table shows attributes that are supported in a template. These attributes
filter the objects and information about the objects that are returned.
<AssociationName Search="">
<AssociatedMetadataType Match="" TemplateExpand="" TemplateName=""/>
</AssociationName>
</MetadataType>
The Match and Search attributes support the full syntax that is available for the
GetMetadataObjects <XMLSELECT search="criteria"/> option. For more information,
see “<XMLSELECT search="criteria"/> Syntax” on page 335.
<MetadataType>
<AssociationName/>
</MetadataType>
• When templates are used, the GetMetadata method returns only the Id attribute of
associated objects. To get additional attributes for associated objects, set the
OMI_ALL_SIMPLE (8) flag, which gets all simple attributes (Attributen) for all
requested objects and associated objects. Or, specify additional templates that request
specific attributes, as follows:
<MetadataType>
<AssociationName/>
</MetadataType>
Creating Templates for the Get Methods 305
• To get only associated objects of a specified metadata type that have a specified
association, specify Search as follows:
<MetadataType>
306 Chapter 15 • Using Templates
<AssociationName Search="AssociatedMetadataType[AssociationName/
AssociatedMetadataType2]"/>
</MetadataType>
Here is an example of a template that requests objects associated to the table through the
Columns association:
<PhysicalTable>
<Columns/>
</PhysicalTable>
The SAS Metadata Server returns the Id values of all associated objects of all metadata
types that are valid for the Columns association name. The Columns association name
supports associations to objects of the Column and ColumnRange metadata types.
The following example requests additional attributes for the Column and ColumnRange
object:
<PhysicalTable>
<Columns/>
</PhysicalTable>
<Column Id="" Name="" MetadataCreated="" MetadataUpdated=""/>
The request continues to return the Id value of the one ColumnRange object.
Here is an example of a template that requests only associated ColumnRange objects,
and a template that requests basic attributes for the ColumnRange object:
<PhysicalTable>
<Columns search="ColumnRange"/>
</PhysicalTable>
<ColumnRange Id="" Name="" MetadataCreated="" MetadataUpdated=""/>
Here is an example of a template that requests only associated Column objects that have
Name="DEPTCODE", and a template that requests basic attributes for the Column
object:
<PhysicalTable>
<Columns search="Column[@Name='DEPTCODE']"/>
</PhysicalTable>
<Column Id="" Name="" MetadataCreated="" MetadataUpdated=""/>
Here is an example of a template that requests only Column objects that have indexes
defined for them, and a template that requests basic attributes for the Column object:
<PhysicalTable>
<Columns search="Column[Indexes/Index]"/>
</PhysicalTable>
<Column Id="" Name="" MetadataCreated="" MetadataUpdated=""/>
The GetMetadata method supports the Search attribute in the association name
subelements of the INMETADATA property string and the <TEMPLATES> element.
308 Chapter 15 • Using Templates
When search criteria are specified in both the INMETADATA parameter and in the
<TEMPLATES> element, the criteria in the INMETADATA parameter takes
precedence. For more information, see “Filtering the Associated Objects That Are
Returned by a GetMetadata Request” on page 286.
The GetMetadataObjects method supports the Search attribute in a template only. For
more information, see “Filtering the Associated Objects That Are Returned by a
GetMetadataObjects Request” on page 349.
<GetMetadata>
<Metadata>
<MetadataType TemplateName="1"/>
</Metadata>
<Ns>SAS</Ns>
<Flags>4</Flags>
<Options>
<Templates>
<Template TemplateName="1"> 1
<MetadataType Name="" Attribute1="" Attribute2="" Attribute3="">
<AssociationName1 Search="AssociatedMetadataType1"/> 2
<AssociatedMetadataType1 Match="criteria1" TemplateExpand="Yes" TemplateName="2"/>
<AssociatedMetadataType1 Match="criteria2" TemplateExpand="Yes" TemplateName="3"/>
<AssociatedMetadataType1 TemplateExpand="No"/>
</AssociationName1>
<AssociationName2/> 3
</MetadataType>
<AssociatedMetadataType2 Name="" Attribute1=""> 4
<AssociationName/>
</AssociatedMetadataType2>
</Template>
<Template TemplateName="2"> 5
<AssociatedMetadataType Name="" Attribute1="" Attribute2="" >
<AssociationNameX/>
</AssociatedMetadataType>
</Template>
<Template TemplateName="3">
<AssociatedMetadataType Name="" Attribute1="" Attribute2="" >
<AssociationNameY/>
</AssociatedMetadataType>
</Template>
</Templates>
</Options>
</GetMetadata>
Note: The <TEMPLATE> subelement, which expands the primary object, is shown
first to simplify the explanation. But, it does not need to be specified first. Named
templates can be listed in any order in the <TEMPLATES> element.
2 The first AssociationName subelement specifies the Search attribute to filter the
request to return only objects of metadata type AssociatedMetadataType1. It is
followed by subelements to indicate that different handling of objects of
AssociatedMetadataType1 is needed, based on criteria specified in the Match
attribute.
• Object instances that meet Match= "criteria1" will be expanded by the template
indicated in TemplateName="2".
• Object instances that meet Match="criteria2" will be expanded by the template
indicated in TemplateName="3".
• Object instances that meet neither criteria will have only their Id values returned.
When a TemplateName attribute is encountered in another template, the SAS
Metadata Server deactivates the current template, and makes the new template
active. When processing of the named template completes, it reactivates and
continues with the initial template.
3 The second AssociationName subelement behaves the same as it did in the legacy
template. The SAS Metadata Server will return object instances of all metadata types
that are valid for the specified association name. It returns only the Id values of any
objects that are found unless you specify additional templates to indicate the
attributes and associations that you would like returned for each object type. When
reading additional templates, the server makes an exact metadata type match, unless
the OMI_INCLUDE_SUBTYPES flag is set. For more information, see “Templates
and the OMI_INCLUDE_SUBTYPES Flag” on page 315.
4 This is an additional template. You can specify as many additional templates as you
need. You can invoke the TemplateName attribute in an additional template as well.
5 This is the second of the three named templates in the request.
AssociatedMetadataType is the same metadata type as what is in the property string
containing the corresponding TemplateName attribute value, or it is a supertype if
the OMI_INCLUDE_SUBTYPES flag is set.
</AssociatedMetadataType2>
</Template>
<Template TemplateName="1">
<AssociatedMetadataType Name="" Attribute="">
<AssociationNameA/>
</AssociatedMetadataType>
</Template>
<Template TemplateName="2">
<AssociatedMetadataType Name="" Attribute="">
<AssociationNameB/>
</AssociatedMetadataType>
</Template>
</Templates>
</Options>
</GetMetadataObjects>
1 Because GetMetadataObjects does not accept an input metadata property string, you
specify the metadata type from the TYPE parameter in the TemplateName attribute
of the <TEMPLATE> subelement. The metadata property string in the
<TEMPLATE> subelement specifies the metadata type, attributes, and association
names to expand.
2 The Search, Match, TemplateName, and TemplateExpand attributes behave as they
do in GetMetadata.
3 Additional templates behave as they do in GetMetadata.
<GetMetadata>
<Metadata>
<Tree Id="A5MFRU33.AI0001JM" TemplateName="MyTree"/>
</Metadata>
<Ns>SAS</Ns>
<Flags>20</Flags>
<Options>
<Templates>
<Template TemplateName="MyTree">
<Tree Id="" Name="" Desc="" PublicType="">
<Members>
<PhysicalTable TemplateName="Table"/>
<ClassifierMap Match="@PublicType='StoredProcess'"
TemplateName="StoredProcess"/>
<Job TemplateName="Job"/>
<Root Templatename="dflt"/>
</Members>
</Tree>
</Template>
<Template TemplateName="dflt">
<Root Id="" Name=""/>
</Template>
<Template TemplateName="StoredProcess">
<ClassifierMap Id="" Name="" Desc="" PublicType=""
IsActive="" IsUserDefined="" TransformRole="">
<ComputeLocations/>
<Prompts/>
</ClassifierMap>
<Root Id="" Name=""/>
</Template>
<Template TemplateName="Job">
<Job Id="" Name="" Desc="" PublicType="" IsActive=""
IsUserDefined="" TransformRole="">
<JobActivities/>
<TransformationSources/>
<TransformationTargets/>
</Job>
<TransformationActivity Id="" Name="" Desc="">
<Steps/>
</TransformationActivity>
<Root Name="" Desc=""/>
</Template>
<Template TemplateName="Table">
<PhysicalTable Id="" Name="" Desc="" PublicType=""
IsCompressed="" DBMSType="">
<Columns/>
<Indexes/>
<UniqueKeys/>
</PhysicalTable>
<Column Id="" Name="" Desc="" SASColumnType="" SASColumnLength=""
SASFormat="" SASInformat=""/>
<Index Id="" Name="" Desc="" IndexName="" IsClustered=""
IsUnique=""/>
<UniqueKey Id="" Name="" Desc=""/>
</Template>
</Templates>
312 Chapter 15 • Using Templates
</Options>
</GetMetadata>
The request returns information about one stored process, one job, one table, and all
requested information for each object. In addition, it returns two Document objects that
are in the folder.
The following is an example of a GetMetadataObjects request that uses the new template
form. The request sets the OMI_GET_METADATA (256) and OMI_TEMPLATES (4)
flags, which are required to activate templates processing in GetMetadataObjects. This
request specifies to list tables that have columns that are not numeric that have indexes
defined for them, and requests attributes for the columns and indexes. For more
information about the NOT logical operator, see “NOT Logical Operator in
AttributeCriteria Component” on page 338.
<GetMetadataObjects>
<Reposid>A0000000.A5TJRDIT</Reposid>
<Type>PhysicalTable</Type>
<Objects/>
<Ns>SAS</Ns>
<Flags>260</Flags>
<Options>
<Templates>
<Template TemplateName="PhysicalTable">
<PhysicalTable Name="">
<Columns Search="Column[Not(@SASColumnType='N')]">
<Column Match="Column[Indexes/Index]"/>
<Column TemplateExpand="No"/>
</Columns>
<Indexes/>
</PhysicalTable>
<Column SASColumnName="" SASColumnType="" SASColumnLength="">
<Indexes/>
</Column>
<Index IndexName="" IsClustered="" IsNoMiss="" IsUnique=""/>
</Template>
</Templates>
</Options>
</GetMetadataObjects>
<Indexes/>
</PhysicalTable >
<PhysicalTable Id="A5TJRDIT.B2000003" Name="CENSUS">
<Columns SEARCH="Column[Not(@SASColumnType='N')]">
<Column Id="A5TJRDIT.B700000A" SASColumnName="State" SASColumnType="C"
SASColumnLength="14">
<Indexes >
<Index Id="A5TJRDIT.BI000001" IndexName="State" IsClustered="0"
IsNoMiss="0" IsUnique="1"/>
</Indexes>
</Column>
<Column Id="A5TJRDIT.B700000B"/>
</Columns>
<Indexes>
<Index Id="A5TJRDIT.BI000001"/>
</Indexes>
</PhysicalTable>
<PhysicalTable Id="A5TJRDIT.B2000004" Name="CENSUS1990">
<Columns SEARCH="Column[Not(@SASColumnType='N')]">
<Column Id="A5TJRDIT.B700000E"/>
<Column Id="A5TJRDIT.B700000F"/>
</Columns>
<Indexes/>
</PhysicalTable>
<PhysicalTable Id="A5TJRDIT.B200000K" Name="EMPLOYEE">
<Columns SEARCH="Column[Not(@SASColumnType='N')]">
<Column Id="A5TJRDIT.B700002R" SASColumnName="EMPNO" SASColumnType="C"
SASColumnLength="5">
<Indexes>
<Index Id="A5TJRDIT.BI000006" IndexName="EMPNO" IsClustered="0" IsNoMiss="0"
IsUnique="1"/>
</Indexes>
</Column>
<Column Id="A5TJRDIT.B700002S"/>
<Column Id="A5TJRDIT.B700002T"/>
<Column Id="A5TJRDIT.B700002U"/>
</Columns>
<Indexes>
<Index Id="A5TJRDIT.BI000006"/>
</Indexes>
</PhysicalTable>
<PhysicalTable Id="A5TJRDIT.B200000J" Name="EMPINFO">
<Columns SEARCH="Column[Not(@SASColumnType='N')]">
<Column Id="A5TJRDIT.B700002A"/>
<Column Id="A5TJRDIT.B700002B"/>
</Columns>
<Indexes>
<Index Id="A5TJRDIT.BI000003"/>
</Indexes>
</PhysicalTable>
</Objects>
<Ns>SAS</Ns>
<Flags>260</Flags>
<Options>
<Templates>
<Template TemplateName="PhysicalTable">
Creating Templates for the Get Methods 315
<PhysicalTable Name="">
<Columns Search="Column[Not(@SASColumnType=''N'')]">
<Column Match="Column[Indexes/Index]" TemplateName="column"/>
<Column TemplateExpand="No"/>
</Columns>
<Indexes/>
</PhysicalTable>
</Template>
<Template TemplateName="column">
<Column SASColumnName="" SASColumnType="" SASColumnLength="">
<Indexes>
<Index TemplateName="index"/>
</Indexes>
</Column>
</Template>
<Template TemplateName="index">
<Index IndexName="" IsClustered="" IsNoMiss="" IsUnique=""/>
</Template>
</Templates>
</Options>
</GetMetadataObjects>
The results return information about six tables. Only two of the tables have character
columns that have indexes. Column objects for which only Id values are shown are
character columns that do not have indexes. Indexes for which only Id values are shown
indicate an index that is associated with the table, rather than defined on a character
column.
Column objects, and a Column object has a Table association with its table. When using
templates to expand the associations of associated objects, avoid specifying both sides of
a relationship in the template. The server has logic that prevents visiting the same object
more than once when a two-sided reference occurs. However, when multiple
associations refer to the same metadata types, the server can revisit those same objects
over and over again.
This can happen easily in templates that expand objects of the PhysicalTable, Column,
and ForeignKey metadata types, which are related to each other through the Columns/
Table, ForeignKeys/Table, and Keys/KeyedColumns associations.
To prevent objects from being revisited, you can set the OMI_NOEXPAND_DUPS
(524288) flag. However, this flag has memory overhead associated with it, so it is better
to avoid specifying two-sided references.
An example of the incorrect way to expand PhysicalTable, Column, and ForeignKey
objects is the following:
<PhysicalTable>
<Columns/>
<Keys/>
</PhysicalTable>
<Column>
<Table/>
<ForeignKeys/>
</Column>
<ForeignKey>
<Table/>
<KeyedColumns/>
</ForeignKey>
Chapter 16
Getting All Metadata of a
Specified Metadata Type
<GetMetadataObjects>
<!--Reposid specifies Test repository 1 -->
<Reposid>A0000001.A53TPPVI</Reposid>
<Type>PhysicalTable</Type>
<Objects/>
<NS>SAS</NS>
<Flags>0</Flags>
<Options/>
</GetMetadataObjects>
<Objects>
<PhysicalTable Id="A53TPPVI.A4000001" Name="Sales Offices"/>
<PhysicalTable Id="A53TPPVI.A4000002" Name="Sales Associates"/>
</Objects>
• When GetMetadata flags are used with the OMI_INCLUDE_SUBTYPES (16) flag,
the GetMetadataObjects method gets the specified properties for all subtypes of the
specified metadata type, in addition to all objects of the specified metadata type.
• When GetMetadata flags are used with the OMI_XMLSELECT (128) flag, the
GetMetadataObjects method gets the specified properties only for metadata objects
that meet <XMLSELECT> search criteria.
• When GetMetadata flags are used with the OMI_DEPENDENCY_USES (8192)
flag, the GetMetadataObjects method gets the specified properties for objects of the
specified metadata type in all public repositories (the foundation repository and all
custom repositories). When GetMetadata flags are used with the
OMI_DEPENDENCY_USED_BY (16384) flag, the GetMetadataObjects method
gets the specified properties for objects of the specified metadata type in the current
repository and all project repositories.
<Objects>
<PhysicalTable Id="A53TPPVI.A4000001" Name="Sales Offices" DBMSType=""
Desc="Sales offices in NW region" IsCompressed="0" IsEncrypted="0"
LockedBy="" MemberType="" MetadataCreated="05Feb2002:09:37:00"
MetadataUpdated="05Feb2002:09:37:00" NumRows="-1" SASTableName=""
TableName="">
<AccessControls/>
<Aggregations/>
<AnalyticTables/>
<Changes/>
<Columns>
<Column Id="A53TPPVI.A5000001" Name="City" Desc="City of Sales Office"/>
Expanding a GetMetadataObjects Request to Return Additional Properties 321
<Implementors/>
<Indexes/>
<Keywords/>
<ModelResults/>
<Notes/>
<PrimaryPropertyGroup/>
<Properties/>
<PropertySets/>
<ReachThruCubes/>
<ResponsibleParties/>
<Roles/>
<SASPasswords/>
<SourceClassifierMaps/>
<SourceTransformations/>
<SpecSourceTransformations/>
<SpecTargetTransformations/>
<TablePackage/>
<TargetClassifierMaps/>
<TargetTransformations/>
<Timestamps/>
<TrainedModelResults/>
<Trees/>
<UniqueKeys/>
<UsedByPrototypes/>
<UsingPrototype/>
</PhysicalTable>
</Objects>
The OMI_ALL flag gets all of the attributes and associations for each object, including
attributes and associations for which no value has been defined. This is useful when you
want to get both actual and potential properties for all of the objects.
<Objects>
<PhysicalTable Id="A53TPPVI.A4000001" Name="Sales Offices"
Desc="Sales offices in NW region" IsCompressed="0" IsEncrypted="0"
MetadataCreated="05Feb2002:09:37:00"
MetadataUpdated="05Feb2002:09:37:00" NumRows="-1">
<Columns>
<Column Id="A53TPPVI.A5000001" Name="City" Desc="City of Sales Office"/>
<Column Id="A53TPPVI.A5000002" Name="Address" Desc="Street Address of Sales
Office"/>
<Column Id="A53TPPVI.A5000003" Name="Manager" Desc="Name of Operations
Manager"/>
<Column Id="A53TPPVI.A5000004" Name="Employees" Desc="Number of employees"/>
</Columns>
</PhysicalTable>
<PhysicalTable Id="A53TPPVI.A4000002" Name="Sales Associates"
Expanding a GetMetadataObjects Request to Return Additional Properties 323
<Objects>
<Column Id="A53TPPVI.A5000001" Name="City" BeginPosition="0"
ColumnLength="32"
ColumnName="City" ColumnType="12" Desc="City of Sales Office" EndPosition="0"
IsDiscrete="0" IsNullable="0" MetadataCreated="05Feb2002:09:37:00"
MetadataUpdated="05Feb2002:09:37:00" SASColumnLength="32" SASColumnName="City"
<GetMetadataObjects>
<!-- Reposid parameter specifies Test repository 1 -->
<Reposid>A0000001.A53TPPVI</Reposid>
<Type>PhysicalTable</Type>
<Objects/>
<NS>SAS</NS>
<!-- Specify OMI_GET_METADATA(256) + OMI_TEMPLATE (4) flags -->
<Flags>260</Flags>
<Options>
<Templates>
<PhysicalTable DBMSType="" IsCompressed="" IsEncrypted=""
MemberType=""/>
</Templates>
</Options>
</GetMetadataObjects>
In the request, the template specifies to get the DBMSType, IsCompressed, IsEncrypted,
and MemberType attributes for each of the PhysicalTable objects in repository
A53TPPVI. Here is an example of the output from the request:
<!-- Using the GETMETADATAOBJECTS method. -->
<Objects>
<PhysicalTable Id="A53TPPVI.A4000001" Name="Sales Offices" DBMSType=""
IsCompressed="0" IsEncrypted="0" MemberType=""/>
<PhysicalTable Id="A53TPPVI.A4000002" Name="Sales Associates" DBMSType=""
IsCompressed="0" IsEncrypted="0" MemberType=""/>
</Objects>
The SAS Metadata Server gets the requested properties and the Id and Name attributes
that are returned by default.
For information about how to create a template, see “Understanding Templates” on page
301.
<Indexes/>
</PhysicalTable>
</Templates>
</Options>
</GetMetadataObjects>
In the request, the template specifies to get objects that are associated with the requested
PhysicalTable objects through the Columns, Extensions, and Indexes association names.
Here is an example of the output from the request:
<!-- Using the GETMETADATAOBJECTS method. -->
<Objects>
<PhysicalTable Id="A53TPPVI.A4000001" Name="Sales Offices">
<Columns>
<Column Id="A53TPPVI.B7000001"/>
<Column Id="A53TPPVI.B7000002"/>
<Column Id="A53TPPVI.B7000003"/>
<Column Id="A53TPPVI.B7000004"/>
</Columns>
<Extensions/>
<Indexes/>
</PhysicalTable>
<PhysicalTable Id="A53TPPVI.A4000002" Name="Sales Associates">
<Columns>
<Column Id="A53TPPVI.B7000005"/>
<Column Id="A53TPPVI.B7000006"/>
<Column Id="A53TPPVI.B7000007"/>
<Column Id="A53TPPVI.B7000008"/>
</Columns>
<Extensions/>
<Indexes/>
</Objects>
In this example, the returned PhysicalTable objects have associated Column objects. But,
they do not have associated objects through the Extensions and Indexes association
names.
In the request, note the following:
• By default, the GetMetadataObjects method returns only the Id value of associated
objects. To get additional attributes, you must set a flag, such as
OMI_ALL_SIMPLE (8), to get all attributes for the specified object and the
associated objects. Or, you can include additional templates that request specific
attributes of the associated objects.
• When an association name is specified in a template (<Columns/>, <Extensions/>,
and <Indexes/> in the previous example), the GetMetadataObjects method gets
associated objects of all metadata types that are valid for the specified association
name. This example does not show objects of these associated metadata types
because no objects of the additional metadata types were found. However, the
Columns association name supports associations to two metadata types: Column and
ColumnRange. The Extensions association name supports associations to two
metadata types: Extension and NumericExtension. The Indexes association name has
one valid metadata type: Index. This GetMetadataObjects request could have
retrieved associated objects of all of these metadata types.
Expanding a GetMetadataObjects Request to Include Subtypes 327
The GetMetadataObjects method also supports search criteria that enable you to filter
the associated objects that are retrieved. For more information, see “Filtering the
Associated Objects That Are Returned by a GetMetadataObjects Request” on page 349.
The DataTable supertype has the following subtypes defined for it in the SAS Metadata
Model: ExternalTable, PhysicalTable, QueryTable, RelationalTable, TableCollection, and
WorkTable. OMI_INCLUDE_SUBTYPES gets all objects of these subtypes that are
defined in Test repository 1.
Here is an example of the output returned by the SAS Metadata Server:
<!-- Using the GETMETADATAOBJECTS method. -->
<Objects>
<PhysicalTable Id="A53TPPVI.A4000001" Name="Sales Offices"/>
<PhysicalTable Id="A53TPPVI.A4000002" Name="Sales Associates"/>
</Objects>
Test repository 1 has two objects of subtype PhysicalTable and no objects of the other
subtypes.
The default behavior of the GetMetadataObjects method is to get the Id and Name
values for all objects that are found. When OMI_INCLUDE_SUBTYPES is set with
OMI_GET_METADATA (256) and GetMetadata flags, the GetMetadataObjects method
gets the requested properties for all subtype objects. For more information, see
328 Chapter 16 • Getting All Metadata of a Specified Metadata Type
Flag Behavior
The GetMetadataObjects method supports the OMI_DEPENDENCY_USES (8192) and
OMI_DEPENDENCY_USED_BY (16384) flags to enable you to get objects from other
repositories.
• Set OMI_DEPENDENCY_USES to include objects from all public repositories in
the method results. The foundation repository and all custom repositories are public
repositories.
• Set OMI_DEPENDENCY_USED_BY to include objects from all private
repositories in the method results. Project repositories are considered to be private
repositories.
• To get objects from all repositories on the SAS Metadata Server, set both flags.
This request returns all objects of the PhysicalTable metadata type from the specified
repository and all other public repositories.
In the request, note the following:
• The <REPOSID> element specifies a repository to search. When the
OMI_DEPENDENCY_USES flag is set, specifying a value for the <REPOSID>
element is optional. When a <REPOSID> value is omitted, the method gets objects
of the specified metadata type first from the foundation repository. Then, it returns
objects from custom repositories in the order in which they were registered.
When a repository identifier is specified in the <REPOSID> element, the SAS
Metadata Server gets objects from the specified repository first, before it gets objects
from the foundation repository and custom repositories. The specified repository can
be the foundation repository, a custom repository, or a project repository.
Expanding a GetMetadataObjects Request to Include Additional Repositories 329
• The <TYPE> element specifies the metadata type of the objects to list.
• The OMI_DEPENDENCY_USES flag is expressed as a numeric value in the
<FLAGS> element.
• Output is returned in the <OBJECTS> element.
<Objects/>
<NS>SAS</NS>
<!-- Specify OMI_DEPENDENCY_USES (8192) and
OMI_DEPENDENCY_USED_BY (16384) flags -->
<Flags>24576</Flags>
<Options/>
</GetMetadataObjects>
flags and options that are supported in the SAS namespace can be specified in the
REPOS namespace as well.
• Output is returned in the <OBJECTS> element.
332 Chapter 16 • Getting All Metadata of a Specified Metadata Type
333
Chapter 17
Filtering a GetMetadataObjects
Request
General Syntax
The <XMLSELECT> element is specified in the OPTIONS parameter in the following
form:
<XMLSELECT search="criteria"/>
The syntax of criteria varies depending on whether you are specifying attribute criteria,
association path criteria, or both.
A statement that specifies only attribute criteria on the metadata type defined in the
GetMetadataObjects TYPE parameter can be specified as one of the following:
AttributeCriteria
(AttributeCriteria)
Object[AttributeCriteria]
(AttributeCriteria and|or
AttributeCriteria)
Object[AttributeCriteria and|or
AttributeCriteria]
In a statement that specifies only attribute criteria, the brackets and parentheses around
the criteria are optional. For all other syntax combinations, the brackets and parentheses
must be specified as shown.
A statement that specifies both attribute criteria and an association path as criteria is
specified as follows:
Object[AttributeCriteria][AssociationPath]
Object[AssociationPath]
A statement that specifies an association path that has multiple association levels defined
is specified as follows:
Object[AssociationPathLevel1/AssociationPathLevel2/AssociationPathLeveln]
The first example has an implied AND logical operator between association paths.
A statement that specifies the NOT logical operator in attribute criteria is specified as
follows:
not(criteria)
Object[not(criteria)]
object[not(AssociationPathLevel1/AssociationPathLevel2)]
Object Component
The Object component is required for all searches except simple attribute criteria
searches. It specifies the object class type. Valid values are a metadata type name or an
asterisk (*).
• The metadata type can be the same metadata type that is specified in the
GetMetadataObjects TYPE parameter or a subtype of the metadata type. To
determine the subtypes of a metadata type, see the metadata type descriptions in the
SAS Metadata Model: Reference.
• An * (asterisk) is a shorthand method of referring to the metadata type specified in
the TYPE parameter.
AttributeCriteria Component
The AttributeCriteria component is optional. It enables you to filter the objects that are
selected to objects matching a specified attribute=value pair. The syntax of
AttributeCriteria is as follows:
[@attrname cop 'value' lop AttributeCriteria]
=, eq, or EQ
Equal to the specified character string, numeric, datetime, or MISSING value.
ne, NE
Not equal to the specified character string, numeric, datetime, or MISSING
value.
ge, GE
Greater than or equal to the character string, numeric, or datetime value.
MISSING value not supported.
gt, GT
Greater than the character string, numeric, or datetime value. MISSING value not
supported.
le, LE
Less than or equal to the character string, numeric, or datetime value. MISSING
value not supported.
lt, LT
Less than the character string, numeric, or datetime value. MISSING value not
supported.
• 'value' is a character or numeric string enclosed within single quotation marks.
Character Strings:
Searches of character strings compare the <XMLSELECT search="criteria"/> search
pattern value with the attribute data value and determine which string appears first in
a sorted list. The sort order is based on the collating sequence for the specified
locale. If either the data or pattern values contain any characters that are not in the
locale’s collation list, the locale determines how to order the unknown characters.
Missing Values:
• To search for a MISSING numeric or datetime attribute value, specify a period
enclosed within single quotation marks.
• To search for a MISSING character attribute value, specify two adjacent single
quotation marks.
“V” in an Attribute’s Length Limit:
When evaluating attributes that have a “Vn” in the Length limit, for example “V64”,
the search process evaluates only the n number of characters to make the selection. A
“Vn” in the Length limit indicates the property is arbitrarily large. The documented
length (n) is the maximum length that can be stored before an overflow algorithm is
invoked. Storing a string that exceeds the documented length causes one or more
TextPage objects and corresponding associations that connect them to the original
object to be created to store the string. The search process does not search these
“overflow” objects.
Datetime Values:
In the current release, searches by date or by time are not supported. However, the
SAS Metadata Server supports datetime queries on the MetadataCreated and
MetadataUpdated attributes. The supported DATETIME formats are the following:
• ddmmmyyyy:hh:mm:ss.s
• ddmmmyyyy:hh:mm:ss
• a SAS date value that represents a ddmmmyyyy:hh:mm:ss value
• a MISSING datetime '.' value
338 Chapter 17 • Filtering a GetMetadataObjects Request
In the third example, '1309907400' is the SAS date value for '30May2003:19:03:11'
GMT.
• lop is the logical operator AND or OR. It enables you to specify an additional
AttributeCriteria string that is appended to and concatenated with the first
AttributeCriteria string. AND specifies that both conditions must be met in order for
an object to be selected for retrieval. OR specifies that either condition can be met
for an object to be selected. An example of an OR comparison is the following:
[@Name = 'John Doe' or @Name = 'Jane Doe']
Compound attribute criteria are also supported. Use parentheses to control evaluation
order. For example:
search="*[@ProductName='SAS/CONNECT' and
(@Name contains 'test - SAS/CONNECT Server' or @Name='test')]"
In this example, the expression enclosed within the parenthesis is evaluated first.
Note: Whether single, concatenated, or compound attribute criteria are used, the
attribute test is applied only if all of the specified attribute names are valid for the
object. That is, if one of the attribute names in the attribute string is misspelled, then
no objects are selected. If the OMI_INCLUDE_SUBTYPES flag is set with
OMI_XMLSELECT, the metadata type and subtype objects to be tested might
support a different set of attribute names. Only objects that contain all of the
specified attribute names are tested for a match.
The NOT logical operator must be specified before the attribute criteria that it qualifies
in the search string. And, the attribute criteria must be enclosed within parentheses. For
example:
not(criteria)
<XMLSELECT search="criteria"/> Syntax 339
object[not(criteria)]
The preceding NOT (criteria) request specifies to omit object instances that meet the first
criteria, and to omit object instances that meet the second criteria.
Valid use of the NOT logical operator for attribute criteria in an association path
specification is as follows:
*[AssociationName/AssociatedObject[not(criteria)]]
The string specifies to return object instances that have the specified association, and
that do not meet the specified attribute criteria.
You might want to use the NOT logical operator for attribute criteria in association paths
to find object instances that do not meet the specified attribute criteria, and have the
specified association and an associated object that meets the specified attribute criteria:
*[not(criteria)][AssociationName/AssociatedObject [criteria]]
For an example of how the NOT logical operator can be used in a GetMetadataObjects
request, see “Examples of How the New Template Form Can Be Used” on page 310.
The example uses the NOT logical operator in the Search attribute that is specified on an
association name in a template to filter the associated objects that are retrieved.
For information about how to get objects that do not have a specified association, see
“NOT Function in the AssociationPath Component” on page 344.
AssociationPath Component
The AssociationPath component enables you to specify one or more associations as
search criteria. To be selected, the objects specified in the Object component must have
an association that meets the criteria in AssociationPath.
The syntax of AssociationPath is as follows:
Object[AssociationPath] AND | OR [AssociationPathn]
In the syntax, Object can be a metadata type name or an asterisk. For more information,
see “Object Component” on page 336.
Each AssociationPath specifies one association of Object to evaluate.
An AssociationPath specification can include one or many association path levels. The
first AssociationPathLevel identifies the association of Object that will be evaluated.
Each subsequent level filters the objects that are returned for this first association by
specifying additional associations, associated metadata types, and attribute criteria that
the first set of objects must match in order to be selected. For more information, see
“Understanding How Association Paths Are Evaluated” on page 340. Each
AssociationPathLevel within the AssociationPath is separated from the other levels by a
slash (/).AttributeCriteria is optional in an AssociationPathLevel.
340 Chapter 17 • Filtering a GetMetadataObjects Request
AssociationPathLevel
To understand how an association path is evaluated, we must consider each association
path level that is specified. The AssociationPathLevel specifies an association name and
an associated object that is evaluated, as well as optional attribute criteria that the
associated objects must meet to be selected.
The first AssociationPathLevel in AssociationPath sets the context for the request. It
specifies the association that an object must have defined to be evaluated. When
considered in the context of Object, the syntax of the first AssociationPathLevel looks
like the following:
Object[AssociationName/AssociatedObject[AttributeCriteria]]
Object can be the same metadata type name that is specified in the GetMetadataObjects
TYPE parameter, a subtype of the metadata type in TYPE, or an asterisk, which defaults
to the value in the TYPE parameter. The value that you specify in Object indicates what
association names are valid. In the first AssociationPathLevel, the following is true:
• If Object is a metadata type, then AssociationName must be an association name that
is valid for that metadata type as defined in the SAS Metadata Model. For example,
if Object is Report, then AssociationName must be an association name that is
defined for the Report metadata type in the SAS Metadata Model.
• If Object is an *, then AssociationName must be an association name that is valid for
the metadata type specified in the TYPE parameter.
The AssociatedObject in the AssociationPathLevel specification can also be a metadata
type name or an asterisk. However, in this position, the specified value stipulates
whether associated objects of one metadata type should be evaluated, or, that associated
objects of all of the potential associated metadata types defined for the association name
should be evaluated. For example:
• When AssociatedObject is a metadata type, this says, “Give me only object instances
of this metadata type that are related under the specified association name.”
• When AssociatedObject is an asterisk, this says “Give me object instances of all
potential metadata types that are defined for the specified association name.”
Consider the following AssociationPathLevel specifications to understand how the
asterisk and metadata type names are evaluated in the Object and AssociatedObject
positions. For these examples, assume that Report is the metadata type specified in the
TYPE parameter.
*[ReportLocation/*]
Report[ReportLocation/Email]
The first specification selects objects of the metadata type specified in the TYPE
parameter (Report) that have a ReportLocation association and associated objects of any
of the metadata types that are valid for the ReportLocation association name. The
ReportLocation association name supports associations to objects of 19 metadata types.
Understanding How Association Paths Are Evaluated 341
The second specification selects Report objects that have a ReportLocation association
to an Email object. (Email is one of the 19 supported associated metadata types.)
If a subtype were specified in either the Object or AssociatedObject positions, then the
SAS Metadata Server would select only objects and associated objects of the specified
subtype. Report is a subtype of the Classifier metadata type. If Classifier were the
metadata type specified in the TYPE parameter, the first specification above would apply
to the Classifier metadata type. The second specification would still only apply to Report
objects.
The AttributeCriteria component in AssociationPathLevel further limits the Objects that
are selected to objects whose associated objects meet the specified attribute criteria. For
example, consider the following request:
Report[ReportLocation/Document[@TextType='XML']]
The attribute criteria limit the Report objects that are selected to objects that have
associated Document objects that have the attribute TextType="XML". When attribute
criteria are specified in a query that has an * in the AssociatedObject component, the
attribute criteria are applied to all associated objects.
Subsequent AssociationPathLevels in an AssociationPath get their context from the
AssociatedObject in the preceding level.
• When the preceding associated object is a metadata type, AssociationName must be
an association name that is valid for that metadata type.
• When the preceding associated object is an *, AssociationName can be any
association name defined for one of the metadata types supported by the preceding
association name.
Consider the following AssociationPath. The AssociationPathLevels are separated by a /
(slash):
Report[ReportLocation/Document[@TextType='XML']/AssociationName/AssociatedObject]
AssociationName must be an association that is valid for the Document metadata type.
AssociatedObject must be a metadata type that is supported by AssociationName or an *.
Consider the following AssociationPath:
Report[ReportLocation/*/AssociationName/AssociatedObject]
AssociationName can be an association name that is valid for any of the 19 metadata
types supported by the ReportLocation association. AssociatedObject must be a metadata
type that is supported by AssociationName or an *.
The following is an example of an AssociationPath that specifies multiple
AssociationPathLevels and specifies metadata types in the AssociatedObject positions:
Report[ResponsibleParties/ResponsibleParty/Persons/Person
/Locations/Location[@Area='New York']]
The request selects Report objects that have a ResponsibleParties association to any
object that has a Role attribute value of Owner and a Persons association to any object
that has a Name attribute value of John Doe. It has two AssociationPathLevels:
1. ResponsibleParties/*
2. Persons/*
The following table summarizes the evaluation algorithm used when multiple
association paths are concatenated with the AND logical operator. If any association path
criteria evaluates to False, then the concatenated association path criteria is False.
The following table summarizes the evaluation algorithm used when multiple
association paths are concatenated with the OR logical operator. Only one association
path criteria must be True in order for the concatenated association path criteria to be
True.
The following table summarizes the evaluation algorithm used when multiple
association paths are concatenated with both the AND and OR logical operators. Paths
that are separated by an AND logical operator are treated as if they have parenthesis
around them. That is, they are read as a set, and they must both be true to evaluate as
True. Otherwise, they evaluate to False. When OR is used between association paths,
only one path must be True to return a True.
When the OMI_INCLUDE_SUBTYPES flag is set, only objects that have all of the
specified association names are tested for a match.
Example 1:
• Object 1 and Object 2 are subtypes of *. Object 1 has valid associations to
associationname1 and associationname2. Object 2 has valid associations to
associationname3 and associationname4.
• Query: search="*[associationname1/object][associationname2/
object]"
Result: Only Object 1 is returned.
• Query: search="*[associationname3/object][associationname4/
object]"
Result: Only Object 2 is returned.
• Query: search="*[associationname1/object][associationname4/
object]"
Result: Neither object is returned.
Example 2:
• Object 1 and Object 2 are subtypes of *. Object 1 has valid associations to
associationname1, associationname2, and associationname3. Object 2 has valid
associations to associationname2, associationname3, and associationname4.
• Query: search="*[associationname2/object][associationname3/
object]"
Result: Selects Object 1 and Object 2.
When the OR logical operator is specified, objects must meet the criteria in one of the
specified AssociationPath components to be selected.
Example 3:
• Object 1 has a valid association to associationname1 and associationname2. Object 2
has a valid association to associationname2 and associationname3.
• Query: search="*[associationname2/object] or
[associationname3/object]"
Result: Selects Object 1 and Object 2.
object[not(AssociationName/AssociatedObject)]
object[not(AssociationName/AssociatedObject[AttributeCriteria])]
object[not(AssociationPathLevel1/AssociationPathLeveln)]
The NOT syntax can be specified only for a complete AssociationPath. A syntax error is
returned when the NOT function parameter does not contain the complete
AssociationPath, as shown in these examples:
object[not(AssociationPathLevel)/AssociationPathLevel]
object[AssociationPathLevel/not(AssociationPathLevel)]
The following request finds SASLibrary objects that are missing a UsingPackages
association to a Directory or DatabaseSchema object:
search="SASLibrary[not(UsingPackages/Directory)][not(UsingPackages/DatabaseSchema)]"
The following request finds Property objects that do not have an association to an object.
The use of the * in the next request is valid because the Property metadata type supports
an AssociatedObject association to all metadata types.
search="Property[not(AssociatedObject/*)]"
However, a Property object that is returned by this request does not necessarily represent
an orphaned Property object. A Property object can have a PropertySets association to a
PropertySet, or a PropertyGroups association to a PropertyGroup, instead of being
associated directly with an object.
The following is an example of a search string that specifies two AssociationPathLevel
values:
search="Property[not(AssociatedObject/*/AssociatedFile/File)]"
In this example, the first criteria specifies to return Property objects that are not
associated to a Cube object through the AssociatedObject association and not associated
to a File object through the AssociatedFile association. The second criteria specifies to
return Property objects that are not associated to a PhysicalTable object through the
AssociatedObject association. Because the criteria are concatenated with an implied
AND operator, an object must meet both criteria to be returned.
346 Chapter 17 • Filtering a GetMetadataObjects Request
For an example of a GetMetadataObjects request that specifies the NOT function, see
“Example of Getting Objects That Do Not Have a Specified Association” on page 352.
This request is identical to the preceding request, except that an asterisk is substituted for
the Person object to specify any object in the second path level. The Persons association
supports associations to Person and IdentityGroup objects. Specifying an asterisk in this
position causes the SAS Metadata Server to evaluate IdentityGroup objects and Person
objects in its search.
Each association path is enclosed within a pair of left and right square bracket delimiters.
An object is returned when all path levels of each association path are successfully
searched using the object as the starting point for each search.
This request returns objects that are owned by a Person or IdentityGroup named Joe
Accountant and also have a Reports association to a Report with a name of Sales that
belongs to a Group named Accountant.
348 Chapter 17 • Filtering a GetMetadataObjects Request
The following are examples of search strings that execute common queries:
• Find version 0 or non-versioned objects: <XMLSELECT
search="*[@UsageVersion EQ '0.0']"/>
• Find version 1.0 objects: <XMLSELECT search="*[@UsageVersion EQ
'1000000.0']"/>
• Find version 1.1 objects: <XMLSELECT search="*[@UsageVersion EQ
'1010000.0']"/>
Filtering the Associated Objects That Are Returned by a GetMetadataObjects Request
349
• Find version 1.10 objects: <XMLSELECT search="*[@UsageVersion EQ
'1100000.0']"/>
• Find all major version 1 objects less than or equal to version 1.1: <XMLSELECT
search="*[@UsageVersion GE '1000000.0' and @UsageVersion LE
'1010000.0' ]"/>
• Find all major version 1 objects: <XMLSELECT search="*[@UsageVersion
GE '1000000.0' and @UsageVersion LT '2000000.0']"/>
<AssociationName search="Object[Criteria]"/>
350 Chapter 17 • Filtering a GetMetadataObjects Request
• Object can be an * or a SAS Metadata Model metadata type. The metadata type must
be a valid associated object for the specified <ASSOCIATIONNAME>.
When Object is an *, the GetMetadataObjects method selects for retrieval all
metadata types that are valid for <ASSOCIATIONNAME>, similar to specifying
<ASSOCIATIONNAME/> without search criteria.
When Object is a metadata type, the GetMetadataObjects method gets only
associated objects of the specified metadata type.
• [Criteria] is an attribute criteria specification or an association path specification that
conforms to the syntax documented in “<XMLSELECT search="criteria"/> Syntax”
on page 335. When criteria are specified, GetMetadataObjects gets only associated
objects specified by Object that also meet the specified criteria.
The following is an example of a GetMetadataObjects request that specifies search
criteria on an association name. The request specifies to get Document objects and
ExternalTable objects that are associated with the Document objects through the Objects
association and have the words Human Resources in their Desc attribute.
<GetMetadataObjects>
<Reposid>A0000001.A5DQTZY5</Reposid>
<Type>Document</Type>
<Objects/>
<NS>SAS</NS>
<!-- OMI_GET_METADATA(256) + OMI_TEMPLATE (4) + OMI_ALL_SIMPLE (8) -->
<Flags>268</Flags>
<Options>
<Templates>
<Document>
<Objects search="ExternalTable[@Desc ? 'Human
Resources']"/>
</Document>
</Templates>
</Options>
</GetMetadataObjects>
<Objects>
<Document Id="A5DQTZY5.B9000001" Name="MyDocument" ChangeState=""
Desc="Document object created to do search string tests" LockedBy="" MetadataCreated=
Example of Using <XMLSELECT search="criteria"/> and a Template 351
Two ExternalTable objects that met the selection criteria were found .
to get only associated ResponsibleParty objects that have the Role attribute value of
OWNER.
Here is an example of the output from the request:
<!-- Using the GETMETADATAOBJECTS method. -->
<Objects>
<Document Id="A5DQTZY5. BN000002" Name="2008 New Customers"
ChangeState=" " Desc="New customers in the Southwest Region in 2008" LockedBy=""
MetadataCreated="21Aug2008:21:11:32" MetadataUpdated="21Aug2008:21:11:32"
PublicType="" TextRole= "" TextType="HTML" URI="" URIType=""
UsageVersion="0">
<ResponsibleParties SEARCH="ResponsibleParty[@Role='OWNER']">
<ResponsibleParty Id="A5DQTZY5. BE000004" ChangeState=" " Desc=" " LockedBy=""
MetadataCreated="21Aug2008:21:11:32" MetadataUpdated="21Aug2008:21:11:32"
Name="Manager" Role="Owner" UsageVersion="0"/></ResponsibleParties>
</Document>
</Objects>
One Document object that included the name Customer in the Name attribute was found.
One ResponsibleParty object that had the Role attribute value of OWNER was found.
For more information, see “Understanding Templates” on page 301 and “Creating
Templates for the Get Methods” on page 304.
When there are no orphaned Property objects, the request returns no objects.
353
Chapter 18
Metadata Locking Options
Chapter 19
Deleting Metadata Objects
The purpose of the SAS type dictionary is to hide the details of an object’s logical
metadata definition from clients. You can override the SAS type dictionary by setting
the OMI_TEMPLATE (4) flag, and submitting a user-defined template.
• If the specified metadata type is a PrimaryType subtype and the PublicType attribute
does not have a value, or is a SecondaryType subtype in the SAS Metadata Model,
then only the specified object and any associated objects that have a 1..1 association
to the object are deleted, unless you specify a user-defined template.
An object that is a SecondaryType subtype in the SAS Metadata Model is considered to
be owned by a PrimaryType object, and is thus deleted when the PrimaryType object is
deleted, although it does not have to be. SecondaryType subtypes and PrimaryType
subtypes that do not store a value in the PublicType attribute are treated as independent
objects by the DeleteMetadata method.
DeleteMetadata is typically used to delete one metadata entity at time (logical metadata
definition or independent object). If you want to delete two or more entities, specify
additional property strings in the INMETADATA parameter.
Note: When you specify multiple independent objects, take care not to specify
associated objects that have a 1..1 cardinality in the same DeleteMetadata request. A
1..1 cardinality indicates a required relationship. When one object in the association
is deleted, the metadata server automatically deletes the other object as well. If you
specify the partner object for deletion, the metadata server attempts to locate objects
that have already been deleted, and cancels the Delete operation when they are not
found. You can prevent the operation from being canceled by setting the
OMI_IGNORE_NOTFOUND (134217728) flag, but it is better to avoid specifying
the associated objects instead.
DeleteMetadata does not list the identifiers of associated object instances that are deleted
by default. To include them in the output listing, set the OMI_RETURN_LIST (1024)
flag.
For an example of a DeleteMetadata request that deletes a specified object, see
“DeleteMetadata” on page 94. For information about how to specify a user-defined
template, see “Creating a Template for DeleteMetadata” on page 356.
Purpose
User-defined templates are supported in DeleteMetadata to enable clients to delete
custom logical metadata definitions. A custom logical metadata definition is a logical
metadata definition that meets the following criteria:
• does not use a PrimaryType subtype as its primary object
• uses a PrimaryType subtype as its primary object, but does not store a value in the
PublicType attribute
• uses a PrimaryType subtype and specifies a PublicType value, but you want to delete
a subset of its associations or associated objects
To delete a custom logical metadata definition:
1. Specify the primary or top-level object in the logical metadata definition in the
INMETADATA parameter.
2. Specify the SAS namespace in the NS parameter.
Creating a Template for DeleteMetadata 357
When the OMI_TEMPLATE (4) flag is set, and an appropriate user-defined template is
submitted in the OPTIONS parameter, DeleteMetadata ignores the value in the metadata
object's PublicType attribute if one is found, and deletes the specified associations
instead.
When the second way is used, the INMETADATA property string must specify a
TemplateName attribute with a matching value.
The new template form is useful when you are deleting multiple entities at once. It is
also useful when you want to take advantage of the template attributes. For more
information, see “Template Attributes” on page 303. Also, see “Examples” on page 358.
Otherwise, the legacy template form is more efficient and sufficient for most requests.
Examples
The following example shows how to issue a DeleteMetadata request that submits a
user-defined template using the legacy template form. The specified Group has four
objects associated through the Members association: a PhysicalTable object named “My
Table,” a PhysicalTable object named “Their Table,” a TextStore object named “My
Notes,” and a TextStore object named “Their Notes.” The request specifies to delete the
Group object and all objects associated to it through the Members association. The
request is formatted for the INMETADATA parameter of the DoRequest method:
<DeleteMetadata>
<Metadata>
<Group Id="A5TJRDIT.A1000004" Name="My Group"/>
</Metadata>
<Ns>SAS</Ns>
<!-- OMI_TRUSTED_CLIENT, OMI_TEMPLATE, + OMI_RETURN_LIST -->
<Flags>268436484</Flags>
<Options>
<Templates>
<Group>
<Members/>
</Group>
</Templates>
</Options>
</DeleteMetadata>
</Options>
</DeleteMetadata>
The following example shows how to issue a DeleteMetadata request that submits a
user-defined template using the new template form. This request specifies to delete the
Group object described in the previous example. However, in this request, we specify to
delete the Group object, and its associated My Table and My Notes objects, leaving the
other two objects intact.
<DeleteMetadata>
<Metadata>
<Group Id="A5TJRDIT.A1000004" TemplateName="test"/>
</Metadata>
<Ns>SAS</Ns>
<!-- OMI_TRUSTED_CLIENT, OMI_TEMPLATE, + OMI_RETURN_LIST -->
<Flags>268436484</Flags>
<Options>
<Templates>
<Template TemplateName="test">
<Group>
<Members>
<PhysicalTable match="@Name='My Table'" TemplateExpand="Yes"/>
<PhysicalTable TemplateExpand="No"/>
<TextStore match="@Name='My Notes'" TemplateExpand="Yes"/>
<TextStore TemplateExpand="No"/>
</Members>
</Group>
</Template>
</Templates>
</Options>
</DeleteMetadata>
The Match and TemplateExpand attributes are used to filter the associated objects that
are deleted. TextStore and PhysicalTable objects that do not meet the match criteria are
ignored.
Deleting a Repository
Note: You must have administrative user status on the SAS Metadata Server to
unregister, clear, or delete a repository. For more information about administrative
user status, see the SAS Intelligence Platform: Security Administration Guide.
The DeleteMetadata method call for deleting a repository is similar to a DeleteMetadata
method call for deleting an application metadata, with two exceptions. To delete a
repository, specify the following:
• The REPOS namespace.
• One of several flags that indicate whether you want to delete the whole repository,
simply clear the repository's contents, or you only want to unregister the repository.
Keep in mind the following things when using the REPOS namespace flags:
• You should not unregister or delete the foundation repository if you have other
repositories defined.
• You should not combine REPOS namespace flags in a request.
• Do not attempt to clear the objects from a project repository or delete a project
repository using the DeleteMetadata method. Use SAS Data Integration Studio or
SAS Management Console to clear or delete project repositories. These products
contain extra code to handle locks on objects in non-project repositories that are
related to objects in project repositories.
A repository is unregistered by executing the DeleteMetadata method with the
OMI_TRUSTED_CLIENT (2097152) flag on a repository object in the REPOS
namespace.
Set the OMI_REINIT and the OMI_TRUSTED_CLIENT flags to clear a repository if
you want to repopulate it completely with different metadata.
Set the OMI_DELETE (32) and the OMI_TRUSTED_CLIENT flags to delete a
repository. OMI_DELETE deletes the contents of a repository and removes the whole
registration from the SAS Repository Manager.
361
Recommended Reading
Index