use of org.wso2.carbon.identity.entitlement.EntitlementException in project carbon-identity-framework by wso2.
the class EntitlementAdminService method clearAllResourceCaches.
/**
* Clears Carbon resource finder cache and All the resource cache implementations in each
* PIP resource finder level
*
* @throws EntitlementException throws
*/
public void clearAllResourceCaches() throws EntitlementException {
CarbonResourceFinder finder = EntitlementEngine.getInstance().getCarbonResourceFinder();
if (finder != null) {
finder.clearAttributeCache();
// we need invalidate decision cache as well.
clearDecisionCache();
} else {
throw new EntitlementException("Can not clear attribute cache - Carbon Attribute Finder " + "is not initialized");
}
}
use of org.wso2.carbon.identity.entitlement.EntitlementException in project carbon-identity-framework by wso2.
the class EntitlementAdminService method clearCarbonAttributeCache.
/**
* Clears the carbon attribute cache
*
* @throws EntitlementException throws
*/
public void clearCarbonAttributeCache() throws EntitlementException {
CarbonAttributeFinder finder = EntitlementEngine.getInstance().getCarbonAttributeFinder();
if (finder != null) {
finder.clearAttributeCache();
// we need invalidate decision cache as well.
clearDecisionCache();
} else {
throw new EntitlementException("Can not clear attribute cache - Carbon Attribute Finder " + "is not initialized");
}
Map<PIPAttributeFinder, Properties> designators = EntitlementServiceComponent.getEntitlementConfig().getDesignators();
if (designators != null && !designators.isEmpty()) {
Set<PIPAttributeFinder> pipAttributeFinders = designators.keySet();
for (PIPAttributeFinder pipAttributeFinder : pipAttributeFinders) {
if (pipAttributeFinder instanceof AbstractPIPAttributeFinder) {
pipAttributeFinder.clearCache();
}
}
}
}
use of org.wso2.carbon.identity.entitlement.EntitlementException in project carbon-identity-framework by wso2.
the class EntitlementAdminService method clearCarbonResourceCache.
/**
* Clears the carbon resource cache
*
* @throws EntitlementException throws
*/
public void clearCarbonResourceCache() throws EntitlementException {
CarbonResourceFinder finder = EntitlementEngine.getInstance().getCarbonResourceFinder();
if (finder != null) {
finder.clearAttributeCache();
// we need invalidate decision cache as well.
clearDecisionCache();
} else {
throw new EntitlementException("Can not clear attribute cache - Carbon Attribute Finder " + "is not initialized");
}
Map<PIPResourceFinder, Properties> resourceConfigs = EntitlementServiceComponent.getEntitlementConfig().getResourceFinders();
if (resourceConfigs != null && !resourceConfigs.isEmpty()) {
Set<PIPResourceFinder> resourceFinders = resourceConfigs.keySet();
for (PIPResourceFinder pipResourceFinder : resourceFinders) {
pipResourceFinder.clearCache();
}
}
}
use of org.wso2.carbon.identity.entitlement.EntitlementException in project carbon-identity-framework by wso2.
the class EntitlementPolicyAdminService method publishToPDP.
/**
* @param policyIds
* @throws EntitlementException
*/
private void publishToPDP(String[] policyIds, String version, String action) throws EntitlementException {
PolicyPublisher publisher = EntitlementAdminEngine.getInstance().getPolicyPublisher();
String[] subscribers = new String[] { EntitlementConstants.PDP_SUBSCRIBER_ID };
publisher.publishPolicy(policyIds, version, action, false, 0, subscribers, null);
}
use of org.wso2.carbon.identity.entitlement.EntitlementException in project carbon-identity-framework by wso2.
the class EntitlementPolicyAdminService method publishPolicies.
/**
* Publishes given set of policies to all subscribers
*
* @param policyIds policy ids to publish, if null or empty, all policies are published
* @param subscriberIds subscriber ids to publish, if null or empty, all policies are published
* @param action publishing action
* @param version version
* @param enabled whether policy must be enabled or not
* @param order order of the policy
* @throws EntitlementException throws, if fails
*/
public void publishPolicies(String[] policyIds, String[] subscriberIds, String action, String version, boolean enabled, int order) throws EntitlementException {
PolicyPublisher publisher = EntitlementAdminEngine.getInstance().getPolicyPublisher();
if (policyIds == null || policyIds.length < 1) {
policyIds = EntitlementAdminEngine.getInstance().getPapPolicyStoreManager().getPolicyIds();
}
if (subscriberIds == null || subscriberIds.length < 1) {
subscriberIds = publisher.retrieveSubscriberIds("*");
}
if (policyIds == null || policyIds.length < 1) {
throw new EntitlementException("There are no policies to publish");
}
if (subscriberIds == null || subscriberIds.length < 1) {
throw new EntitlementException("There are no subscribers to publish");
}
publisher.publishPolicy(policyIds, version, action, enabled, order, subscriberIds, null);
}
Aggregations