Skip to content

Commit

Permalink
#1 fix renci repo
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-conway committed Jan 10, 2018
1 parent 97e7ed8 commit 2f9b749
Show file tree
Hide file tree
Showing 4 changed files with 143 additions and 10 deletions.
26 changes: 26 additions & 0 deletions irodsext-data-profiler/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,32 @@
<artifactId>irodsext-data-typer</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.emc.metalnx</groupId>
<artifactId>emc-metalnx-services</artifactId>
</dependency>
<dependency>
<groupId>com.emc.metalnx</groupId>
<artifactId>emc-metalnx-core</artifactId>
<exclusions>
<exclusion> <!-- declare the exclusion here -->
<groupId>org.hibernate</groupId>
<artifactId>hibernate-envers</artifactId>
</exclusion>
<exclusion> <!-- declare the exclusion here -->
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
</exclusion>
<exclusion> <!-- declare the exclusion here -->
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
</exclusion>
<exclusion> <!-- declare the exclusion here -->
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<description>Represents a high-level summary of a data object or collection, gathering metadata, ACL information, and other facets of a data object or collection, suitable for presentation in an interface. This includes awareness of applicable special metadata types as well as any rules or operations associated with a collection or file</description>
<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@
import org.irods.jargon.core.connection.IRODSAccount;
import org.irods.jargon.core.exception.JargonRuntimeException;
import org.irods.jargon.core.pub.IRODSAccessObjectFactory;
import org.irods.jargon.extensions.dataprofiler.DataProfilerService;
import org.irods.jargon.extensions.dataprofiler.DataProfilerFactory;
import org.irods.jargon.extensions.dataprofiler.DataProfilerService;
import org.irods.jargon.extensions.dataprofiler.DataProfilerSettings;
import org.irods.jargon.extensions.datatyper.DataTypeResolutionServiceFactory;
import org.springframework.beans.factory.annotation.Autowired;

import com.emc.metalnx.core.domain.entity.DataGridUser;
import com.emc.metalnx.services.interfaces.FavoritesService;
import com.emc.metalnx.services.interfaces.UserService;

/**
* Factory for {@link DataProfiler} implementation
*
Expand All @@ -29,16 +33,35 @@ public class IrodsextDataProfilerFactoryImpl implements DataProfilerFactory {
@Autowired
private DataTypeResolutionServiceFactory dataTypeResolutionServiceFactory;

/* (non-Javadoc)
* @see org.irodsext.dataprofiler.DataProfilerFactory#instanceDataProfilerService(org.irods.jargon.core.connection.IRODSAccount)
/**
* MetaLnx favorites service is current source of 'favorites' and bookmarks,
* this comes from the irods-ext database at moment. This is provided to the
* data profiler service instance during factory creation
*/
@Autowired
private FavoritesService favoritesService;

/**
* MetaLnx service to map user/zone accounts to the MetaLnx {@link DataGridUser}
*/
@Autowired
private UserService userService;

/*
* (non-Javadoc)
*
* @see
* org.irodsext.dataprofiler.DataProfilerFactory#instanceDataProfilerService(org
* .irods.jargon.core.connection.IRODSAccount)
*/
@Override
public DataProfilerService instanceDataProfilerService(final IRODSAccount irodsAccount) {
validateDependencies();
DataProfilerService dataProfilerService = new IrodsextDataProfilerService(dataProfilerSettings,
validateContext();
IrodsextDataProfilerService dataProfilerService = new IrodsextDataProfilerService(dataProfilerSettings,
irodsAccessObjectFactory, irodsAccount);
dataProfilerService.setDataTypeResolutionService(
dataTypeResolutionServiceFactory.instanceDataTypeResolutionService(irodsAccount));
dataProfilerService.setFavoritesService(getFavoritesService());
return dataProfilerService;
}

Expand Down Expand Up @@ -69,7 +92,7 @@ public void setDataTypeResolutionServiceFactory(DataTypeResolutionServiceFactory
/**
* Just a sanity check
*/
private void validateDependencies() {
private void validateContext() {
if (irodsAccessObjectFactory == null) {
throw new JargonRuntimeException("null irodsAccessObjectFactory");
}
Expand All @@ -81,6 +104,26 @@ private void validateDependencies() {
if (dataTypeResolutionServiceFactory == null) {
throw new IllegalArgumentException("null dataTypeResolutionServiceFactory");
}

if (userService == null) {
throw new IllegalArgumentException("null dataTypeResolutionServiceFactory");
}
}

public FavoritesService getFavoritesService() {
return favoritesService;
}

public void setFavoritesService(FavoritesService favoritesService) {
this.favoritesService = favoritesService;
}

public UserService getUserService() {
return userService;
}

public void setUserService(UserService userService) {
this.userService = userService;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import org.irods.jargon.core.connection.IRODSAccount;
import org.irods.jargon.core.exception.JargonException;
import org.irods.jargon.core.exception.JargonRuntimeException;
import org.irods.jargon.core.pub.IRODSAccessObjectFactory;
import org.irods.jargon.core.pub.domain.Collection;
import org.irods.jargon.core.pub.domain.DataObject;
Expand All @@ -14,6 +15,9 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.emc.metalnx.core.domain.entity.DataGridUser;
import com.emc.metalnx.services.interfaces.FavoritesService;

/**
* IRODS-EXT base implementation of a data profiler that can summarize a data
* object or collection
Expand All @@ -23,6 +27,16 @@
*/
public class IrodsextDataProfilerService extends DataProfilerService {

/**
* This will be provided by the factory
*/
private FavoritesService favoritesService;

/**
* logged in user identity
*/
private DataGridUser dataGridUser;

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

public IrodsextDataProfilerService(DataProfilerSettings defaultDataProfilerSettings,
Expand All @@ -33,15 +47,21 @@ public IrodsextDataProfilerService(DataProfilerSettings defaultDataProfilerSetti
@Override
protected void addStarringDataToDataObject(DataProfile<DataObject> dataProfile,
DataProfilerSettings dataProfilerSettings) throws JargonException {

log.warn("starring not yet implemented");
validateContext();
boolean isStarred = favoritesService.isPathFavoriteForUser(dataGridUser,
dataProfile.getDomainObject().getAbsolutePath());
dataProfile.setStarred(isStarred);
log.debug("starring set to:{}", isStarred);
}

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

validateContext();
boolean isStarred = favoritesService.isPathFavoriteForUser(dataGridUser,
dataProfile.getDomainObject().getAbsolutePath());
dataProfile.setStarred(isStarred);
log.debug("starring set to:{}", isStarred);
}

@Override
Expand Down Expand Up @@ -100,4 +120,31 @@ protected void addMetadataTemplatesToCollection(DataProfile<Collection> dataProf

}

public FavoritesService getFavoritesService() {
return favoritesService;
}

public void setFavoritesService(FavoritesService favoritesService) {
this.favoritesService = favoritesService;
}

/**
* Check for any missing dependencies or misconfiguration
*/
private void validateContext() {
if (favoritesService == null) {
log.error("favoritesService not configured");
throw new JargonRuntimeException("favoritesService not configured");
}

}

public DataGridUser getDataGridUser() {
return dataGridUser;
}

public void setDataGridUser(DataGridUser dataGridUser) {
this.dataGridUser = dataGridUser;
}

}
17 changes: 17 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
<artifactId>jargon-pom</artifactId>
<version>4.3.0.0-SNAPSHOT</version>
</parent>
<properties>
<metalnx.version>2.0.0</metalnx.version>
</properties>
<packaging>pom</packaging>
<name>jargon-extensions</name>
<description>Jargon Extensions using the irods-ext database used in metalnx</description>
Expand All @@ -22,6 +25,20 @@
</roles>
</developer>
</developers>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.emc.metalnx</groupId>
<artifactId>emc-metalnx-services</artifactId>
<version>${metalnx.version}</version>
</dependency>
<dependency>
<groupId>com.emc.metalnx</groupId>
<artifactId>emc-metalnx-core</artifactId>
<version>${metalnx.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
Expand Down

0 comments on commit 2f9b749

Please sign in to comment.