/** * Delete paths recursively as described in Repositories.ice. Internally uses {@link * #treeList(String, Ice.Current)} to build the recursive list of files. * * @param files non-null, preferably non-empty list of files to check. * @param recursive See Repositories.ice for an explanation * @param force See Repositories.ice for an explanation * @param __current Non-null ice context. */ public HandlePrx deletePaths(String[] files, boolean recursive, boolean force, Current __current) throws ServerError { // TODO: This could be refactored to be the default in shared servants final Ice.Current adjustedCurr = makeAdjustedCurrent(__current); final String allId = DoAll.ice_staticId(); final String delId = Delete.ice_staticId(); final DoAll all = (DoAll) getFactory(allId, adjustedCurr).create(allId); final Ice.ObjectFactory delFactory = getFactory(delId, adjustedCurr); final List<Request> commands = new ArrayList<Request>(); all.requests = commands; for (String path : files) { // treeList() calls checkedPath RMap map = treeList(path, __current); _deletePaths(delFactory, map, commands); } final FindServiceFactoryMessage msg = new FindServiceFactoryMessage(this, adjustedCurr); publishMessage(msg); final ServiceFactoryI sf = msg.getServiceFactory(); AMD_submit submit = submitRequest(sf, all, adjustedCurr); return submit.ret; }
private void _deletePaths(Ice.ObjectFactory delFactory, RMap map, List<Request> commands) { if (map != null && map.getValue() != null) { // Each of the entries for (RType value : map.getValue().values()) { // We know that the value for any key at the // "top" level is going to be a RMap RMap val = (RMap) value; if (val != null && val.getValue() != null) { if (val.getValue().containsKey("files")) { // then we need to recurse. files points to the next // "top" level. RMap files = (RMap) val.getValue().get("files"); _deletePaths(delFactory, files, commands); } // Now after we've recursed, do the actual delete. RLong id = (RLong) val.getValue().get("id"); Delete del = (Delete) delFactory.create(null); del.type = "/OriginalFile"; del.id = id.getValue(); commands.add(del); } } } }