/// <summary> /// Get parent container of current container /// </summary> /// <returns>Parent Container</returns> public Container getParentContainer() { Container container = new Container(client, parentURI); return container; }
/// <summary> /// Delete an existing container /// </summary> /// <param name="containerName">Name of container to be deleted</param> /// <returns>True if deleted successfully /// False otherwise</returns> public Boolean deleteContainer(String containerName) { try { path = CommonConstants.CDMI_PATH_CONSTANT + client.username + "/" + containerName; Container container = new Container(client,path); if(container.isGetSuccessful()) if(!container.getChildrenRange().Equals("0-0")) container.emptyContainer(); DelHTTPRequest request = new DelHTTPRequest(this.client); request.createHTTPRequest(path, Resource1.ContainerRequest); ExecutionResult executionResult = request.executeRequest(); return true; } catch (ExceptionHandler) { return false; } }
/// <summary> /// Get any child container of current container /// </summary> /// <param name="childName">Name of child container</param> /// <returns>Child Container</returns> public Container getChildContainer(String childName) { Container container = new Container(client, path + "/" + childName); return container; }
/// <summary> /// Get parent container of object /// </summary> /// <returns>Parent Container</returns> public Container getParentContainer() { String parentPath = path; int pathLength = parentPath.Length; for (int counter = pathLength - 1; counter >= 0; counter--) { if (parentPath[counter] == '/') { parentPath = parentPath.TrimEnd(parentPath[counter]); break; } parentPath = parentPath.TrimEnd(parentPath[counter]); } Container container = new Container(client, parentPath); return container; }