diff --git a/irodsext-data-profiler/pom.xml b/irodsext-data-profiler/pom.xml
index 0f9a7f0..9bf2ced 100644
--- a/irodsext-data-profiler/pom.xml
+++ b/irodsext-data-profiler/pom.xml
@@ -26,6 +26,32 @@
irodsext-data-typer
${project.version}
+
+ com.emc.metalnx
+ emc-metalnx-services
+
+
+ com.emc.metalnx
+ emc-metalnx-core
+
+
+ org.hibernate
+ hibernate-envers
+
+
+ org.springframework.security
+ spring-security-web
+
+
+ org.springframework.security
+ spring-security-config
+
+
+ mysql
+ mysql-connector-java
+
+
+
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
diff --git a/irodsext-data-profiler/src/main/java/org/irodsext/dataprofiler/IrodsextDataProfilerFactoryImpl.java b/irodsext-data-profiler/src/main/java/org/irodsext/dataprofiler/IrodsextDataProfilerFactoryImpl.java
index 488f910..73df70a 100644
--- a/irodsext-data-profiler/src/main/java/org/irodsext/dataprofiler/IrodsextDataProfilerFactoryImpl.java
+++ b/irodsext-data-profiler/src/main/java/org/irodsext/dataprofiler/IrodsextDataProfilerFactoryImpl.java
@@ -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
*
@@ -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;
}
@@ -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");
}
@@ -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;
}
}
diff --git a/irodsext-data-profiler/src/main/java/org/irodsext/dataprofiler/IrodsextDataProfilerService.java b/irodsext-data-profiler/src/main/java/org/irodsext/dataprofiler/IrodsextDataProfilerService.java
index 52881b2..955a70b 100644
--- a/irodsext-data-profiler/src/main/java/org/irodsext/dataprofiler/IrodsextDataProfilerService.java
+++ b/irodsext-data-profiler/src/main/java/org/irodsext/dataprofiler/IrodsextDataProfilerService.java
@@ -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;
@@ -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
@@ -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,
@@ -33,15 +47,21 @@ public IrodsextDataProfilerService(DataProfilerSettings defaultDataProfilerSetti
@Override
protected void addStarringDataToDataObject(DataProfile 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 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
@@ -100,4 +120,31 @@ protected void addMetadataTemplatesToCollection(DataProfile 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;
+ }
+
}
diff --git a/pom.xml b/pom.xml
index 8af14e2..d47e0fa 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,6 +9,9 @@
jargon-pom
4.3.0.0-SNAPSHOT
+
+ 2.0.0
+
pom
jargon-extensions
Jargon Extensions using the irods-ext database used in metalnx
@@ -22,6 +25,20 @@
+
+
+
+ com.emc.metalnx
+ emc-metalnx-services
+ ${metalnx.version}
+
+
+ com.emc.metalnx
+ emc-metalnx-core
+ ${metalnx.version}
+
+
+
org.slf4j