Class DefaultGlobalContext
- All Implemented Interfaces:
GlobalContext
GlobalContext interface and is already
deployed at the Permissioning Auth Module.
The methods of this class allow the Permissioning Auth Module to add data to the GlobalContext and to
remove data from the GlobalContext. A custom SubjectMapper can also call one of the get() methods of this class to retrieve data from the
GlobalContext.
You can also write a custom class that extends DefaultGlobalContext to provide additional methods
that a custom SubjectMapper can call. If you write a custom GlobalContext, the class must
be available on the classpath of the Permissioning Auth Module. It does not need to be deployed on the classpath of
the PermissioningDataSource, as the
PermissioningDataSource never loads the GlobalContext.
The document Caplin Xaqua: How To Create A Permissioning DataSource describes how to write, deploy, and
configure a custom GlobalContext, and is included in the Permissioning DataSource kit.
The Global Context and Multiple Permissioning DataSources
Note that there is only one GlobalContext at the Permissioning Auth Module, either the
DefaultGlobalContext or a custom GlobalContext, and it is shared by every
PermissioningDataSource. Therefore if you have more than one PermissioningDataSource, make sure
they do not overwrite each other's data.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns theMapof key-value pairs that are saved for the passed inidentifier.Returns the value that is saved for the passed inidentifierandkey.voidRemoves from theGlobalContext, the passed inidentifierand theMapof key-value pairs for thatidentifier.voidSaves the passed inidentifieranddata, and makes the data available to theget()methods of this interface.
-
Field Details
-
data
-
-
Constructor Details
-
DefaultGlobalContext
public DefaultGlobalContext()Creates a new emptyDefaultGlobalContext.
-
-
Method Details
-
update
Saves the passed inidentifieranddata, and makes the data available to theget()methods of this interface.If data has already been saved for this
identifier, the method adds the key-value pairs indatato the saved data. If a key indatahas already been saved for thisidentifier, the new value for the key replaces the old value.The method is called by the Permissioning Auth Module when data for the
GlobalContextis received from aPermissioningDataSource. APermissioningDataSourcesends theidentifieranddatato the Permissioning Auth Module when it callsupdateGlobalContext()as part of a transaction.- Specified by:
updatein interfaceGlobalContext- Parameters:
identifier- AStringthat identifies the passed indata.data- AMapof key-value pairs for the passed inidentifier.
-
get
Returns theMapof key-value pairs that are saved for the passed inidentifier. This method is typically called by themapSubject()method of a customSubjectMapper.- Specified by:
getin interfaceGlobalContext- Parameters:
identifier- AStringthat identifies theMapto be returned.- Returns:
- the
Mapof key-value pairs for the passed inidentifier, ornullif noMaphas been saved for thisidentifier.
-
get
Returns the value that is saved for the passed inidentifierandkey. This method is typically called by themapSubject()method of a customSubjectMapper.A call to this method is equivalent to calling
get(identifier), and then callingget(key)on the returnedMapof key-value pairs.- Specified by:
getin interfaceGlobalContext- Parameters:
identifier- AStringthat identifies theMapof key-value pairs.key- A key that identifies the value to be returned.- Returns:
- the value that is saved for the passed in
identifierandkey, ornullif no value has been saved for thisidentifierandkey.
-
remove
Removes from theGlobalContext, the passed inidentifierand theMapof key-value pairs for thatidentifier. This method is called by the Permissioning Auth Module when aPermissioningDataSourcecallsremoveGlobalContextData()as part of a transaction.The method does not remove any data from the GlobalContext if there is no Map for this identifier.
- Specified by:
removein interfaceGlobalContext- Parameters:
identifier- AStringthat identifies theMapto be removed
-