Search in sources :

Example 1 with DataProfile

use of org.irods.jargon.extensions.dataprofiler.DataProfile in project metalnx-web by irods-contrib.

the class CollectionServiceImpl method getCollectionDataProfile.

@SuppressWarnings("unchecked")
@Override
public DataProfile<IRODSDomainObject> getCollectionDataProfile(String path) throws DataGridException {
    IRODSAccount irodsAccount = irodsServices.getUserAO().getIRODSAccount();
    logger.info("*****************path **************" + path);
    logger.debug("got irodsAccount:{}", irodsAccount);
    DataProfilerService dataProfilerService = dataProfilerFactory.instanceDataProfilerService(irodsAccount);
    logger.debug("got the dataProfilerService");
    // TODO: allow clone()
    try {
        @SuppressWarnings("rawtypes") DataProfile dataProfile = dataProfilerService.retrieveDataProfile(path);
        logger.info("------CollectionInfoController getTestCollectionInfo() ends !!");
        logger.info("data profile retrieved:{}", dataProfile);
        /*
			 * TODO: after this do an if test and send to right view with the DataProfile in
			 * the model
			 */
        return dataProfile;
    } catch (JargonException e) {
        logger.error("Could not retrieve collection/dataobject from path: {}", path, e);
        throw new DataGridException(e.getMessage());
    }
}
Also used : DataProfile(org.irods.jargon.extensions.dataprofiler.DataProfile) DataGridException(com.emc.metalnx.core.domain.exceptions.DataGridException) IRODSAccount(org.irods.jargon.core.connection.IRODSAccount) JargonException(org.irods.jargon.core.exception.JargonException) DataProfilerService(org.irods.jargon.extensions.dataprofiler.DataProfilerService)

Example 2 with DataProfile

use of org.irods.jargon.extensions.dataprofiler.DataProfile in project metalnx-web by irods-contrib.

the class BrowseController method getSummary.

@RequestMapping(value = "/summary", method = RequestMethod.POST)
public String getSummary(final Model model, @RequestParam("path") final String path) throws DataGridException, UnsupportedEncodingException {
    logger.info("BrowseController getSummary() starts :: " + path);
    IconObject icon = null;
    String mimeType = "";
    @SuppressWarnings("rawtypes") DataProfile dataProfile = cs.getCollectionDataProfile(URLDecoder.decode(path, "UTF-8"));
    logger.info("DataProfiler is :: " + dataProfile);
    if (dataProfile != null && dataProfile.isFile()) {
        mimeType = dataProfile.getDataType().getMimeType();
    }
    icon = cs.getIcon(mimeType);
    model.addAttribute("icon", icon);
    model.addAttribute("dataProfile", dataProfile);
    logger.info("getSummary() ends !!");
    return "collections/summarySidenav :: SummarySidenavView";
}
Also used : DataProfile(org.irods.jargon.extensions.dataprofiler.DataProfile) IconObject(com.emc.metalnx.core.domain.entity.IconObject) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 3 with DataProfile

use of org.irods.jargon.extensions.dataprofiler.DataProfile in project metalnx-web by irods-contrib.

the class CollectionInfoController method index.

@RequestMapping(method = RequestMethod.GET)
public String index(final Model model, HttpServletRequest request, @RequestParam("path") final String path) throws DataGridException, DataGridConnectionRefusedException, JargonException {
    logger.info("index()");
    if (path == null || path.isEmpty()) {
        throw new IllegalArgumentException("null or empty path");
    }
    logger.info("path:{}", path);
    String myPath = URLDecoder.decode(path);
    logger.info("decoded myPath:{}", myPath);
    IconObject icon = null;
    String mimeType = "";
    String template = "";
    @SuppressWarnings("rawtypes") DataProfile dataProfile = collectionService.getCollectionDataProfile(myPath);
    if (dataProfile != null && dataProfile.isFile()) {
        mimeType = dataProfile.getDataType().getMimeType();
    }
    icon = collectionService.getIcon(mimeType);
    model.addAttribute("icon", icon);
    model.addAttribute("dataProfile", dataProfile);
    model.addAttribute("breadcrumb", new DataGridBreadcrumb(dataProfile.getAbsolutePath()));
    if (!dataProfile.isFile())
        template = "collections/collectionInfo";
    if (dataProfile.isFile())
        template = "collections/fileInfo";
    return template;
}
Also used : DataProfile(org.irods.jargon.extensions.dataprofiler.DataProfile) DataGridBreadcrumb(com.emc.metalnx.modelattribute.breadcrumb.DataGridBreadcrumb) IconObject(com.emc.metalnx.core.domain.entity.IconObject) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 4 with DataProfile

use of org.irods.jargon.extensions.dataprofiler.DataProfile in project metalnx-web by irods-contrib.

the class CollectionInfoController method getCollectionFileInfo.

@RequestMapping(value = "/collectionFileInfo/", method = RequestMethod.POST)
public String getCollectionFileInfo(final Model model, @RequestParam("path") final String path) throws DataGridException {
    logger.info("CollectionInfoController getCollectionFileInfo() starts :: " + path);
    IconObject icon = null;
    String mimeType = "";
    @SuppressWarnings("rawtypes") String myPath = URLDecoder.decode(path);
    DataProfile dataProfile = collectionService.getCollectionDataProfile(myPath);
    if (dataProfile != null && dataProfile.isFile()) {
        mimeType = dataProfile.getDataType().getMimeType();
    }
    icon = collectionService.getIcon(mimeType);
    model.addAttribute("icon", icon);
    model.addAttribute("dataProfile", dataProfile);
    logger.info("getCollectionFileInfo() ends !!");
    return "collections/details :: detailsView";
}
Also used : DataProfile(org.irods.jargon.extensions.dataprofiler.DataProfile) IconObject(com.emc.metalnx.core.domain.entity.IconObject) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

DataProfile (org.irods.jargon.extensions.dataprofiler.DataProfile)4 IconObject (com.emc.metalnx.core.domain.entity.IconObject)3 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 DataGridException (com.emc.metalnx.core.domain.exceptions.DataGridException)1 DataGridBreadcrumb (com.emc.metalnx.modelattribute.breadcrumb.DataGridBreadcrumb)1 IRODSAccount (org.irods.jargon.core.connection.IRODSAccount)1 JargonException (org.irods.jargon.core.exception.JargonException)1 DataProfilerService (org.irods.jargon.extensions.dataprofiler.DataProfilerService)1