Search in sources :

Example 16 with DataGridResource

use of com.emc.metalnx.core.domain.entity.DataGridResource in project metalnx-web by irods-contrib.

the class ResourceController method findResourcesByName.

/**
 * Lists all resources that match the parameter given
 *
 * @param model
 * @return
 * @throws DataGridConnectionRefusedException
 */
@RequestMapping(value = "/find/{resourceName}/")
public String findResourcesByName(Model model, @PathVariable String resourceName) throws DataGridConnectionRefusedException {
    DataGridResource dataGridResource = resourceService.find(resourceName);
    model.addAttribute("resources", dataGridResource);
    model.addAttribute("resourceName", resourceName);
    return "resources/resourceList :: resourceList";
}
Also used : DataGridResource(com.emc.metalnx.core.domain.entity.DataGridResource) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 17 with DataGridResource

use of com.emc.metalnx.core.domain.entity.DataGridResource in project metalnx-web by irods-contrib.

the class ResourceController method showModifyResourceForm.

/**
 * Shows the modify resource form
 *
 * @param model
 * @return the template that renders the add resource from
 * @throws DataGridConnectionRefusedException
 */
@RequestMapping(value = "/modify/{resourceName}/")
public String showModifyResourceForm(Model model, @PathVariable String resourceName) throws DataGridConnectionRefusedException {
    if (dataGridResources == null || dataGridResources.isEmpty()) {
        dataGridResources = resourceService.findAll();
    }
    DataGridResource dataGridResourceToModify = resourceService.find(resourceName);
    List<String> childrenList = resourceService.getImmediateChildren(resourceName);
    List<DataGridResourceType> coordinatingResources = getCoordinatingResources(resourceService.listResourceTypes());
    List<DataGridResourceType> storageResources = getStorageResources(resourceService.listResourceTypes());
    for (DataGridResourceType dataGridResourceType : resourceService.listResourceTypes()) {
        if (dataGridResourceType.getDataGridType().equals(DataGridResourceTypeEnum.IRODS_COORDINATING)) {
            coordinatingResources.add(dataGridResourceType);
        } else if (dataGridResourceType.getDataGridType().equals(DataGridResourceTypeEnum.IRODS_STORAGE)) {
            storageResources.add(dataGridResourceType);
        }
    }
    ResourceForm resourceForm = new ResourceForm(dataGridResourceToModify);
    // prevent the same resource being modified from showing in the parent resource
    // list
    model.addAttribute("resourceForm", resourceForm);
    model.addAttribute("requestMapping", URLMap.URL_MODIFY_RESOURCE_ACTION);
    model.addAttribute("resources", dataGridResources);
    model.addAttribute("childrenList", childrenList);
    model.addAttribute("coordinatingResources", coordinatingResources);
    model.addAttribute("storageResources", storageResources);
    return "resources/resourceForm";
}
Also used : ResourceForm(com.emc.metalnx.modelattribute.resource.ResourceForm) DataGridResource(com.emc.metalnx.core.domain.entity.DataGridResource) DataGridResourceType(com.emc.metalnx.core.domain.entity.DataGridResourceType) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 18 with DataGridResource

use of com.emc.metalnx.core.domain.entity.DataGridResource in project metalnx-web by irods-contrib.

the class ResourceController method addResourceForm.

private void addResourceForm(Model model) throws DataGridConnectionRefusedException {
    List<DataGridResource> dataGridResources = resourceService.findAll();
    List<DataGridResourceType> resourceTypes = resourceService.listResourceTypes();
    List<DataGridResourceType> coordinatingResources = getCoordinatingResources(resourceTypes);
    List<DataGridResourceType> storageResources = getStorageResources(resourceTypes);
    model.addAttribute("resourceForm", new ResourceForm());
    model.addAttribute("requestMapping", URLMap.URL_ADD_RESOURCE_ACTION);
    model.addAttribute("resources", dataGridResources);
    model.addAttribute("childrenList", new ArrayList<String>());
    model.addAttribute("coordinatingResources", coordinatingResources);
    model.addAttribute("storageResources", storageResources);
    model.addAttribute("zones", zoneService.findAll());
}
Also used : ResourceForm(com.emc.metalnx.modelattribute.resource.ResourceForm) DataGridResource(com.emc.metalnx.core.domain.entity.DataGridResource) DataGridResourceType(com.emc.metalnx.core.domain.entity.DataGridResourceType)

Example 19 with DataGridResource

use of com.emc.metalnx.core.domain.entity.DataGridResource in project metalnx-web by irods-contrib.

the class TestRuleService method testIlluminaMetadataRule.

@Test
public void testIlluminaMetadataRule() throws DataGridRuleException, DataGridConnectionRefusedException {
    DataGridResource dgDestResc = resourceService.find(RESOURCE);
    ruleService.execIlluminaMetadataRule(dgDestResc, "/zone/home/rods", "/zone/home/rods/test_SSU.tar");
    // these two methods should never be called since there is no objects under the
    // test path
    verify(ruleService, atMost(2)).executeRule(anyString());
}
Also used : DataGridResource(com.emc.metalnx.core.domain.entity.DataGridResource) Test(org.junit.Test)

Example 20 with DataGridResource

use of com.emc.metalnx.core.domain.entity.DataGridResource in project metalnx-web by irods-contrib.

the class DashboardController method getDetailsForResource.

@RequestMapping(value = "/resourceDetails/{resourceName}/", method = RequestMethod.GET)
public String getDetailsForResource(@PathVariable String resourceName, Model model) throws DataGridConnectionRefusedException {
    logger.info("getDetailsForResource()");
    DataGridResource resource = resourceService.find(resourceName);
    if (resource != null) {
        model.addAttribute("resource", resource);
    } else {
        model.addAttribute("resourceNotFound", resourceName);
    }
    return "dashboard/details/resourceInfo";
}
Also used : DataGridResource(com.emc.metalnx.core.domain.entity.DataGridResource) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

DataGridResource (com.emc.metalnx.core.domain.entity.DataGridResource)34 ArrayList (java.util.ArrayList)8 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)8 DataGridConnectionRefusedException (com.emc.metalnx.core.domain.exceptions.DataGridConnectionRefusedException)6 DataGridServer (com.emc.metalnx.core.domain.entity.DataGridServer)5 IOException (java.io.IOException)4 UnknownHostException (java.net.UnknownHostException)4 JargonException (org.irods.jargon.core.exception.JargonException)4 ResourceAO (org.irods.jargon.core.pub.ResourceAO)4 DataGridCollectionAndDataObject (com.emc.metalnx.core.domain.entity.DataGridCollectionAndDataObject)3 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)3 Date (java.util.Date)3 JSONObject (org.codehaus.jettison.json.JSONObject)3 DataGridResourceType (com.emc.metalnx.core.domain.entity.DataGridResourceType)2 DataGridRule (com.emc.metalnx.core.domain.entity.DataGridRule)2 DataGridServerException (com.emc.metalnx.core.domain.exceptions.DataGridServerException)2 ResourceForm (com.emc.metalnx.modelattribute.resource.ResourceForm)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 JSONArray (org.codehaus.jettison.json.JSONArray)2