Package org.iam.policy.model
Class MCPPolicy
java.lang.Object
org.iam.policy.grammer.Policy
org.iam.policy.model.MCPPolicy
- All Implemented Interfaces:
MCPVar
MCPPolicy extends Policy and implements MCPVar for symbolic encoding.
Represents a policy as a symbolic MCPBitVector, supporting allow/deny statements, symbolic initialization, and computation of the policy's symbolic node.
- Since:
- 2025-02-28
- Author:
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.mcp.core.MCPFactoryReturns the MCPFactory used by all MCPPolicy instances.org.mcp.core.MCPBitVectorReturns the symbolic encoding node for this policy.org.mcp.core.MCPBitVectorComputes and returns the symbolic encoding node for this policy.voidInitializes the MCPFactory with domain variables from allow and deny statements.static voidsetMCPFactory(org.mcp.core.MCPFactory mcpFactory) Sets the MCPFactory for all MCPPolicy instances.toString()Returns a string representation of this MCPPolicy.Methods inherited from class org.iam.policy.grammer.Policy
equals, getId, getStatement, getVersion, hashCode, setId, setStatement, setVersion
-
Constructor Details
-
MCPPolicy
Constructs an MCPPolicy from a Policy object. Separates allow and deny statements, sets up symbolic factories, and computes the symbolic node.- Parameters:
policy- the Policy to convert- Throws:
AssertionError- if the MCPFactory has not been set
-
-
Method Details
-
setMCPFactory
public static void setMCPFactory(org.mcp.core.MCPFactory mcpFactory) Sets the MCPFactory for all MCPPolicy instances.- Parameters:
mcpFactory- the MCPFactory to use
-
getMCPFactory
public static org.mcp.core.MCPFactory getMCPFactory()Returns the MCPFactory used by all MCPPolicy instances.- Returns:
- the MCPFactory
-
getMCPNode
public org.mcp.core.MCPBitVector getMCPNode()Returns the symbolic encoding node for this policy.- Returns:
- the MCPBitVector node
-
initialMCPFactory
public void initialMCPFactory()Initializes the MCPFactory with domain variables from allow and deny statements.- Specified by:
initialMCPFactoryin interfaceMCPVar
-
getMCPNodeCalculation
public org.mcp.core.MCPBitVector getMCPNodeCalculation()Computes and returns the symbolic encoding node for this policy. The result is the union of allow statements minus the union of deny statements.- Specified by:
getMCPNodeCalculationin interfaceMCPVar- Returns:
- the MCPBitVector node for this policy
- Throws:
AssertionError- if the MCPFactory has not been set
-
toString
Returns a string representation of this MCPPolicy.
-