Skip to content

Commit

Permalink
#1 refactor to abstract superclass
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-conway committed Dec 29, 2017
1 parent c721e0d commit 7938beb
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 67 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,111 +4,100 @@
package org.irodsext.dataprofiler;

import org.irods.jargon.core.connection.IRODSAccount;
import org.irods.jargon.core.exception.DataNotFoundException;
import org.irods.jargon.core.exception.JargonException;
import org.irods.jargon.core.pub.CollectionAndDataObjectListAndSearchAO;
import org.irods.jargon.core.pub.IRODSAccessObjectFactory;
import org.irods.jargon.core.pub.domain.Collection;
import org.irods.jargon.core.pub.domain.DataObject;
import org.irods.jargon.core.pub.domain.ObjStat;
import org.irods.jargon.extensions.dataprofiler.DataProfile;
import org.irods.jargon.extensions.dataprofiler.DataProfileService;
import org.irods.jargon.extensions.dataprofiler.DataProfilerSettings;
import org.irods.jargon.extensions.datatyper.DataTypeResolutionService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* IRODS-EXT base implementation of a data profiler that can summarize a data
* object or collection
*
* @author Mike Conway - NIEHS
*
*/
public class IrodsextDataProfilerService extends DataProfileService {

public static final Logger log = LoggerFactory.getLogger(IrodsextDataProfilerService.class);

/**
* @param defaultDataProfilerSettings
* @param dataTypeResolutionService
* @param irodsAccessObjectFactory
* @param irodsAccount
*/
public IrodsextDataProfilerService(DataProfilerSettings defaultDataProfilerSettings,
DataTypeResolutionService dataTypeResolutionService, IRODSAccessObjectFactory irodsAccessObjectFactory,
IRODSAccount irodsAccount) {
super(defaultDataProfilerSettings, dataTypeResolutionService, irodsAccessObjectFactory, irodsAccount);
IRODSAccessObjectFactory irodsAccessObjectFactory, IRODSAccount irodsAccount) {
super(defaultDataProfilerSettings, irodsAccessObjectFactory, irodsAccount);
}

/*
* (non-Javadoc)
*
* @see org.irods.jargon.extensions.dataprofiler.DataProfileService#
* retrieveDataProfile(java.lang.String)
*/
@SuppressWarnings("rawtypes")
@Override
public DataProfile retrieveDataProfile(String irodsAbsolutePath) throws DataNotFoundException, JargonException {
return retrieveDataProfile(irodsAbsolutePath, this.getDefaultDataProfilerSettings());
protected void addStarringDataToDataObject(DataProfile<DataObject> dataProfile,
DataProfilerSettings dataProfilerSettings) throws JargonException {

log.warn("starring not yet implemented");
}

/*
* (non-Javadoc)
*
* @see org.irods.jargon.extensions.dataprofiler.DataProfileService#
* retrieveDataProfile(java.lang.String,
* org.irods.jargon.extensions.dataprofiler.DataProfilerSettings)
*/
@SuppressWarnings("rawtypes")
@Override
public DataProfile retrieveDataProfile(String irodsAbsolutePath, DataProfilerSettings dataProfilerSettings)
throws DataNotFoundException, JargonException {
log.info("retrieveDataProfile()");
protected void addStarringDataToCollection(DataProfile<Collection> dataProfile,
DataProfilerSettings dataProfilerSettings) throws JargonException {
log.warn("starring not yet implemented");

if (irodsAbsolutePath == null || irodsAbsolutePath.isEmpty()) {
throw new IllegalArgumentException("null or empty irodsAbsolutePath");
}
}

if (dataProfilerSettings == null) {
throw new IllegalArgumentException("null dataProfilerSettings");
}
@Override
protected void addTaggingAndCommentsToDataObject(DataProfile<DataObject> dataProfile,
DataProfilerSettings dataProfilerSettings) throws JargonException {
log.warn("tagging not yet implemented");

log.info("irodsAbsolutePath:{}", irodsAbsolutePath);
log.info("dataProfilerSettings:{}", dataProfilerSettings);
}

CollectionAndDataObjectListAndSearchAO collectionAndDataObjectListAndSearchAO = this
.getIrodsAccessObjectFactory().getCollectionAndDataObjectListAndSearchAO(getIrodsAccount());
log.info("getting objStat...");
@Override
protected void addTaggingAndCommentsToCollection(DataProfile<Collection> dataProfile,
DataProfilerSettings dataProfilerSettings) throws JargonException {
log.warn("tagging not yet implemented");

ObjStat objStat = collectionAndDataObjectListAndSearchAO.retrieveObjectStatForPath(irodsAbsolutePath);
}

if (objStat.isSomeTypeOfCollection()) {
return retrieveDataProfileForCollection(irodsAbsolutePath, objStat, dataProfilerSettings);
} else {
return retrieveDataProfileForDataObject(irodsAbsolutePath, objStat, dataProfilerSettings);
}
@Override
protected void addSharingToDataObject(DataProfile<DataObject> dataProfile,
DataProfilerSettings dataProfilerSettings) throws JargonException {
log.warn("sharing not yet implemented");

}

private DataProfile<DataObject> retrieveDataProfileForDataObject(String irodsAbsolutePath, ObjStat objStat,
DataProfilerSettings dataProfilerSettings) {
log.info("retriveDataProfileForDataObject()");
log.info("objStat:{}", objStat);
DataProfile<DataObject> dataProfile = retrieveBaseDataObjectProfile(irodsAbsolutePath, dataProfilerSettings);
@Override
protected void addSharingToCollection(DataProfile<Collection> dataProfile,
DataProfilerSettings dataProfilerSettings) throws JargonException {
log.warn("sharing not yet implemented");

log.info("look for special attributes");
}

checkIfStarred(dataProfile, this.getIrodsAccount().getUserName());
checkIfShared(dataProfile, this.getIrodsAccount().getUserName());
extractTags(dataProfile);
establishDataType(dataProfile);
@Override
protected void addTicketsToDataObject(DataProfile<DataObject> dataProfile,
DataProfilerSettings dataProfilerSettings) throws JargonException {
log.warn("tickets not yet implemented");

return dataProfile;
}

private DataProfile<Collection> retrieveDataProfileForCollection(String irodsAbsolutePath, ObjStat objStat,
DataProfilerSettings dataProfilerSettings) {
log.info("retriveDataProfileForCollection()");
log.info("objStat:{}", objStat);
return null;
@Override
protected void addTicketsToCollection(DataProfile<Collection> dataProfile,
DataProfilerSettings dataProfilerSettings) throws JargonException {
log.warn("tickets not yet implemented");

}

@Override
protected void addMetadataTemplatesToDataObject(DataProfile<DataObject> dataProfile,
DataProfilerSettings dataProfilerSettings) throws JargonException {
log.warn("templates not yet implemented");

}

@Override
protected void addMetadataTemplatesToCollection(DataProfile<Collection> dataProfile,
DataProfilerSettings dataProfilerSettings) throws JargonException {
log.warn("templates not yet implemented");

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ public void testBasicDataProfileWithCollection() throws Exception {
DataTypeResolutionService dataTyperService = new IrodsextDataTypeResolutionService(accessObjectFactory,
irodsAccount, dataTyperSettings);

DataProfileService dataProfilerService = new IrodsextDataProfilerService(dataProfilerSettings, dataTyperService,
DataProfileService dataProfilerService = new IrodsextDataProfilerService(dataProfilerSettings,
accessObjectFactory, irodsAccount);
dataProfilerService.setDataTypeResolutionService(dataTyperService);
@SuppressWarnings("rawtypes")
DataProfile dataProfile = dataProfilerService.retrieveDataProfile(targetIrodsCollection);
Assert.assertNotNull("null data profile returned", dataProfile);
Expand Down

0 comments on commit 7938beb

Please sign in to comment.