Skip to main content

Config.Namespaces

Class Config.Namespaces Extends (%Persistent, Config.CommonMultipleMethods, Config.CommonProperties, %SYSTEM.Help) [ Final, Inheritance = right, System = 4 ]

This class allows you to modify and view the [Namespaces] section of the CPF file through programatic APIs. While properties are usually modified through the System Management portal, there may be some occasion where modifying them through the API's is best for your system. In all the Config methods, if you do not specify the CPFFile parameter, the currently active CPF file is used. If you wish to modify a CPF file which is not the currently active one, then specify the CPFFile you wish to modify in the method call.
The Flags parameter does not normally need to be specified; the defaults are usually sufficient for most cases.
You can use either the provided API's (Create/Get/Modify/Delete) to modify the properties by passing in the correct parameters, or use Object syntax to open and directly manipulate the config objects (Open() and Exists()). Most objects created here need only to specify the Name of the object, and 1 or 2 properties since the the defaults are what are commonly used for most cases.

EXAMPLE:

; Use class methods to create an instance %SYS>s Name="ABC" %SYS>s Properties("Globals")="USER" %SYS>s Status=##Class(Config.Namespaces).Create(Name,.Properties) %SYS>i 'Status w !,"Error="$SYSTEM.Status.GetErrorText(Status) ; Use class methods to modify properties %SYS>s Status=##Class(Config.Namespaces).Get(Name,.Properties) %SYS>i 'Status w !,"Error="$SYSTEM.Status.GetErrorText(Status) %SYS>zw Properties Properties("Globals")="USER" Properties("Library")="IRISLIB" Properties("Routines")="USER" Properties("SysGlobals")="IRISSYS" Properties("SysRoutines")="IRISSYS" Properties("TempGlobals")="IRISTEMP" %SYS>s Properties("Globals")="SAMPLES" %SYS>s Status=##Class(Config.Namespaces).Modify(Name,.Properties) %SYS>i 'Status w !,"Error="$SYSTEM.Status.GetErrorText(Status) ; Now use Objects to modify properties %SYS>s Obj=##Class(Config.Namespaces).Open(Name) ; We could have used i ##Class(Config.Namespaces).Exists(Name,.Obj) instead of Open() %SYS>w Obj.Globals SAMPLES %SYS>s Obj.Routines="USER" %SYS>s Status=Obj.%Save() %SYS>i 'Status w !,"Error="$SYSTEM.Status.GetErrorText(Status) ; Now delete the object we just created %SYS>s Status=##Class(Config.Namespaces).Delete(Name) %SYS>i 'Status w !,"Error="_$SYSTEM.Status.GetErrorText(Status)

Parameters

CPFFlags

Parameter CPFFlags [ Internal ] = {1};

{$$$CPFSave};

CAPITALNAME

Parameter CAPITALNAME = 1;

Namespace name is always capitalized.

EMSSERVICE

Parameter EMSSERVICE [ Internal ] = "Namespace";

SYSTEMDATABASES

Parameter SYSTEMDATABASES [ Internal ] = ",IRISSYS,IRISLIB,IRISTEMP,IRISLOCALDATA,IRISAUDIT,ENSLIB,IRISMETRICS,";

JO3095: List of system database names

Properties

Globals

Property Globals As %String(MAXLEN = 64, MINLEN = 1) [ Required ];

Default database for globals.

Library

Property Library As %String(MAXLEN = 64, MINLEN = 1) [ InitialExpression = "IRISLIB", Internal, Required ];

Default database for system library routines.

Routines

Property Routines As %String(MAXLEN = 64, MINLEN = 1) [ Required ];

Default database for routines.

SysGlobals

Property SysGlobals As %String(MAXLEN = 64, MINLEN = 1) [ InitialExpression = "IRISSYS", Internal, Required ];

Default database for system globals.

SysRoutines

Property SysRoutines As %String(MAXLEN = 64, MINLEN = 1) [ InitialExpression = "IRISSYS", Internal, Required ];

Default database for system routines.

TempGlobals

Property TempGlobals As %String(MAXLEN = 64, MINLEN = 1) [ InitialExpression = "IRISTEMP", Required ];

Default database for temporary globals.

Interop

Property Interop As %Boolean [ InitialExpression = 0, Transient ];

Enable interoperability.

Methods

GlobalsSet

Method GlobalsSet(Val) As %Status [ Internal ]

Force the Globals name to be uppercase.

LibrarySet

Method LibrarySet(Val) As %Status [ Internal ]

Force Library name to be uppercase.

NameSet

Method NameSet(Val) As %Status [ Internal ]

Force the Namespace name to be uppercase.

RoutinesSet

Method RoutinesSet(Val) As %Status [ Internal ]

Force the Routines name to be uppercase.

SysGlobalsSet

Method SysGlobalsSet(Val) As %Status [ Internal ]

Force the system globals to be uppercase.

SysRoutinesSet

Method SysRoutinesSet(Val) As %Status [ Internal ]

Force the system routines name to be uppercase.

TempGlobalsSet

Method TempGlobalsSet(Val) As %Status [ Internal ]

Force the temporary globals name to be uppercase.

Copy

ClassMethod Copy(SourceNamespace, DestinationNamespace, CPFFile As %String = "", Flags As %Integer = 0, CopyMappings As %Boolean = 1) As %Status [ Internal ]

Copy a namespace to new namespace including mappings, and activate them.
Parameters:
SourceNamespace - Namespace to copy.
DestinationNamespace - New namespace to copy to.
CPFFile - Name of the CPF file to copy mappings in, "" = active CPF file.
Flags - Not used.
CopyMappings - Whether to call CopyMaps. 1 by default. (0 for SMP page because mappings are copied in the background.)

CopyMaps

ClassMethod CopyMaps(SourceNamespace, DestinationNamespace, CPFFile As %String = "", Flags As %Integer = 0) As %Status [ Internal ]

Copy all mapping from a namespace to another namespace, and activate them.
Parameters:
SourceNamespace - Source of the namespace mappings to copy.
DestinationNamespace - namespace to copy mappings to. Namespace must already exist.
CPFFile - name of the CPF file to copy mappings in.

CreateCallBack

ClassMethod CreateCallBack(Obj As %ObjectHandle, Data As %String) As %Status [ Internal ]

Called by the Create method during import from a CPF file.

Default

ClassMethod Default(CPFFile As %String, Platform As %String) As %Status [ Internal ]

Write a default Namespaces section in a CPF file.
This method assumes that a CPF file has been opened, and that a U CPFFile command has been executed before this is called.

NamespacesByDB

ClassMethod NamespacesByDB(Name As DBName, ByRef NspList As %String, CheckSynonyms As %Boolean = 1, ByRef Mappings As %String, CPFFile As %String = "", Flags As %Integer = 0) As %Status [ Internal ]

Returns a list of namespaces that reference a given database.
If CheckSynonyms is true, the search is also performed for all datasets that reference the same .DAT file. Otherwise, the search is only performed for the given datset name.
If Mappings is defined and different than zero, then the following array is returned in addition: When Mappings value is 1, it returned the mappings for the namespaces DO NOT include the database for its definition. When Mappings value is 2, it also returned the mappings for the namespaces include the database for its definition. When Mappings value is 3, only check against default routine and default global database, and don't return mappings. Mappings(,"GBL",,)="" Mappings(,"RTN",,)="" Mappings(,"CLS",,)=""

NamespacesByDir

ClassMethod NamespacesByDir(Server As %String = "", Directory As %String, Flags As %Integer = 1, ByRef Namespaces As %String) As %Status [ Internal ]

Return a list of namespaces which contain the database in its mappings.
Parameters:
Server - ECP Server where the directory resides. Default = "" (Local system)
Directory - Directory where the database resides
Flags = 1 - Check only default global and default routine database for each namespace
Flags = 2 - Check all databases and mappings for each namespace
Return values:
Namespaces(Name)=""
Note: This function is useful for taking an implied namespace, and determining which namespaces reference its database. For example, given an implied namespace of nsp="^^C:\iris\mgr\" (Manager directory), NamespacesByDir($p(nsp,"^",1),$p(nsp,"^,3),1,.Namespaces) will return Namespaces("%SYS").
Note that if a Server is specified, then the Directory specified must be in the same case as defined on the server as no directory normalization is performed for remote databases.

Load

ClassMethod Load(Obj As %ObjectHandle = "", Flags As %Integer = 1) As %Status [ Internal ]

Load the parameters into memory and activate.
Parameters:
Obj = Handle to the object which caused the load. If "", then load everything, only called from STU.
If a delete operation, then Obj is the namespace of the item which was deleted since the oject itself has already been deleted. Note that Obj can either be a Config.Namespace object or a Config.Map* object.
Flags = Type of modification.
0 - Modify
1 - Create/Insert
2 - Delete

LoadMappings

ClassMethod LoadMappings(Namespace = "") As %Status [ Internal, Private ]

Build the ^SYS("NSMAP") global based on the ^CONFIG global.

Filter

ClassMethod Filter() As %Status [ Internal ]

Filter out any mappings in ^CONFIG which do not point at a system database if user defined mappings are not licensed

CreateOne

ClassMethod CreateOne(ByRef Properties As %String) As %Status [ Internal ]

In order to enable interoperability, we have to force a save of this resource now (rather than wait until completion of [Actions] processing)

ModifyOne

ClassMethod ModifyOne(ByRef Properties As %String) As %Status [ Internal ]

In order to enable interoperability, we have to force a save of this resource now (rather than wait until completion of [Actions] processing)

ActivateAll

ClassMethod ActivateAll() As %Status [ Internal ]

Activate All NameSpaces mapping from the ^SYS("NSMAP") global.

ActivateOne

ClassMethod ActivateOne(Namespace) As %Status [ Internal ]

Activate one specific NameSpace mapping from the ^SYS("NSMAP") global.

%OnDeleteCallBack

ClassMethod %OnDeleteCallBack(Obj As %ObjectHandle) As %Status [ Internal ]

Called from %Delete().
Any error returned here will keep the object from being deleted.

%OnAfterActivateCallback

ClassMethod %OnAfterActivateCallback(Obj As %ObjectHandle, Flags As %Integer) As %Status [ Internal ]

Called by CommonMethods.Activate()

MoveToActive

ClassMethod MoveToActive(Obj As %ObjectHandle = "", Flags As %Integer = 1) As %Status [ Internal ]

Move the CPF data into the active config global. This also check if any namespace is added/removed/updated in CPF file since last shutdown.

Parameters:
Namespace - Placeholder for Map classes. Pass as "".

Rename

ClassMethod Rename(OldNamespace, NewNamespace, CPFFile As %String = "", Flags As %Integer = 0) As %Status [ Internal ]

Rename a namespace to new namespace including mappings, and activate them.
Parameters:
OldNamespace - Namespace to rename.
NewNamespace - New namespace to copy to.
CPFFile - Name of the CPF file to copy mappings in, "" = active CPF file.

%OnValidateObject

Method %OnValidateObject() As %Status [ Internal ]

This is called from %Save().
Any error returned from this will cause the object to not be saved.

ListExecute

ClassMethod ListExecute(ByRef %qHandle As %Binary, Names As %String = "*", CPFFile As %String = "", Flags As %Integer = 0, Format As %Integer = 0) As %Status [ Internal ]

List Namespaces in a CPF file.

Parameters:
Names - Comma separated list of Namespace names
"*" - All records match
"String,String1" - Any records matching one of these elements
"String*" - Any record starting with "String"
"String,String1*,String2" - Any record matching one of these elements, or starting with "String1"
CPFFile - Name of the CPF file to use. A null string means use the active CPF file.
Flags - Currently ignored.
Format
0 - Standard report list format
1 - ^CONFIG global format
2 - CPF file format format
Note: This query may change in future versions

ListFetch

ClassMethod ListFetch(ByRef %qHandle As %Binary, ByRef Row As %List, ByRef AtEnd As %Integer = 0) As %Status [ Internal, PlaceAfter = ListExecute ]

ListClose

ClassMethod ListClose(ByRef %qHandle As %Binary) As %Status [ Internal, PlaceAfter = ListExecute ]

ListFilterExecute

ClassMethod ListFilterExecute(ByRef qHandle As %Binary, Filter As %String = "", CPFFile As %String = "", Flags As %Integer = 0, Format As %Integer = 0) As %Status [ Internal ]

List Namespaces in a CPF file.

Parameters:
Filter - Filter to select columns
CPFFile - Name of the CPF file to use. A null string means use the active CPF file.
Flags - Currently ignored.
Format
0 - Standard report list format
1 - ^CONFIG global format
2 - CPF file format format
Note: This query may change in future versions

ListFilterFetch

ClassMethod ListFilterFetch(ByRef qHandle As %Binary, ByRef Row As %List, ByRef AtEnd As %Integer = 0) As %Status [ Internal, PlaceAfter = LocalDatabaseListExecute ]

ListFilterClose

ClassMethod ListFilterClose(ByRef qHandle As %Binary) As %Status [ Internal, PlaceAfter = LocalDatabaseListExecute ]