Interface CustomRestrictionPolicyContext
public interface CustomRestrictionPolicyContext
The
CustomRestrictionPolicyContext interface provides access to
information about the running query and the corresponding custom policy.
The following information is available:
- Running query
- Fields of the view or stored procedure involved in the query
- Fields types of the view or stored procedure involved in the query
- User who executes the query and his roles
- User agent who executes the query
- Database where the query is executed
- User or role who is assigned the custom policy to
- View or stored procedure which is assigned the custom policy to
- Platform properties in the context of the query
- User-defined variables in the context of the query
The CustomRestrictionPolicyContext interface also provides a JMX
connection to query VDP Server MBeans and logging capabilities.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumType of the credential which is assigned the custom policy tostatic enumType of the element which is assigned the custom policy tostatic enumSeverity level of the registered events in the log -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringPlatform property which indicates whether the cache is invalidated.static final StringPlatform property which indicates whether the results of this query is used to populate the cache of the executing view.static final StringPlatform property which indicates whether unnamed views should be delegated.static final StringPlatform property which forces a limit on the number of rows obtained even if there is an offset clausestatic final StringPlatform property which defines the internationalization configuration that will be used for the results of the query.static final StringPlatform property which defines a limit on the memory usage of the query in megabytes.static final StringPlatform property which defines a limit on the number of rows obtained from the result set.static final StringPlatform property which defines the maximum time (in milliseconds) the client is prepared to wait for the statement to complete.static final StringPlatform property which indicates whether swapping is enabled for the query.static final StringPlatform property which defines the maximum size (in megabytes) an intermediate result obtained by running this query can reach without swapping to disk.static final StringPlatform property which indicates the user agent used to query the view.static final StringPlatform property which indicates the user name used to query the view instead of the one you have used to connect to the VDP Server. -
Method Summary
Modifier and TypeMethodDescriptionReturns a map with extra authentication information, if it was provided by the authentication mechanism or an empty map if no information was provided.Returns the name of the database to which the client application is connected.Returns the user agent who executes the queryReturns the name of the user who executes the queryReturns the names of all the roles assigned to the user who executes the query.Return the implementation of the interface which defines utility methods accessible from the policy, and used to communicate with the VDP server.Returns the name of the database of the element to which the policy is assigned.Returns the name of the element which is assigned the custom policy toReturns a collection with the assigned tags to the element.Returns the type of the element which is assigned the custom policy toReturns the set of fields in the view or stored procedure involved in the query.Returns a map with the assigned tags to the fields from the element.Returns a map with the name of the type for each field from the element.Returns a JMX connection to query VDP Server MBeansReturns the name of the credential which is assigned the custom policy toReturns the type of the credential which is assigned the custom policy togetProperty(String name) Returns a textual representation of the value of a platform property present in the context of the query.getQuery()Returns the running querygetVariable(String name) Returns a textual representation of the value of a user-defined variable that is present in the context of the query.booleanisIncompatibleWithQuery(String condition) Checks if the given condition is incompatible with the condition specified on a query over the view affected by this policybooleanChecks if the specified level is enabled.voidlog(CustomRestrictionPolicyContext.LogLevel level, String logMessage) Registers an event in the log of the VDP Server with the specified level.voidsetProperty(String name, String value) Sets the value of a platform property that is used in the context of the query.voidsetVariable(String name, String value) Sets the value of a user-defined variable in the context of the query.
-
Field Details
-
CACHE_INVALIDATE_PROPERTY
Platform property which indicates whether the cache is invalidated. This property can take the following values:true,false.- See Also:
-
CACHE_PRELOAD_PROPERTY
Platform property which indicates whether the results of this query is used to populate the cache of the executing view. This property can take the following values:true,false.- See Also:
-
DELEGATE_UNNAMED_VIEWS_PROPERTY
Platform property which indicates whether unnamed views should be delegated. By default, unnamed views are delegated if possible unless they have a subview with cache enabled. This property can take the following values:yes,no.- See Also:
-
I18N_PROPERTY
Platform property which defines the internationalization configuration that will be used for the results of the query. This property takes the name of a valid internationalization configuration as a value (e.g.es_euro).- See Also:
-
QUERY_LIMIT_PROPERTY
Platform property which defines a limit on the number of rows obtained from the result set. This property takes a positive integer as a value.- See Also:
-
FORCE_STRICT_QUERY_LIMIT_PROPERTY
Platform property which forces a limit on the number of rows obtained even if there is an offset clause- See Also:
-
QUERY_TIMEOUT_PROPERTY
Platform property which defines the maximum time (in milliseconds) the client is prepared to wait for the statement to complete. This property takes a positive long integer as a value.- See Also:
-
SWAP_PROPERTY
Platform property which indicates whether swapping is enabled for the query. This property can take the following values:on,off.- See Also:
-
SWAP_SIZE_PROPERTY
Platform property which defines the maximum size (in megabytes) an intermediate result obtained by running this query can reach without swapping to disk. This property takes a positive integer as a value.- See Also:
-
USER_NAME_PROPERTY
Platform property which indicates the user name used to query the view instead of the one you have used to connect to the VDP Server. This property is only taken into account when the data source has been created with the clauseWITH PASS-THROUGH SESSION CREDENTIALS. This property takes a valid user name for the data source as a value.- See Also:
-
USER_AGENT_PROPERTY
Platform property which indicates the user agent used to query the view.- See Also:
-
MEMORY_LIMIT_PROPERTY
Platform property which defines a limit on the memory usage of the query in megabytes. This property takes a positive integer as a value or zero to set no limit.- See Also:
-
-
Method Details
-
getCurrentUserName
String getCurrentUserName()Returns the name of the user who executes the query- Returns:
- the name of the user who executes the query
-
getCurrentUserAgent
String getCurrentUserAgent()Returns the user agent who executes the query- Returns:
- the user agent who executes the query
-
getAdditionalAuthenticationInformation
Returns a map with extra authentication information, if it was provided by the authentication mechanism or an empty map if no information was provided.
For each entry of the map:- The key is a
Stringthat represents the name of the attribute. - The value(which can be
NULL) is an Object value that can encapsulate one of the following types:BooleanStringNumberList<Object>Map<String, Object>
- Returns:
- a Map<String, Object> which encapsulates authentication attributes.
- The key is a
-
getCurrentUserRoles
-
getCurrentDatabaseName
String getCurrentDatabaseName()Returns the name of the database to which the client application is connected.This can be different from the database of the queried view. For example, if the client application establishes the connection with the database
adminbut executes the querySELECT * FROM customer360.customer, this method will returnadmin, notcustomer360.- Returns:
- the name of the database to which the client application is connected
-
getElementDatabase
String getElementDatabase()Returns the name of the database of the element to which the policy is assigned.- Returns:
- the name of the database of the element to which the policy is assigned
-
getPolicyCredentialsName
String getPolicyCredentialsName()Returns the name of the credential which is assigned the custom policy to- Returns:
- the name of the credential which is assigned the custom policy to
-
getPolicyCredentialsType
CustomRestrictionPolicyContext.CredentialsType getPolicyCredentialsType()Returns the type of the credential which is assigned the custom policy to- Returns:
- the type of the credential which is assigned the custom policy to
-
getElementName
String getElementName()Returns the name of the element which is assigned the custom policy to- Returns:
- the name of the element which is assigned the custom policy to
-
getElementType
CustomRestrictionPolicyContext.ElementType getElementType()Returns the type of the element which is assigned the custom policy to- Returns:
- the type of the element which is assigned the custom policy to
-
getQuery
-
getFieldsInQuery
-
getFieldTypeNames
-
getJmxConnection
JmxConnection getJmxConnection()Returns a JMX connection to query VDP Server MBeans- Returns:
- a JMX connection to query VDP Server MBeans
-
getProperty
Returns a textual representation of the value of a platform property present in the context of the query.- Parameters:
name- the name of the platform property. The following properties are supported:- Returns:
- a textual representation of the value of a platform property present in the context of the query or null if the property is not present
- Throws:
IllegalArgumentException- ifnameis not a supported property name
-
setProperty
Sets the value of a platform property that is used in the context of the query.- Parameters:
name- the name of the platform property. The following properties are supported:value- a textual representation of the value of the platform property- Throws:
IllegalArgumentException- ifnameis not a supported property nameIllegalArgumentException- ifvalueis not a valid value for the property
-
getVariable
Returns a textual representation of the value of a user-defined variable that is present in the context of the query.- Parameters:
name- the name of the user-defined variable.- Returns:
- a textual representation of the value of a user-defined variable in the context of the query or null if the variable is not present
-
setVariable
-
isIncompatibleWithQuery
Checks if the given condition is incompatible with the condition specified on a query over the view affected by this policy- Parameters:
condition- condition to check- Returns:
- true if the given condition is incompatible with the condition specified on a query over
the view affected by this policy
false otherwise - Throws:
ConditionEvaluationException- if the condition is invalid. For example, it is syntactically incorrect.
-
log
Registers an event in the log of the VDP Server with the specified level.- Parameters:
level- the severity level of the eventlogMessage- the message to be logged
-
isLogLevelEnabled
Checks if the specified level is enabled.- Parameters:
level- the log level to check- Returns:
- boolean -
trueif the specified level is enabled,falseotherwise.
-
getElementTags
Collection<String> getElementTags()Returns a collection with the assigned tags to the element.- Returns:
- a collection with the assigned tags to the element.
-
getFieldsTags
Map<String, Collection<String>> getFieldsTags()Returns a map with the assigned tags to the fields from the element.- Returns:
- a map with the assigned tags to the fields from the element.
-
getDatabaseEnvironment
DatabaseEnvironment getDatabaseEnvironment()Return the implementation of the interface which defines utility methods accessible from the policy, and used to communicate with the VDP server.- Returns:
- the implementation of the interface which defines utility methods accessible from the policy, and used to communicate with the VDP server.
-