Skip to content
This repository has been archived by the owner on Feb 23, 2018. It is now read-only.

Commit

Permalink
#25 add logging
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-conway committed Nov 17, 2017
1 parent 53a6221 commit f1c794d
Showing 1 changed file with 47 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ public void init() throws DataGridException {
public String index(final Model model, final HttpServletRequest request,
@RequestParam(value = "uploadNewTab", required = false) final boolean uploadNewTab)
throws DataGridConnectionRefusedException {

logger.info("index()");

try {
sourcePaths.clear();

Expand Down Expand Up @@ -272,6 +275,8 @@ public void redirectFromFilePropertiesToCollections(@RequestParam final String p
public String getAvailableRescForPath(final Model model, @RequestParam("isUpload") final boolean isUpload)
throws DataGridConnectionRefusedException {

logger.info("getAvailableRescForPath()");

Map<DataGridCollectionAndDataObject, DataGridResource> replicasMap = null;
List<DataGridResource> resources = resourceService.findFirstLevelResources();

Expand Down Expand Up @@ -327,6 +332,9 @@ else if (currentMode.equalsIgnoreCase(UI_USER_MODE)) {
@RequestMapping(value = "/getSubDirectories/", method = RequestMethod.POST)
public String getSubDirectories(final Model model, @RequestParam("path") String path) throws DataGridException {

logger.info("getSubDirectories()");
logger.info("path:{}", path);

// removes all ocurrences of "/" at the end of the path string
while (path.endsWith("/") && !"/".equals(path)) {
path = path.substring(0, path.lastIndexOf("/"));
Expand All @@ -351,6 +359,7 @@ public String getSubDirectories(final Model model, @RequestParam("path") String
@RequestMapping(value = "/goBackHistory/", method = RequestMethod.POST)
public String goBackHistory(final Model model, @RequestParam("steps") final int steps)
throws DataGridException, JargonException {
logger.info("goBackHistory()");
if (collectionHistoryBack.size() < steps || steps < 1) {
model.addAttribute("invalidStepsBackwards", steps);
logger.info("It is not possible to go back {} steps, current stack size is {}", steps,
Expand Down Expand Up @@ -388,6 +397,8 @@ public String goBackHistory(final Model model, @RequestParam("steps") final int
@RequestMapping(value = "/goForwardHistory/", method = RequestMethod.POST)
public String goForwardHistory(final Model model, @RequestParam("steps") final int steps)
throws DataGridException, JargonException {

logger.info("goForwardHistory()");
if (collectionHistoryForward.size() < steps || steps < 1) {
model.addAttribute("invalidStepsForward", steps);
return getCollBrowserView(model, currentPath);
Expand Down Expand Up @@ -453,6 +464,9 @@ public String getSubDirectoriesOldTree(final Model model, @RequestParam("path")
public String getFileInfo(final Model model, @RequestParam("path") final String path)
throws DataGridConnectionRefusedException {

logger.info("info()");
logger.info("path:{}", path);

DataGridCollectionAndDataObject dataGridObj = null;
Map<DataGridCollectionAndDataObject, DataGridResource> replicasMap = null;

Expand Down Expand Up @@ -501,10 +515,14 @@ public String getDirectoriesAndFilesForGroupForm(final Model model, @RequestPara
@RequestParam("groupName") final String groupName,
@RequestParam("retrievePermissions") final boolean retrievePermissions)
throws DataGridConnectionRefusedException, FileNotFoundException, JargonException {

if (path == null || path == "") {
path = "/";
}

logger.info("getDirectoriesAndFilesForGroupForm()");
logger.info("path:{}", path);

List<DataGridCollectionAndDataObject> list = null;
list = cs.getSubCollectionsAndDataObjectsUnderPath(path);

Expand Down Expand Up @@ -562,6 +580,10 @@ public String getDirectoriesAndFilesForUser(final Model model, @RequestParam("pa
@RequestParam("username") final String username,
@RequestParam("retrievePermissions") final boolean retrievePermissions)
throws DataGridConnectionRefusedException, FileNotFoundException, JargonException {

logger.info("getDirectoriesAndFilesForUser()");
logger.info("path:{}", path);

List<DataGridCollectionAndDataObject> list = new ArrayList<DataGridCollectionAndDataObject>();
Set<String> readPermissions = new HashSet<String>();
Set<String> writePermissions = new HashSet<String>();
Expand Down Expand Up @@ -620,7 +642,8 @@ public String getDirectoriesAndFilesForUser(final Model model, @RequestParam("pa
@RequestMapping(value = "/find/{name}")
public String listCollectionsAndDataObjects(final Model model, @PathVariable final String name)
throws DataGridConnectionRefusedException {
logger.info("Finding collections or data objects that match " + name);

logger.info("Finding collections or data objects that match:{} ", name);

// Find collections and data objects
List<DataGridCollectionAndDataObject> dataGridCollectionAndDataObjects = cs
Expand All @@ -642,6 +665,9 @@ public String listCollectionsAndDataObjects(final Model model, @PathVariable fin
@RequestMapping(value = "add/action/", method = RequestMethod.POST)
public String addCollection(final Model model, @ModelAttribute final CollectionOrDataObjectForm collection,
final RedirectAttributes redirectAttributes) throws DataGridConnectionRefusedException {

logger.info("addCollection()");
logger.info("collection:{}", collection);
DataGridCollectionAndDataObject newCollection = new DataGridCollectionAndDataObject(
currentPath + '/' + collection.getCollectionName(), collection.getCollectionName(), currentPath, true);

Expand Down Expand Up @@ -675,6 +701,10 @@ public String addCollection(final Model model, @ModelAttribute final CollectionO
@RequestMapping(value = "modify/action", method = RequestMethod.POST)
public String modifyAction(@ModelAttribute final CollectionOrDataObjectForm collForm,
final RedirectAttributes redirectAttributes) throws DataGridException {

logger.info("modifyAction()");
logger.info("collForm:{}", collForm);

String previousPath = collForm.getPath();
String parentPath = previousPath.substring(0, previousPath.lastIndexOf("/"));
String newPath = String.format("%s/%s", parentPath, collForm.getCollectionName());
Expand Down Expand Up @@ -705,6 +735,10 @@ public String applyTemplatesToCollections(final RedirectAttributes redirectAttri

private boolean applyTemplatesToPath(final MetadataTemplateForm template)
throws DataGridConnectionRefusedException {

logger.info("applyTemplatesToPath()");
logger.info("template:{}", template);

boolean allMetadataAdded = true;
List<String> attributes = template.getAvuAttributes();
List<String> values = template.getAvuValues();
Expand Down Expand Up @@ -744,6 +778,7 @@ private boolean applyTemplatesToPath(final MetadataTemplateForm template)
*/
@RequestMapping(value = "/home/")
public String homeCollection(final Model model) throws DataGridException {
logger.info("home()");
// cleaning session variables
sourcePaths.clear();
currentPath = cs.getHomeDirectyForCurrentUser();
Expand All @@ -759,6 +794,7 @@ public String homeCollection(final Model model) throws DataGridException {
*/
@RequestMapping(value = "/public/")
public String publicCollection(final Model model) throws DataGridException {
logger.info("public()");
// cleaning session variables
sourcePaths.clear();

Expand All @@ -783,6 +819,7 @@ public String publicCollection(final Model model) throws DataGridException {
*/
@RequestMapping(value = "/trash/")
public String trashCollection(final Model model) throws DataGridException {
logger.info("trash()");
// cleaning session variables
sourcePaths.clear();

Expand All @@ -805,6 +842,9 @@ public String trashCollection(final Model model) throws DataGridException {
@RequestMapping(value = "/getBreadCrumbForObject/")
public String getBreadCrumbForObject(final Model model, @RequestParam("path") String path)
throws DataGridConnectionRefusedException {
logger.info("getBreadCrumbForObject()");
logger.info("path:{}", path);

if (path.isEmpty()) {
path = currentPath;
} else {
Expand Down Expand Up @@ -844,6 +884,9 @@ public String getBreadCrumbForObject(final Model model, @RequestParam("path") St
@RequestMapping(value = "isValidCollectionName/{newObjectName}/", method = RequestMethod.GET, produces = {
"text/plain" })
public String isValidCollectionName(@PathVariable final String newObjectName) throws DataGridException {

logger.info("isValidCollectionName()");

String rc = "true";
String newPath = String.format("%s/%s", currentPath, newObjectName);

Expand Down Expand Up @@ -874,6 +917,9 @@ public String isValidCollectionName(@PathVariable final String newObjectName) th
@RequestMapping(value = "getPaginatedJSONObjs/")
@ResponseBody
public String getPaginatedJSONObjs(final HttpServletRequest request) throws DataGridConnectionRefusedException {
logger.info("getPaginatedJSONObjs()");
logger.info("request:{}", request);

List<DataGridCollectionAndDataObject> dataGridCollectionAndDataObjects;

int draw = Integer.parseInt(request.getParameter("draw"));
Expand Down

0 comments on commit f1c794d

Please sign in to comment.