public interface PolicyResolution
When ModelExplorer is used to implement this interface, it must be ensured that all
OrgModelExceptions are caught! If an OrgModelException is caught,
checkSyntax(String, boolean, boolean) and
checkResolvability(SessionToken, String, boolean, boolean) should just return
false whereas all other methods should throw a PolicyResolutionException in
response.
This policy resolution allows for extending the normal policy resolution by the means to
dynamically register org policy script handlers at runtime additionally to the corresponding
registered plugins. Note that an existing plugin will be preferred to a dynamically registered
OrgPolicyScriptService and this to a dynamically registered
OrgPolicyScriptHandler.
| Modifier and Type | Method and Description |
|---|---|
OrgPolicyReport |
checkResolvability(SessionToken session,
java.lang.String orgPolicy,
boolean createFullReport,
boolean rejectParameterReferences)
Tests whether the given OrgPolicy is resolvable for the current state of
the OrgModel.
|
OrgPolicyReport |
checkSyntax(java.lang.String orgPolicy,
boolean createFullReport,
boolean rejectParameterReferences)
This method checks whether the syntax of the given OrgPolicy is correct.
|
boolean |
isMember(SessionToken session,
long orgPositionID,
java.lang.String orgPolicy)
Semantically this method tests whether the given OrgPosition appears in the
result list of
resolvePolicy(SessionToken, String) for the
specified OrgPolicy. |
boolean |
isMember(SessionToken session,
long orgPositionID,
java.lang.String agentUserName,
java.lang.String orgPolicy)
Semantically this method tests whether the given tuple of Agent and
OrgPosition is contained in the result list of
resolvePolicy(SessionToken, String) for the specified OrgPolicy. |
boolean |
isMember(SessionToken session,
java.lang.String agentUserName,
java.lang.String orgPolicy)
Semantically this method tests whether the given Agent appears in the
result list of
resolvePolicy(SessionToken, String) for the specified OrgPolicy. |
boolean |
registerOrgPolicyHandler(SessionToken session,
java.lang.String scriptType,
OrgPolicyScriptHandler handler,
boolean replace)
Registers the designated org policy script handler for the designated script type.
|
java.util.List<java.net.URI[]> |
registerOrgPolicyScriptService(SessionToken session,
java.lang.String scriptType,
java.net.URI[] orgPolicyScriptService,
boolean replace,
boolean append)
Registers the
OrgPolicyScriptService for the designated script type. |
java.util.Set<QualifiedAgent> |
resolvePolicy(SessionToken session,
java.lang.String orgPolicy)
Resolves an OrgPolicy and returns all matching tuples of OrgPositions and
Agents (or rather their IDs) as a list of
QualifiedAgents. |
RemoteIterator<java.util.List<QualifiedAgent>> |
resolvePolicyIterator(SessionToken session,
java.lang.String orgPolicy)
The same as
resolvePolicy(SessionToken, String) but with
partial retrieval of the qualified agents. |
boolean |
unregisterOrgPolicyHandler(SessionToken session,
java.lang.String scriptType,
OrgPolicyScriptHandler handler)
Unregisters the org policy script handler for the designated script type from this policy
resolution.
|
java.util.List<java.net.URI[]> |
unregisterOrgPolicyScriptService(SessionToken session,
java.lang.String scriptType,
java.net.URI[] orgPolicyScriptService)
Unregisters the
OrgPolicyScriptService for the designated script type from this policy
resolution. |
OrgPolicyReport checkSyntax(java.lang.String orgPolicy, boolean createFullReport, boolean rejectParameterReferences)
checkResolvability(SessionToken, String, boolean, boolean).
For a complete list of what is tested, see
OrgPolicyParser.parse(String, OrgPolicyReport, de.aristaflow.adept2.core.orgmodelmanager.parser.TokenInfoContainer).
orgPolicy - the OrgPolicy to be checkedcreateFullReport - if false only the
overall result will be
set (OrgPolicyReport.ResultType#OK or
OrgPolicyReport.ResultType#ERROR)rejectParameterReferences - whether parameter references should be
treated as errorsoverall result will be
setOrgPolicyReport checkResolvability(SessionToken session, java.lang.String orgPolicy, boolean createFullReport, boolean rejectParameterReferences) throws DataSourceException
checkSyntax(String, boolean, boolean).
Additionally to what checkSyntax(String, boolean, boolean) checks, this
parse method will...
session - The session which is used to check for access rights on this
method.orgPolicy - the OrgPolicy to be checkedcreateFullReport - if false only the
overall result will be
set (OrgPolicyReport.ResultType#OK or
OrgPolicyReport.ResultType#ERROR)rejectParameterReferences - whether parameter references should be
treated as errorsoverall result will be
setDataSourceException - when an unrecoverable error occurs while
accessing the data sourcejava.util.Set<QualifiedAgent> resolvePolicy(SessionToken session, java.lang.String orgPolicy) throws PolicyResolutionException, DataSourceException
QualifiedAgents.session - The session which is used to check for access rights on this
method.orgPolicy - the OrgPolicy (Bearbeiterformel) that is be resolvedQualifiedAgentsPolicyResolutionException - when the provided OrgPolicy is
syntactically or semantically incorrect (this is a runtime
exception)DataSourceException - when an unrecoverable error occurs while
accessing the data sourceRemoteIterator<java.util.List<QualifiedAgent>> resolvePolicyIterator(SessionToken session, java.lang.String orgPolicy) throws PolicyResolutionException, DataSourceException
resolvePolicy(SessionToken, String) but with
partial retrieval of the qualified agents.session - The session which is used to check for access rights on this
method.orgPolicy - the OrgPolicy (Bearbeiterformel) that is be resolvedQualifiedAgents as iteratorPolicyResolutionException - when the provided OrgPolicy is
syntactically or semantically incorrect (this is a runtime
exception)DataSourceException - when an unrecoverable error occurs while
accessing the data sourceboolean isMember(SessionToken session, long orgPositionID, java.lang.String orgPolicy) throws PolicyResolutionException, DataSourceException
resolvePolicy(SessionToken, String) for the
specified OrgPolicy. However, this doesn't mean that the actual
implementation really will or has to call
resolvePolicy(SessionToken, String).session - The session which is used to check for access rights on this
method.orgPositionID - the OrgPosition's ID to be checked against the
OrgPolicyorgPolicy - the OrgPolicy to be resolvedPolicyResolutionException - when the provided OrgPolicy is
syntactically or semantically incorrectDataSourceException - when an unrecoverable error occurs while
accessing the data sourceboolean isMember(SessionToken session, java.lang.String agentUserName, java.lang.String orgPolicy) throws PolicyResolutionException, DataSourceException
resolvePolicy(SessionToken, String) for the specified OrgPolicy.
However, this doesn't mean that the actual implementation really will or
has to call resolvePolicy(SessionToken, String).session - The session which is used to check for access rights on this
method.agentUserName - the (unique) Agent's username to be checked against
the OrgPolicyorgPolicy - the OrgPolicy to be resolvedPolicyResolutionException - when the provided OrgPolicy is
syntactically or semantically incorrectDataSourceException - when an unrecoverable error occurs while
accessing the data sourceboolean isMember(SessionToken session, long orgPositionID, java.lang.String agentUserName, java.lang.String orgPolicy) throws PolicyResolutionException, DataSourceException
resolvePolicy(SessionToken, String) for the specified OrgPolicy. However, this
doesn't mean that the actual implementation really will or has to call
resolvePolicy(SessionToken, String).session - The session which is used to check for access rights on this
method.orgPositionID - the OrgPosition's ID to be checked against the
OrgPolicyagentUserName - the (unique) Agent's username to be checked against
the OrgPolicyorgPolicy - the OrgPolicy to be resolvedPolicyResolutionException - when the provided OrgPolicy is
syntactically or semantically incorrectDataSourceException - when an unrecoverable error occurs while
accessing the data sourcejava.util.List<java.net.URI[]> registerOrgPolicyScriptService(SessionToken session, java.lang.String scriptType, java.net.URI[] orgPolicyScriptService, boolean replace, boolean append)
OrgPolicyScriptService for the designated script type. If there is
already a service registered for the designated script type, the designated service will be
either be ignored, replace all existing org policy script services or be appended at the end of
the list of known services. Note that registering/appending many org policy services may lead to slow policy resolution. This in turn may lead to aborted connection for requests that require a policy resolution – which a lot of requests do.
session - The session for checking access rights.scriptType - The type of the script for which to register an org policy script service.orgPolicyScriptService - The (URIs of the) org policy script service providing the org
policy script handler.replace - Whether to replace an existing org policy script service for the designated
scriptType with the designated org policy script service. Replacing will ignore
append.append - Whether to append the existing org policy script service as an alternative for an
existing org policy script service for the designated scriptType. At runtime the list
of org policy script services will be iterated, the first successful org policy
resolution will apply. Afterwards this will be used as long as it is available; the
list will not be iterated again until the chosen handler is no longer available.URIs of the org policy services which are currently registered for the
designated script type. These may be the designated URI, they may be
appended to previously registered ones or it may be null in case
registering the designated service has not been successful.java.util.List<java.net.URI[]> unregisterOrgPolicyScriptService(SessionToken session, java.lang.String scriptType, java.net.URI[] orgPolicyScriptService)
OrgPolicyScriptService for the designated script type from this policy
resolution. Its handler will no longer be used for resolving policies. Unregistering will only
be successful, if the designated URIs are registered for the designated script type. Otherwise
this call will be ignored.session - The session for checking access rights.scriptType - The type of the script for which to unregister an org policy script service.orgPolicyScriptService - The (URIs of the) org policy script service providing the org
policy script handler which to unregister.URIs of the org policy script services which are currently registered
for the designated script type after unregistering the designated org policy service.
If this method call unregisters the designated script type completely, an empty list
will be returned. If the designated script type is not registered, null
will be returned.boolean registerOrgPolicyHandler(SessionToken session, java.lang.String scriptType, OrgPolicyScriptHandler handler, boolean replace)
registerOrgPolicyScriptService(SessionToken, String, URI[], boolean, boolean) the
designated handler will not survive a server restart or a cluster node role change. You will
have to re-register it.session - The session for checking access rights.scriptType - The type of the script for which to register an org policy script handler.handler - The org policy script handler to register for the designated script type.replace - Whether to replace an existing org policy handler for the designated scriptType
with the designated handler.boolean unregisterOrgPolicyHandler(SessionToken session, java.lang.String scriptType, OrgPolicyScriptHandler handler)
session - The session for checking access rights.scriptType - The type of the script for which to unregister an org policy script handler.handler - The org policy script handler which to unregister for the designated script
type.