%ZHSLIB.PackageManager.Core.Singleton

abstract class %ZHSLIB.PackageManager.Core.Singleton extends %Library.RegisteredObject

General class to extend to add a "singleton" interface to any registered or persistent class. For persistent classes, requires that the class has a unique index defined on a read-only property with an InitialExpression.

Property Inventory (Including Private)

Method Inventory (Including Private)

Parameters

parameter NAMESPACESCOPE = 0;
If set to 1, calls to %Get must return an instance of this class created in the current namespace; a new instance will be created if none exists.
parameter PPG = ^||%ZHSLIB.Singleton;
PPG in which to track references to the instance of this class

Properties

property %namespace as %String [ Private , InitialExpression = $Namespace , Transient ];
Internal property to track the namespace in which this instance was created.
Property methods: %namespaceDisplayToLogical(), %namespaceGet(), %namespaceIsValid(), %namespaceLogicalToDisplay(), %namespaceLogicalToOdbc(), %namespaceNormalize(), %namespaceSet()

Methods

final classmethod %Get(Output pSC As %Status) as %ZHSLIB.PackageManager.Core.Singleton [ Language = objectscript ]
Return the single per-process/namespace instance of this class, or create a new one. For persistent classes, may open the existing single record by its unique index.
private method %OnClose() as %Status [ Language = objectscript ]
Removes the OREF of this instance from PPG. Subclasses of %ZHSLIB.PackageManager.Core.Singleton that override this method *MUST* call ##super().
private method %OnNew() as %Status [ Language = objectscript ]
Tracks the OREF of this instance in a PPG for later reference. Subclasses of %ZHSLIB.PackageManager.Core.Singleton that override this method *MUST* call ##super().
private classmethod GetInMemoryInstance() as %ZHSLIB.PackageManager.Core.Singleton [ Language = objectscript ]
This method finds the existing instance of an object of a current class (created in the namespace if ..#NAMESPACESCOPE is 1) if it exists in the current process. Exceptions are caught by calling code.

Inherited Members

Inherited Methods (Including Private)

Feedback