/** * Delete a repository connection. * * @param name is the name of the connection to delete. If the name does not exist, no error is * returned. */ public void delete(String name) throws ManifoldCFException { // Grab a job manager handle. We will need to check if any jobs refer to this connection. IJobManager jobManager = JobManagerFactory.make(threadContext); StringSetBuffer ssb = new StringSetBuffer(); ssb.add(getRepositoryConnectionsKey()); ssb.add(getRepositoryConnectionKey(name)); StringSet cacheKeys = new StringSet(ssb); ICacheHandle ch = cacheManager.enterCache(null, cacheKeys, getTransactionID()); try { beginTransaction(); try { // Check if any jobs refer to this connection name if (jobManager.checkIfReference(name)) throw new ManifoldCFException( "Can't delete repository connection '" + name + "': existing jobs refer to it"); ManifoldCF.noteConfigurationChange(); throttleSpecManager.deleteRows(name); historyManager.deleteOwner(name); ArrayList params = new ArrayList(); String query = buildConjunctionClause( params, new ClauseDescription[] {new UnitaryClause(nameField, name)}); performDelete("WHERE " + query, params, null); cacheManager.invalidateKeys(ch); } catch (ManifoldCFException e) { signalRollback(); throw e; } catch (Error e) { signalRollback(); throw e; } finally { endTransaction(); } } finally { cacheManager.leaveCache(ch); } }
/** * Delete history rows related to a specific connection, upon user request. * * @param connectionName is the connection whose history records should be removed. */ @Override public void cleanUpHistoryData(String connectionName) throws ManifoldCFException { historyManager.deleteOwner(connectionName); }