/** * Log all policies that are using the set of removed topology objects * * @param operation Which operation are we performing wrt the topology object * @param topologyType The type of topology object to log against. * @param deletedNodes Collection of the id's of the Topology Nodes that were deleted. * @param constraintName The name of the constraint within a user set for the topology type * specified in the topologyType property */ protected void logPoliciesUsingRemovedTopologyObjs( final String operation, final String topologyType, final Collection<Integer> deletedNodes, final String constraintName) { ManagementContainer mc = ManagementContainer.getInstance(); ITransactionManager pool; pool = mc.getPool(ManagementContainer.POOL_NAME); pool.executeWithConnection( new ConnectionExecuteFunction<Object>() { public Object execute(Connection c) throws SQLException { logPoliciesUsingRemovedTopologyObjs( operation, topologyType, deletedNodes, constraintName, c); return null; } }); }
/** Purge all topology objects that are marked as deleted and the purge time has passed */ public static void purgeDeletedToplogyObjects() { ManagementContainer mc = ManagementContainer.getInstance(); ITransactionManager pool; pool = mc.getPool(ManagementContainer.POOL_NAME); Set<Integer> custIds = pool.executeWithConnection( new ConnectionExecuteFunction<Set<Integer>>() { public Set<Integer> execute(Connection c) throws SQLException { return purgeDeletedToplogyObjects(c); } }); // must run the following refresh queries after the transaction above is committed if (!CollectionsUtils.isNullOrEmpty(custIds)) { for (Integer custID : custIds) { ManagementContainer.getInstance() .getPolicyMetaManager() .notifyOfExternalPolicyChanges(custID); } } }