public static boolean mergeAcceptMine(ApplicationID appId, String cubeName, String username) { validateAppId(appId); appId.validateBranchIsNotHead(); appId.validateStatusIsNotRelease(); boolean ret = getPersister().mergeAcceptMine(appId, cubeName, username); Map<String, Object> appCache = getCacheForApp(appId); appCache.remove(cubeName.toLowerCase()); return ret; }
/** Duplicate the given n-cube specified by oldAppId and oldName to new ApplicationID and name, */ public static void duplicate( ApplicationID oldAppId, ApplicationID newAppId, String oldName, String newName, String username) { validateAppId(oldAppId); validateAppId(newAppId); newAppId.validateBranchIsNotHead(); if (newAppId.isRelease()) { throw new IllegalArgumentException( "Cubes cannot be duplicated into a " + ReleaseStatus.RELEASE + " version, cube: " + newName + ", app: " + newAppId); } NCube.validateCubeName(oldName); NCube.validateCubeName(newName); if (oldName.equalsIgnoreCase(newName) && oldAppId.equals(newAppId)) { throw new IllegalArgumentException( "Could not duplicate, old name cannot be the same as the new name when oldAppId matches newAppId, name: " + oldName + ", app: " + oldAppId); } getPersister().duplicateCube(oldAppId, newAppId, oldName, newName, username); if (CLASSPATH_CUBE.equalsIgnoreCase( newName)) { // If another cube is renamed into sys.classpath, // then the entire class loader must be dropped (and then lazily rebuilt). clearCache(newAppId); } else { Map<String, Object> appCache = getCacheForApp(newAppId); appCache.remove(newName.toLowerCase()); } broadcast(newAppId); }
public static boolean renameCube( ApplicationID appId, String oldName, String newName, String username) { validateAppId(appId); appId.validateBranchIsNotHead(); if (appId.isRelease()) { throw new IllegalArgumentException( "Cannot rename a " + ReleaseStatus.RELEASE + " cube, cube: " + oldName + ", app: " + appId); } NCube.validateCubeName(oldName); NCube.validateCubeName(newName); if (oldName.equalsIgnoreCase(newName)) { throw new IllegalArgumentException( "Could not rename, old name cannot be the same as the new name, name: " + oldName + ", app: " + appId); } boolean result = getPersister().renameCube(appId, oldName, newName, username); if (CLASSPATH_CUBE.equalsIgnoreCase(oldName) || CLASSPATH_CUBE.equalsIgnoreCase( newName)) { // If the sys.classpath cube is renamed, or another cube is renamed into // sys.classpath, // then the entire class loader must be dropped (and then lazily rebuilt). clearCache(appId); } else { Map<String, Object> appCache = getCacheForApp(appId); appCache.remove(oldName.toLowerCase()); appCache.remove(newName.toLowerCase()); } broadcast(appId); return result; }
static boolean deleteCubes( ApplicationID appId, Object[] cubeNames, boolean allowDelete, String username) { validateAppId(appId); if (!allowDelete) { if (appId.isRelease()) { throw new IllegalArgumentException( ReleaseStatus.RELEASE + " cubes cannot be hard-deleted, app: " + appId); } } if (getPersister().deleteCubes(appId, cubeNames, allowDelete, username)) { Map<String, Object> appCache = getCacheForApp(appId); for (int i = 0; i < cubeNames.length; i++) { appCache.remove(((String) cubeNames[i]).toLowerCase()); } broadcast(appId); return true; } return false; }