diff --git a/.gitignore b/.gitignore
index 482469d82..df32077bd 100755
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
+**/bin
target/
.settings/
.project/
@@ -15,3 +16,4 @@ target/
test*.properties
Scripts/
/.metadata/
+packaging/src
diff --git a/DEVELOPER-README.md b/DEVELOPER-README.md
index 2a9ef52cb..fb2e3a953 100644
--- a/DEVELOPER-README.md
+++ b/DEVELOPER-README.md
@@ -105,6 +105,7 @@ In addition, an additional profile for Metalnx is required, like this...
localhost
webdriver.chrome.driver
C:/Users/pateldes/driver/chromedriver.exe
+ true
diff --git a/README.md b/README.md
index 7f95b9cb9..59045af7f 100755
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
![Metalnx Logo](docs/IMAGES/mlx_logo_blue.png)
## Version: 4.2.1.0-SNAPSHOT
-## Git Tag: niehs/issue2
+## Git Tag: niehs/development
## Date: Oct 27, 2017
@@ -87,6 +87,14 @@ The current Selenium tests have been refactored to start with basic health check
Updated Jargon and controller code to gracefully handle no permission errors with a helpful message and a return to the previous directory view
-#### NIEHS identified misc theming issues
+#### Add properties based global control of features targeted at first towards removing tickets niehs #52
+
+Add a global config to turn on/off certain features via metalnx.properties. This allows sites to globally turn off features such as tickets.
+
+#### NIEHS identified misc theming issues
* #22 fix search text
+
+* #25 search - default to 'contains'
+
+* #11 Consider removing Jquery data table search filter as confusing next to the planned global search
diff --git a/etc/irods-ext/metalnx.properties b/etc/irods-ext/metalnx.properties
index f65d3e06b..a75bbe09d 100644
--- a/etc/irods-ext/metalnx.properties
+++ b/etc/irods-ext/metalnx.properties
@@ -69,3 +69,8 @@ msi.irods.list=libmsisync_to_archive.so,libmsi_update_unixfilesystem_resource_fr
msi.irods.42.list=libmsisync_to_archive.so,libmsi_update_unixfilesystem_resource_free_space.so
msi.other.list=
+
+######################################
+# global feature flags
+# controls access to features globally
+metalnx.enable.tickets=false
diff --git a/packaging/src/.gitignore b/packaging/src/.gitignore
new file mode 100644
index 000000000..ec484d1fd
--- /dev/null
+++ b/packaging/src/.gitignore
@@ -0,0 +1 @@
+test*.properties
diff --git a/packaging/src/emc-metalnx-core/attic/TestCreateTicketWithGroupRestriction.java b/packaging/src/emc-metalnx-core/attic/TestCreateTicketWithGroupRestriction.java
new file mode 100755
index 000000000..75e43c699
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/attic/TestCreateTicketWithGroupRestriction.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.services.tests.tickets;
+
+import com.emc.metalnx.core.domain.entity.DataGridTicket;
+import com.emc.metalnx.core.domain.exceptions.DataGridConnectionRefusedException;
+import com.emc.metalnx.core.domain.exceptions.DataGridException;
+import com.emc.metalnx.core.domain.exceptions.DataGridTicketException;
+import com.emc.metalnx.services.interfaces.IRODSServices;
+import com.emc.metalnx.services.interfaces.TicketService;
+import org.irods.jargon.core.exception.JargonException;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.web.WebAppConfiguration;
+
+import java.util.List;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * Test iRODS services.
+ */
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration("classpath:test-services-context.xml")
+@WebAppConfiguration
+public class TestCreateTicketWithGroupRestriction {
+ private static final String PUBLIC_GROUP = "public";
+
+ @Value("${irods.zoneName}")
+ private String zone;
+
+ @Value("${jobs.irods.username}")
+ private String username;
+
+ @Autowired
+ private TicketService ticketService;
+
+ @Autowired
+ private IRODSServices irodsServices;
+
+ private String targetPath, ticketString;
+ private TestTicketUtils ticketUtils;
+ private DataGridTicket dgt;
+
+ @Before
+ public void setUp() throws DataGridException, JargonException {
+ String parentPath = String.format("/%s/home", zone);
+ targetPath = String.format("%s/%s", parentPath, username);
+ ticketUtils = new TestTicketUtils(irodsServices);
+
+ dgt = new DataGridTicket(targetPath);
+ dgt.addGroup(PUBLIC_GROUP);
+ }
+
+ @After
+ public void tearDown() throws JargonException {
+ ticketUtils.deleteTicket(ticketString);
+ }
+
+ @Test
+ public void testCreateTicketWithHostRestriction() throws DataGridConnectionRefusedException,
+ DataGridTicketException, JargonException {
+ ticketString = ticketService.create(dgt);
+ List groups = ticketUtils.listAllGroupRestrictionsForSpecifiedTicket(ticketString);
+
+ assertEquals(1, groups.size());
+ assertTrue(groups.contains(PUBLIC_GROUP));
+ }
+}
diff --git a/packaging/src/emc-metalnx-core/attic/TestDownloadWithTicket.java b/packaging/src/emc-metalnx-core/attic/TestDownloadWithTicket.java
new file mode 100755
index 000000000..06b4fa365
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/attic/TestDownloadWithTicket.java
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.services.tests.tickets;
+
+import com.emc.metalnx.core.domain.exceptions.DataGridConnectionRefusedException;
+import com.emc.metalnx.core.domain.exceptions.DataGridException;
+import com.emc.metalnx.core.domain.exceptions.DataGridTicketDownloadException;
+import com.emc.metalnx.core.domain.exceptions.DataGridTicketInvalidUserException;
+import com.emc.metalnx.services.interfaces.IRODSServices;
+import com.emc.metalnx.services.interfaces.TicketClientService;
+import org.apache.commons.io.FileUtils;
+import org.irods.jargon.core.exception.JargonException;
+import org.irods.jargon.core.pub.Stream2StreamAO;
+import org.irods.jargon.core.pub.io.IRODSFile;
+import org.irods.jargon.ticket.packinstr.TicketCreateModeEnum;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.web.WebAppConfiguration;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
+
+/**
+ * Test iRODS services.
+ */
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration("classpath:test-services-context.xml")
+@WebAppConfiguration
+public class TestDownloadWithTicket {
+ private static final String FILE_CONTENT = "Test for ticket";
+ private static final int BUFFER_SIZE = 4 * 1024 * 1024;
+
+ @Value("${irods.zoneName}")
+ private String zone;
+
+ @Value("${jobs.irods.username}")
+ private String username;
+
+ @Autowired
+ private IRODSServices irodsServices;
+
+ @Autowired
+ private TicketClientService ticketClientService;
+
+ private String targetPath, filePath, ticketString;
+ private TestTicketUtils ticketUtils;
+ private File localFile, fileFromIRods;
+
+ @Before
+ public void setUp() throws DataGridException, JargonException, IOException {
+ String parentPath = String.format("/%s/home", zone);
+ targetPath = String.format("%s/%s", parentPath, username);
+ ticketUtils = new TestTicketUtils(irodsServices);
+ localFile = ticketUtils.createLocalFile();
+ ticketString = ticketUtils.createTicket(parentPath, username, TicketCreateModeEnum.READ);
+ uploadFileToIRODS(targetPath, localFile);
+ filePath = String.format("%s/%s", targetPath, localFile.getName());
+ }
+
+ @After
+ public void tearDown() throws JargonException, DataGridConnectionRefusedException {
+ FileUtils.deleteQuietly(localFile);
+ FileUtils.deleteQuietly(fileFromIRods);
+ ticketUtils.deleteTicket(ticketString);
+ ticketUtils.deleteIRODSFile(filePath);
+ }
+
+ @Test
+ public void testDownloadFileUsingATicket() throws DataGridTicketDownloadException, DataGridTicketInvalidUserException,
+ IOException {
+ fileFromIRods = ticketClientService.getFileFromIRODSUsingTicket(ticketString, filePath);
+ assertNotNull(fileFromIRods);
+ assertEquals(TestTicketUtils.TICKET_FILE_CONTENT, FileUtils.readFileToString(fileFromIRods, StandardCharsets.UTF_8.name()));
+ }
+
+ private void uploadFileToIRODS(String path, File file) throws DataGridConnectionRefusedException, JargonException,
+ IOException {
+ IRODSFile targetFile = irodsServices.getIRODSFileFactory().instanceIRODSFile(path, file.getName());
+
+ if (targetFile.exists()) {
+ return;
+ }
+
+ Stream2StreamAO streamAO = irodsServices.getStream2StreamAO();
+ InputStream inputStream = new FileInputStream(file);
+ streamAO.transferStreamToFileUsingIOStreams(inputStream, (File) targetFile, 0, BUFFER_SIZE);
+ inputStream.close();
+ targetFile.close();
+ }
+}
diff --git a/packaging/src/emc-metalnx-core/attic/TestResourceService.java b/packaging/src/emc-metalnx-core/attic/TestResourceService.java
new file mode 100755
index 000000000..593b41f14
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/attic/TestResourceService.java
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.services.tests.resource;
+
+import com.emc.metalnx.core.domain.entity.DataGridResource;
+import com.emc.metalnx.core.domain.exceptions.DataGridConnectionRefusedException;
+import com.emc.metalnx.services.interfaces.ResourceService;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.web.WebAppConfiguration;
+
+import java.util.Date;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * Test Resource service.
+ */
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration("classpath:test-services-context.xml")
+@WebAppConfiguration
+public class TestResourceService {
+
+ public static final String RODSADMIN = "rodsadmin";
+
+ @Value("${irods.zoneName}")
+ private String zone;
+
+ @Value("${irods.host}")
+ private String host;
+
+ @Autowired
+ private ResourceService resourceService;
+
+ private String parentRescName, childRescName;
+
+ private DataGridResource parentResc, childResc;
+
+ @Before
+ public void setUp() throws DataGridConnectionRefusedException {
+ long time = System.currentTimeMillis();
+ parentRescName = "testResc" + time;
+ childRescName = "testRescChild" + time;
+ Date date = new Date();
+
+ parentResc = new DataGridResource();
+ parentResc.setName(parentRescName);
+ parentResc.setType("compound");
+ parentResc.setZone(zone);
+ parentResc.setCreateTime(date);
+ parentResc.setModifyTime(date);
+ parentResc.setFreeSpaceDate(date);
+ parentResc.setPath("/var/lib/irods/iRODS/Vault2");
+ parentResc.setHost(host);
+
+ childResc = new DataGridResource();
+ childResc.setName(childRescName);
+ childResc.setType("unixfilesystem");
+ childResc.setZone(zone);
+ childResc.setCreateTime(date);
+ childResc.setModifyTime(date);
+ childResc.setFreeSpaceDate(date);
+ childResc.setPath("/var/lib/irods/iRODS/Vault2");
+ childResc.setHost(host);
+
+ resourceService.createResource(parentResc);
+ }
+
+ @After
+ public void tearDown() throws DataGridConnectionRefusedException {
+ if (resourceService.find(parentRescName) != null)
+ resourceService.deleteResource(parentRescName);
+
+ if (resourceService.find(childRescName) != null)
+ resourceService.deleteResource(childRescName);
+ }
+
+ @Test
+ public void testDeleteResourceByName() {
+ assertTrue(resourceService.deleteResource(parentRescName));
+ }
+
+ @Test
+ public void testDeleteResourceWithChildren() throws DataGridConnectionRefusedException {
+ resourceService.createResource(childResc);
+ resourceService.addChildToResource(parentRescName, childRescName);
+
+ assertTrue(resourceService.deleteResource(parentRescName));
+ assertNotNull(resourceService.find(childRescName));
+ }
+
+
+}
diff --git a/packaging/src/emc-metalnx-core/attic/TestRuleDeploymentService.java b/packaging/src/emc-metalnx-core/attic/TestRuleDeploymentService.java
new file mode 100755
index 000000000..efd48a3c5
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/attic/TestRuleDeploymentService.java
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.services.tests.rules;
+
+import com.emc.metalnx.core.domain.entity.DataGridCollectionAndDataObject;
+import com.emc.metalnx.core.domain.exceptions.DataGridConnectionRefusedException;
+import com.emc.metalnx.core.domain.exceptions.DataGridException;
+import com.emc.metalnx.core.domain.exceptions.DataGridRuleException;
+import com.emc.metalnx.services.interfaces.*;
+import com.emc.metalnx.services.irods.ResourceServiceImpl;
+import com.emc.metalnx.services.irods.RuleDeploymentServiceImpl;
+import org.irods.jargon.core.exception.JargonException;
+import org.irods.jargon.core.pub.io.IRODSFile;
+import org.irods.jargon.core.pub.io.IRODSFileFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.*;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.mock.web.MockMultipartFile;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.web.WebAppConfiguration;
+import org.springframework.test.util.ReflectionTestUtils;
+
+import java.util.HashMap;
+import java.util.List;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.*;
+
+/**
+ * Test for Rule Service
+ */
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration("classpath:test-services-context.xml")
+@WebAppConfiguration
+public class TestRuleDeploymentService {
+ private static final String TEST_RULE_NAME = "test_rule_deployment.re";
+ private static final String RULE_CACHE_DIR = ".rulecache";
+ public static final String RULE_FILE_EXTENSION = ".re";
+
+ @Autowired
+ private CollectionService collectionService;
+
+ @Autowired
+ private IRODSServices irodsServices;
+
+ @Autowired
+ private ConfigService configService;
+
+ @Spy
+ private ResourceService resourceService = new ResourceServiceImpl();
+
+ @Mock
+ private RuleService ruleService;
+
+ @InjectMocks
+ private RuleDeploymentService ruleDeploymentService;
+
+ private MockMultipartFile file;
+ private String ruleCachePath;
+
+ @Before
+ public void setUp() throws DataGridRuleException, DataGridConnectionRefusedException, JargonException {
+ ruleCachePath = String.format("/%s/%s", configService.getIrodsZone(), RULE_CACHE_DIR);
+
+ ruleDeploymentService = spy(RuleDeploymentServiceImpl.class); // partial mocking
+
+ MockitoAnnotations.initMocks(this);
+
+ ReflectionTestUtils.setField(ruleDeploymentService, "irodsServices", irodsServices);
+ ReflectionTestUtils.setField(ruleDeploymentService, "configService", configService);
+
+ removeRuleCacheColl();
+ createRuleCacheColl();
+
+ file = new MockMultipartFile(TEST_RULE_NAME, "Hello World".getBytes());
+
+ when(resourceService.find(anyString())).thenCallRealMethod();
+ when(ruleService.executeRule(anyString())).thenReturn(new HashMap<>());
+ }
+
+ @After
+ public void tearDown() throws DataGridConnectionRefusedException, JargonException {
+ removeRuleCacheColl();
+ }
+
+ @Test
+ public void testDeployRule() throws DataGridException {
+ ArgumentCaptor argCaptor = ArgumentCaptor.forClass(String.class);
+ ruleDeploymentService.deployRule(file);
+ verify(ruleService).execDeploymentRule(argCaptor.capture(), argCaptor.capture(), argCaptor.capture());
+ assertFalse(argCaptor.getAllValues().get(1).endsWith(RULE_FILE_EXTENSION));
+
+ List items =
+ collectionService.getSubCollectionsAndDataObjetsUnderPath(ruleCachePath);
+
+ boolean ruleInCache = false;
+ for(DataGridCollectionAndDataObject item: items) {
+ if(TEST_RULE_NAME.equals(item.getName())) {
+ ruleInCache = true;
+ break;
+ }
+ }
+
+ assertTrue(ruleInCache);
+ }
+
+ /**
+ * Create the rule cache collection in the grid
+ * @throws DataGridConnectionRefusedException
+ * @throws JargonException
+ */
+ private void createRuleCacheColl() throws DataGridConnectionRefusedException, JargonException {
+ IRODSFileFactory iff = irodsServices.getIRODSFileFactory();
+ IRODSFile ruleCacheColl = iff.instanceIRODSFile("/" + configService.getIrodsZone(), RULE_CACHE_DIR);
+ irodsServices.getIRODSFileSystemAO().mkdir(ruleCacheColl, false);
+ }
+
+ /**
+ * Removes the rule cache collection from the grid
+ * @throws JargonException
+ * @throws DataGridConnectionRefusedException
+ */
+ private void removeRuleCacheColl() throws JargonException, DataGridConnectionRefusedException {
+ IRODSFile collectionToBeRemoved = irodsServices.getIRODSFileFactory().instanceIRODSFile(ruleCachePath);
+ if(collectionToBeRemoved.exists()) {
+ irodsServices.getIRODSFileSystemAO().directoryDeleteForce(collectionToBeRemoved);
+ }
+ }
+}
diff --git a/packaging/src/emc-metalnx-core/attic/TestTicketAuthenticatedAccess.java b/packaging/src/emc-metalnx-core/attic/TestTicketAuthenticatedAccess.java
new file mode 100755
index 000000000..2538c82d0
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/attic/TestTicketAuthenticatedAccess.java
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.services.tests.ticketclient;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.commons.io.FileUtils;
+import org.irods.jargon.core.connection.IRODSAccount;
+import org.irods.jargon.core.exception.JargonException;
+import org.irods.jargon.core.pub.domain.DataObject;
+import org.irods.jargon.ticket.packinstr.TicketCreateModeEnum;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mockito;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.context.SecurityContext;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.web.WebAppConfiguration;
+
+import com.emc.metalnx.core.domain.exceptions.DataGridConnectionRefusedException;
+import com.emc.metalnx.core.domain.exceptions.DataGridException;
+import com.emc.metalnx.core.domain.exceptions.DataGridTicketInvalidUserException;
+import com.emc.metalnx.core.domain.exceptions.DataGridTicketUploadException;
+import com.emc.metalnx.services.auth.UserTokenDetails;
+import com.emc.metalnx.services.interfaces.IRODSServices;
+import com.emc.metalnx.services.interfaces.TicketClientService;
+import com.emc.metalnx.services.tests.tickets.TestTicketUtils;
+
+import junit.framework.Assert;
+
+/**
+ * Test iRODS services.
+ */
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration("classpath:test-services-context.xml")
+@WebAppConfiguration
+public class TestTicketAuthenticatedAccess {
+ private static final String RESOURCE = "demoResc";
+
+ @Value("${irods.zoneName}")
+ private String zone;
+
+ @Value("${irods.host}")
+ private String host;
+
+ @Value("${irods.port}")
+ private String port;
+
+ @Value("${jobs.irods.username}")
+ private String username;
+
+ @Value("${jobs.irods.password}")
+ private String password;
+
+ @Autowired
+ private TicketClientService ticketClientService;
+
+ @Autowired
+ private IRODSServices irodsServices;
+
+ private String ticketString, targetPath, filePath;
+ private TestTicketUtils ticketUtils;
+ private File localFile;
+
+ @Before
+ public void setUp() throws DataGridException, JargonException, IOException {
+ String parentPath = String.format("/%s/home", zone);
+ targetPath = String.format("%s/%s", parentPath, username);
+ ticketUtils = new TestTicketUtils(irodsServices);
+ ticketString = ticketUtils.createTicket(parentPath, username, TicketCreateModeEnum.WRITE);
+ localFile = ticketUtils.createLocalFile();
+ filePath = String.format("%s/%s", targetPath, localFile.getName());
+
+ IRODSAccount authIrodsAccount = IRODSAccount.instance(host, Integer.valueOf(port), username, password,
+ targetPath, zone, RESOURCE);
+
+ UserTokenDetails userTokenDetails = Mockito.mock(UserTokenDetails.class);
+
+ Authentication authentication = Mockito.mock(Authentication.class);
+ SecurityContext securityContext = Mockito.mock(SecurityContext.class);
+ SecurityContextHolder.setContext(securityContext);
+ Mockito.when(securityContext.getAuthentication()).thenReturn(authentication);
+ Mockito.when(authentication.getDetails()).thenReturn(userTokenDetails);
+ Mockito.when(userTokenDetails.getIrodsAccount()).thenReturn(authIrodsAccount);
+ }
+
+ @After
+ public void tearDown() throws JargonException, DataGridConnectionRefusedException {
+ FileUtils.deleteQuietly(localFile);
+ ticketUtils.deleteIRODSFile(filePath);
+ ticketUtils.deleteTicket(ticketString);
+ }
+
+ @Test
+ public void testTransferFileWithTicketAsAuthenticatedUser() throws DataGridTicketUploadException,
+ DataGridTicketInvalidUserException, DataGridConnectionRefusedException, JargonException {
+ ticketClientService.transferFileToIRODSUsingTicket(ticketString, localFile, targetPath);
+ DataObject obj = irodsServices.getDataObjectAO().findByCollectionNameAndDataName(targetPath,
+ localFile.getName());
+ Assert.assertEquals(username, obj.getDataOwnerName());
+ }
+}
diff --git a/packaging/src/emc-metalnx-core/attic/TestTicketWithGroupRestriction.java b/packaging/src/emc-metalnx-core/attic/TestTicketWithGroupRestriction.java
new file mode 100755
index 000000000..81f87e196
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/attic/TestTicketWithGroupRestriction.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.services.tests.ticketclient;
+
+import com.emc.metalnx.core.domain.exceptions.DataGridConnectionRefusedException;
+import com.emc.metalnx.core.domain.exceptions.DataGridException;
+import com.emc.metalnx.core.domain.exceptions.DataGridTicketInvalidUserException;
+import com.emc.metalnx.core.domain.exceptions.DataGridTicketUploadException;
+import com.emc.metalnx.services.interfaces.IRODSServices;
+import com.emc.metalnx.services.interfaces.TicketClientService;
+import com.emc.metalnx.services.tests.tickets.TestTicketUtils;
+import org.apache.commons.io.FileUtils;
+import org.irods.jargon.core.exception.JargonException;
+import org.irods.jargon.ticket.packinstr.TicketCreateModeEnum;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.web.WebAppConfiguration;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * Test iRODS services.
+ */
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration("classpath:test-services-context.xml")
+@WebAppConfiguration
+public class TestTicketWithGroupRestriction {
+ private static final String PUBLIC_GROUP = "public";
+
+ @Value("${irods.zoneName}")
+ private String zone;
+
+ @Value("${jobs.irods.username}")
+ private String username;
+
+ @Autowired
+ private TicketClientService ticketClientService;
+
+ @Autowired
+ private IRODSServices irodsServices;
+
+ private String targetPath, ticketString, filePath;
+ private TestTicketUtils ticketUtils;
+ private File localFile;
+
+ @Before
+ public void setUp() throws DataGridException, JargonException, IOException {
+ String parentPath = String.format("/%s/home", zone);
+ targetPath = String.format("%s/%s", parentPath, username);
+ ticketUtils = new TestTicketUtils(irodsServices);
+ ticketString = ticketUtils.createTicket(parentPath, username, TicketCreateModeEnum.WRITE);
+ ticketUtils.addGroupRestriction(ticketString, PUBLIC_GROUP);
+ localFile = ticketUtils.createLocalFile();
+ filePath = String.format("%s/%s", targetPath, localFile.getName());
+ }
+
+ @After
+ public void tearDown() throws JargonException, DataGridConnectionRefusedException {
+ FileUtils.deleteQuietly(localFile);
+ ticketUtils.deleteTicket(ticketString);
+ ticketUtils.deleteIRODSFile(filePath);
+ }
+
+ @Test(expected = DataGridTicketUploadException.class)
+ public void testTicketWithGroupRestriction() throws DataGridTicketUploadException, DataGridTicketInvalidUserException {
+ ticketClientService.transferFileToIRODSUsingTicket(ticketString, localFile, targetPath);
+ }
+}
diff --git a/packaging/src/emc-metalnx-core/attic/TestUploadWithTicket.java b/packaging/src/emc-metalnx-core/attic/TestUploadWithTicket.java
new file mode 100755
index 000000000..342559e88
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/attic/TestUploadWithTicket.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.services.tests.tickets;
+
+import com.emc.metalnx.core.domain.exceptions.DataGridConnectionRefusedException;
+import com.emc.metalnx.core.domain.exceptions.DataGridException;
+import com.emc.metalnx.core.domain.exceptions.DataGridTicketInvalidUserException;
+import com.emc.metalnx.core.domain.exceptions.DataGridTicketUploadException;
+import com.emc.metalnx.services.interfaces.IRODSServices;
+import com.emc.metalnx.services.interfaces.TicketClientService;
+import org.apache.commons.io.FileUtils;
+import org.irods.jargon.core.exception.JargonException;
+import org.irods.jargon.core.pub.io.IRODSFile;
+import org.irods.jargon.ticket.packinstr.TicketCreateModeEnum;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.web.WebAppConfiguration;
+
+import java.io.File;
+import java.io.IOException;
+
+import static junit.framework.Assert.assertTrue;
+
+/**
+ * Test iRODS services.
+ */
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration("classpath:test-services-context.xml")
+@WebAppConfiguration
+public class TestUploadWithTicket {
+ private static final String TEST_FILE_NAME = "test-ticket.txt";
+
+ @Value("${irods.zoneName}")
+ private String zone;
+
+ @Value("${jobs.irods.username}")
+ private String username;
+
+ @Autowired
+ private IRODSServices irodsServices;
+
+ @Autowired
+ private TicketClientService ticketClientService;
+
+ private String targetPath, filePath, ticketString;
+ private TestTicketUtils ticketUtils;
+ private File localFile;
+
+ @Before
+ public void setUp() throws DataGridException, JargonException, IOException {
+ String parentPath = String.format("/%s/home", zone);
+ targetPath = String.format("%s/%s", parentPath, username);
+ ticketUtils = new TestTicketUtils(irodsServices);
+ ticketString = ticketUtils.createTicket(parentPath, username, TicketCreateModeEnum.WRITE);
+ localFile = ticketUtils.createLocalFile();
+ filePath = String.format("%s/%s", targetPath, localFile.getName());
+ }
+
+ @After
+ public void tearDown() throws JargonException, DataGridConnectionRefusedException {
+ FileUtils.deleteQuietly(localFile);
+ ticketUtils.deleteTicket(ticketString);
+ ticketUtils.deleteIRODSFile(filePath);
+ }
+
+ @Test
+ public void testUploadFileUsingATicket() throws DataGridConnectionRefusedException,
+ DataGridTicketUploadException, DataGridTicketInvalidUserException, JargonException {
+ ticketClientService.transferFileToIRODSUsingTicket(ticketString, localFile, targetPath);
+ IRODSFile ticketIRODSFile = irodsServices.getIRODSFileFactory().instanceIRODSFile(filePath);
+ assertTrue(ticketIRODSFile.exists());
+ }
+}
diff --git a/packaging/src/emc-metalnx-core/pom.xml b/packaging/src/emc-metalnx-core/pom.xml
new file mode 100755
index 000000000..6e3a7afc5
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/pom.xml
@@ -0,0 +1,272 @@
+
+
+
+ 4.0.0
+
+ com.emc.metalnx
+ emc-metalnx
+ 1.4.0
+
+ emc-metalnx-core
+
+
+ javassist
+ javassist
+
+
+ org.hibernate
+ hibernate-core
+
+
+ org.hibernate
+ hibernate-validator
+
+
+ org.hibernate
+ hibernate-envers
+
+
+ org.springframework
+ spring-orm
+
+
+ org.springframework
+ spring-context
+
+
+ org.springframework
+ spring-tx
+
+
+ org.springframework.security
+ spring-security-web
+
+
+ org.springframework.security
+ spring-security-config
+
+
+ mysql
+ mysql-connector-java
+
+
+ postgresql
+ postgresql
+
+
+
+
+ com.fasterxml.jackson.core
+ jackson-core
+
+
+
+ com.fasterxml.jackson.core
+ jackson-annotations
+
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+
+
+
+
+
+
+
+
+ org.codehaus.mojo
+ jaxb2-maven-plugin
+ 1.5
+
+
+
+ xjc
+
+
+
+
+
+ -extension -npa -b "${project.basedir}/src/main/xsd/global.xjb"
+
+
+
+ maven-antrun-plugin
+
+
+
+ 0
+ validate
+
+
+
+
+
+ test.data.directory=${jargon.test.data.directory}
+ test.irods.admin=${jargon.test.irods.admin}
+ test.irods.admin.password=${jargon.test.irods.admin.password}
+ test.irods.user=${jargon.test.irods.user}
+ test.irods.password=${jargon.test.irods.password}
+ test.irods.resource=${jargon.test.irods.resource}
+ test2.irods.user=${jargon.test.irods.user2}
+ test2.irods.password=${jargon.test.irods.password2}
+ test2.irods.resource=${jargon.test.irods.resource2}
+ test3.irods.user=${jargon.test.irods.user3}
+ test3.irods.password=${jargon.test.irods.password3}
+ test3.irods.resource=${jargon.test.irods.resource3}
+ test.irods.host=${jargon.test.irods.host}
+ test.resource.host=${jargon.test.resource.host}
+ test.irods.port=${jargon.test.irods.port}
+ test.irods.zone=${jargon.test.irods.zone}
+ jargon.test.kerberos.user=${jargon.test.kerberos.user}
+ jargon.test.user.group=${jargon.test.user.group}
+ test.resource.group=${jargon.test.resource.group}
+ test.irods.userDN=${jargon.test.irods.userDN}
+ test.irods.scratch.subdir=${jargon.test.irods.scratch.subdir}
+ test.option.exercise.remoteexecstream=${jargon.test.option.exercise.remoteexecstream}
+ test.option.eirods=${test.option.eirods}
+ test.option.exercise.audit=${jargon.test.option.exercise.audit}
+ test.option.exercise.workflow=${jargon.test.option.exercise.workflow}
+ test.option.exercise.filesystem.mount=${jargon.test.option.exercise.filesystem.mount}
+ test.option.exercise.filesystem.mount.local=${jargon.test.option.exercise.filesystem.mount.local}
+ test.option.distributed.resources=${test.option.distributed.resources}
+ test.option.registration=${test.option.registration}
+ test.option.strictACL=${test.option.strictACL}
+ test.option.federated.zone=${test.option.federated.zone}
+ test.option.kerberos=${test.option.kerberos}
+ test.option.pam=${test.option.pam}
+ test.option.ssl.configured=${test.option.ssl.configured}
+ jargon.test.pam.user=${jargon.test.pam.user}
+ jargon.test.pam.password=${jargon.test.pam.password}
+ test.federated.irods.admin=${jargon.test.federated.irods.admin}
+ test.federated.irods.admin.password=${jargon.test.federated.irods.admin.password}
+ test.federated.irods.user=${jargon.test.federated.irods.user}
+ test.federated.irods.password=${jargon.test.federated.irods.password}
+ test.federated.irods.resource=${jargon.test.federated.irods.resource}
+ test.federated.irods.host=${jargon.test.federated.irods.host}
+ test.federated.irods.port=${jargon.test.federated.irods.port}
+ test.federated.irods.zone=${jargon.test.federated.irods.zone}
+ test.option.gsi=${test.option.gsi}
+ test.option.gsi.host=${test.option.gsi.host}
+ test.option.gsi.port=${test.option.gsi.port}
+ test.option.gsi.zone=${test.option.gsi.zone}
+ test.option.gsi.dn=${test.option.gsi.dn}
+ test.option.gsi.user=${test.option.gsi.user}
+ test.option.gsi.file=${test.option.gsi.file}
+ test.option.mount.basedir=${test.option.mount.basedir}
+ test.option.python=${test.option.python}
+
+
+
+
+ run
+
+
+
+
+ 2
+ validate
+
+
+
+
+
+ irods.host=${jargon.test.irods.host}
+ irods.port=${jargon.test.irods.port}
+ irods.zoneName=${jargon.test.irods.zone}
+ irods.admin.user=${jargon.test.irods.admin}
+ irods.admin.password=${jargon.test.irods.admin.password}
+
+
+ irods.auth.scheme=${metalnx.auth.scheme}
+ default.storage.resource=${jargon.test.irods.resource}
+ ssl.negotiation.policy=${metalnx.ssl.policy}
+
+ ##########################################################
+
+ utilize.packing.streams=${metalnx.packing.streams}
+
+
+ compute.checksum=${metalnx.compute.checksum}
+
+ ##########################################################
+
+ db.driverClassName=${metalnx.jdbc.driver}
+ db.url=${metalnx.jdbc.url}
+ db.username=${metalnx.jdbc.user}
+ db.password=${metalnx.jdbc.password}
+ hibernate.dialect=${metalnx.jdbc.dialect}
+
+
+ hibernate.show_sql=true
+ hibernate.format_sql=false
+
+
+ hibernate.hbm2ddl.auto=update
+
+
+ connection.pool_size=5
+
+ ######################################
+
+ jobs.irods.username=${jargon.test.irods.admin}
+ jobs.irods.password=${jargon.test.irods.admin.password}
+ jobs.irods.auth.scheme=${metalnx.auth.scheme}
+ runSyncJobs=true
+
+
+ rmd.connection.timeout=500
+ rmd.connection.port=8000
+
+ reverse.dns.lookup=false
+
+ ######################################
+
+ populate.msi.enabled=false
+ illumina.msi.enabled=true
+
+ msi.api.version=1.X.X
+
+ msi.metalnx.list=libmsiget_illumina_meta.so,libmsiobjget_microservices.so,libmsiobjget_version.so,libmsiobjjpeg_extract.so,libmsiobjput_mdbam.so,libmsiobjput_mdbam.so,libmsiobjput_mdmanifest.so,libmsiobjput_mdvcf.so,libmsiobjput_populate.so
+
+ msi.irods.list=libmsisync_to_archive.so,libmsi_update_unixfilesystem_resource_free_space.so,libmsiobjput_http.so,libmsiobjput_irods.so,libmsiobjget_irods.so,libmsiobjget_http.so,libmsiobjput_slink.so,libmsiobjget_slink.so
+
+ msi.irods.42.list=libmsisync_to_archive.so,libmsi_update_unixfilesystem_resource_free_space.so
+
+ msi.other.list=
+
+ resource.location.images=/images/,classpath:static/images/
+ resource.location.fonts=/fonts/,classpath:static/fonts/
+ resource.location.css=/css/,classpath:static/css/
+ resource.location.js=/js/,classpath:static/js/
+ resource.location.i18=classpath:i18n/messages
+ resource.location.i18-users=classpath:i18n-users/messages
+
+
+
+
+
+ run
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/FavoriteDao.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/FavoriteDao.java
new file mode 100755
index 000000000..3a13bc45d
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/FavoriteDao.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.metalnx.core.domain.dao;
+
+import com.emc.metalnx.core.domain.entity.DataGridUser;
+import com.emc.metalnx.core.domain.entity.DataGridUserFavorite;
+
+import java.util.List;
+
+public interface FavoriteDao {
+
+ /**
+ * Retrieve a given Favorite based on the user and path
+ *
+ * @param user
+ * @param path
+ * @return a {@link DataGridUserFavorite}
+ */
+ DataGridUserFavorite findByUserAndPath(DataGridUser user, String path);
+
+ /**
+ * Add a favorite to a user using the path and user entity
+ *
+ * @param user
+ * data grid user to add the favorite to
+ * @param path
+ * path to the collection/data object to be added as a favorite
+ * @param isCollection
+ * indicates whether a path is a collection or a file
+ * @return a confirmation that the insertion has been successfully
+ */
+ Long addByUserAndPath(DataGridUser user, String path, boolean isCollection);
+
+ /**
+ * Removes a favorite based on the path and the user
+ *
+ * @param user
+ * @param path
+ * @return a confirmation that the deletion has been successful
+ */
+ boolean removeByUserAndPath(DataGridUser user, String path);
+
+ /**
+ * Removes a favorite based on the user
+ *
+ * @param {@link DataGridUser} user
+ * @return a confirmation that the deletion has been successful
+ */
+ boolean removeByUser(DataGridUser user);
+
+ /**
+ * Retrieve a given Favorite based on the user
+ *
+ * @param user
+ * @return list of {@link DataGridUserFavorite}
+ */
+ List findByUser(DataGridUser user);
+
+ /**
+ * Retrieves all the favorites on a given path
+ *
+ * @param path
+ * @return list of {@link DataGridUserFavorite}
+ */
+ List findFavoritesByPath(String path);
+
+ /**
+ * Removes a favorite based on the given path
+ *
+ * @param path
+ * path to remove any favorite
+ * @return a confirmation that the deletion has been successful
+ */
+ boolean removeByPath(String path);
+
+ /**
+ * Removes all existing favorites whose parent path is the given path. Basically, if the
+ * following favorites exist:
+ * a/b/c
+ * a/b/c/d
+ * x/y/z/a/b/c
+ * and the directory "a" gets deleted. Both "a/b/c" and "a/b/c/d" should be removed from
+ * favorites since they no longer exist. But "x/y/z/a/b/c" should be kept.
+ *
+ * @param parentPath
+ * path to remove any favorite
+ * @return a confirmation that the deletion has been successful
+ */
+ boolean removeByParentPath(String parentPath);
+
+ /**
+ * Find list of favorites paginated
+ *
+ * @param user
+ * @param offset
+ * represents the starting row in the query
+ * @param limit
+ * how many elements will have the result
+ * @param searchString
+ * is different from null if filter is used
+ * @param orderBy
+ * order by a column
+ * @param orderDir
+ * the direction of the order can be 'desc' or 'asc'
+ * @param onlyCollections
+ * indicates if results should contain only collections
+ * @return list of {@link DataGridUserFavorite}
+ */
+ List findByUserPaginated(DataGridUser user, int offset, int limit, String searchString, String orderBy, String orderDir,
+ boolean onlyCollections);
+
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/GroupBookmarkDao.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/GroupBookmarkDao.java
new file mode 100755
index 000000000..7a4df24b9
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/GroupBookmarkDao.java
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.metalnx.core.domain.dao;
+
+import com.emc.metalnx.core.domain.dao.generic.GenericDao;
+import com.emc.metalnx.core.domain.entity.DataGridGroup;
+import com.emc.metalnx.core.domain.entity.DataGridGroupBookmark;
+
+import java.util.List;
+
+public interface GroupBookmarkDao extends GenericDao {
+
+ /**
+ * Add a bookmark to a group using the path and group entity
+ *
+ * @param group
+ * @param path
+ * @param isCollection
+ * @return a confirmation that the insertion has been successfully
+ */
+ public Long addByGroupAndPath(DataGridGroup group, String path, boolean isCollection);
+
+ /**
+ * Removes a bookmark based on the path and the group
+ *
+ * @param group
+ * @param path
+ * @return a confirmation that the deletion has been successfully
+ */
+ public boolean removeByGroupAndPath(DataGridGroup group, String path);
+
+ /**
+ * Removes a bookmark based on the group
+ *
+ * @param group
+ * @return a confirmation that the deletion has been successfully
+ */
+ public boolean removeByGroup(DataGridGroup group);
+
+ /**
+ * Retrieve a given GroupBookmark based on the group
+ *
+ * @param group
+ * @return a {@link DataGridGroupBookmark}
+ */
+ public List findByGroup(DataGridGroup group);
+
+ /**
+ * Retrieves all the bookmarks on a given path
+ *
+ * @param path
+ * @return list of {@link DataGridGroupBookmark}
+ */
+ public List findBookmarksByPath(String path);
+
+ /**
+ * Removes a bookmark based on the given path
+ *
+ * @param path
+ * path to remove any bookmark
+ * @return a confirmation that the deletion has been successful
+ */
+ public boolean removeByPath(String path);
+
+ /**
+ * Removes all existing bookmarks whose parent path is the given path. Basically, if the
+ * following bookmarks exist:
+ * a/b/c
+ * a/b/c/d
+ * x/y/z/a/b/c
+ * and the directory "a" gets deleted. Both "a/b/c" and "a/b/c/d" should be removed from
+ * bookmarks since they no longer exist. But "x/y/z/a/b/c" should be kept.
+ *
+ * @param parentPath
+ * path to remove any bookmark
+ * @return a confirmation that the deletion has been successful
+ */
+ public boolean removeByParentPath(String parentPath);
+
+ /**
+ * Find group bookmarks with limits and filter for pagination
+ *
+ * @param groupIds
+ * @param offset
+ * @param limit
+ * @param searchString
+ * @param orderBy
+ * @param orderDir
+ * @param onlyCollections
+ * @return
+ */
+ public List findGroupBookmarksByGroupsIds(String[] groupIds, int offset, int limit, String searchString, String orderBy,
+ String orderDir, boolean onlyCollections);
+
+ /**
+ * Gives the total number of group bookmarks for a list of groups
+ *
+ * @param groupIds
+ * @return
+ */
+ public Long countGroupBookmarksByGroupsIds(String[] groupIds);
+
+ /**
+ * Changes an existing bookmark to a new value.
+ *
+ * @param oldPath
+ * existing path that will be updated
+ * @param newPath
+ * new path
+ * @return True, if oldePath was successfully changed to newPath. False, otherwise.
+ */
+ boolean updateBookmark(String oldPath, String newPath);
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/GroupDao.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/GroupDao.java
new file mode 100755
index 000000000..c5597afcd
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/GroupDao.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.metalnx.core.domain.dao;
+
+import com.emc.metalnx.core.domain.dao.generic.GenericDao;
+import com.emc.metalnx.core.domain.entity.DataGridGroup;
+
+import java.util.List;
+
+public interface GroupDao extends GenericDao {
+
+ /**
+ * Find a group by its name
+ * @param groupname
+ * @return List of groups
+ */
+ List findByGroupname(String groupname);
+
+ /**
+ * Find group by group and zone
+ * @param groupname
+ * @param zone
+ * @return
+ */
+ DataGridGroup findByGroupnameAndZone(String groupname, String zone);
+
+ /**
+ * Deletes a group by its group
+ * @param groupname
+ * @return
+ */
+ boolean deleteByGroupname(String groupname);
+
+ /**
+ * Deletes a group by its id
+ * @param id
+ * @return true if a group whose id matches with the id parameter
+ */
+ boolean deleteByDataGridGroupId(long id);
+
+ /**
+ * Finds groups that match the specified query
+ * @param query
+ * @return list of groups
+ */
+ public List findByQueryString(String query);
+
+ /**
+ * Finds all groups that match the input Data Grid IDs.
+ * @param ids
+ * @return list of groups
+ */
+ public List findByDataGridIdList(String[] ids);
+
+ /**
+ * Finds all groups that match the input Data Grid Group names.
+ * @param ids
+ * @return list of group names
+ */
+ public List findByGroupNameList(String[] groupNames);
+
+ /**
+ * Finds all groups that match the input Data Grid IDs.
+ * @param ids
+ * @return list of groups
+ */
+ public List findByIdList(Long[] ids);
+
+ /**
+ * Finds a group that matches the input Data Grid ID.
+ * @param id
+ * @return DataGridGroup
+ */
+ public DataGridGroup findByDataGridId(long id);
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/TemplateDao.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/TemplateDao.java
new file mode 100755
index 000000000..ab3ef4376
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/TemplateDao.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.metalnx.core.domain.dao;
+
+import com.emc.metalnx.core.domain.dao.generic.GenericDao;
+import com.emc.metalnx.core.domain.entity.DataGridTemplate;
+import com.emc.metalnx.core.domain.entity.DataGridTemplateField;
+
+import java.util.List;
+
+public interface TemplateDao extends GenericDao {
+
+ /**
+ * Gets the template id based on its name (the template name given has to
+ * match exactly the template name existing in the database).
+ *
+ * @param templateName
+ * name of the template
+ * @return the template id if the template is found. Null, otherwise.
+ */
+ long getTemplateId(String templateName);
+
+ /**
+ * Find a template by its name
+ *
+ * @param templateName
+ * name of the template
+ * @return Template matching the name
+ */
+ DataGridTemplate findByName(String templateName);
+
+ /**
+ * Find a template by its id
+ *
+ * @param id
+ * template id
+ * @return Template if the id exists. Null, if the id was not found.
+ */
+ DataGridTemplate findById(long id);
+
+ /**
+ * Deletes a template by its id
+ *
+ * @param id
+ * id of the template to be removed
+ * @return true if the template was successfully removed. False, otherwise.
+ */
+ boolean deleteById(long id);
+
+ /**
+ * Finds templates by a query string
+ *
+ * @param query
+ * string containing the search term to match template names
+ * @return list of templates
+ */
+ List findByQueryString(String query);
+
+ /**
+ * Lists all fields existing in a template
+ *
+ * @param template
+ * name of the template
+ * @return List of template fields, if any
+ */
+ List listTemplateFields(String template);
+
+ /**
+ * Lists all fields existing in a template
+ *
+ * @param id
+ * id of the template
+ * @return List of template fields, if any
+ */
+ List listTemplateFields(Long id);
+
+ /**
+ * Returns all the public metadata templates
+ *
+ * @return List of template fields, if any
+ */
+ List listPublicTemplates();
+
+ /**
+ * Returns all the private metadata templates
+ *
+ * @return List of template fields, if any
+ */
+ List listPrivateTemplatesByUser(String user);
+
+ @Override
+ /**
+ * Overrides the merge method in order to handle the version number of the
+ * current template.
+ */
+ void merge(DataGridTemplate template);
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/TemplateFieldDao.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/TemplateFieldDao.java
new file mode 100755
index 000000000..93b7ac046
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/TemplateFieldDao.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.metalnx.core.domain.dao;
+
+import com.emc.metalnx.core.domain.dao.generic.GenericDao;
+import com.emc.metalnx.core.domain.entity.DataGridTemplateField;
+import com.emc.metalnx.core.domain.exceptions.DataGridTemplateAttrException;
+import com.emc.metalnx.core.domain.exceptions.DataGridTemplateUnitException;
+import com.emc.metalnx.core.domain.exceptions.DataGridTemplateValueException;
+
+public interface TemplateFieldDao extends GenericDao {
+
+ /**
+ * Find a template field by its id
+ *
+ * @param id
+ * template field id
+ * @return Template if the id exists. Null, if the id was not found.
+ */
+ DataGridTemplateField findById(long id);
+
+ /**
+ * Modify a template field by its id
+ *
+ * @param id
+ * id of the template field to be removed
+ * @return true if the template field was successfully modified. False, otherwise.
+ * @throws DataGridTemplateAttrException
+ * @throws DataGridTemplateValueException
+ * @throws DataGridTemplateUnitException
+ */
+ boolean modifyById(long id, String attribute, String value, String unit) throws DataGridTemplateAttrException, DataGridTemplateValueException,
+ DataGridTemplateUnitException;
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/UserBookmarkDao.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/UserBookmarkDao.java
new file mode 100755
index 000000000..948b4d526
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/UserBookmarkDao.java
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.metalnx.core.domain.dao;
+
+import com.emc.metalnx.core.domain.dao.generic.GenericDao;
+import com.emc.metalnx.core.domain.entity.DataGridUser;
+import com.emc.metalnx.core.domain.entity.DataGridUserBookmark;
+
+import java.util.List;
+
+public interface UserBookmarkDao extends GenericDao {
+
+ /**
+ * Add a bookmark to a user using the path and user entity
+ *
+ * @param user
+ * data grid user to add the bookmark to
+ * @param path
+ * path to the collection/data object to be added as a bookmark
+ * @param isCollection
+ * indicates whether a path is a collection or a file
+ * @return a confirmation that the insertion has been successfully
+ */
+ public Long addByUserAndPath(DataGridUser user, String path, boolean isCollection);
+
+ /**
+ * Removes a bookmark based on the path and the user
+ *
+ * @param user
+ * @param path
+ * @return a confirmation that the deletion has been successful
+ */
+ public boolean removeByUserAndPath(DataGridUser user, String path);
+
+ /**
+ * Removes a bookmark based on the given path
+ *
+ * @param path
+ * path to remove any bookmark
+ * @return a confirmation that the deletion has been successful
+ */
+ public boolean removeByPath(String path);
+
+ /**
+ * Removes a bookmark based on the given user
+ *
+ * @param path
+ * path to remove any bookmark
+ * @return a confirmation that the deletion has been successful
+ */
+ public boolean removeByUser(DataGridUser user);
+
+ /**
+ * Removes all existing bookmarks whose parent path is the given path. Basically, if the
+ * following bookmarks exist:
+ * a/b/c
+ * a/b/c/d
+ * x/y/z/a/b/c
+ * and the directory "a" gets deleted. Both "a/b/c" and "a/b/c/d" should be removed from
+ * bookmarks since they no longer exist. But "x/y/z/a/b/c" should be kept.
+ *
+ * @param parentPath
+ * path to remove any bookmark
+ * @return a confirmation that the deletion has been successful
+ */
+ public boolean removeByParentPath(String parentPath);
+
+ /**
+ * Retrieve a given UserBookmark based on the user and path
+ *
+ * @param user
+ * @param path
+ * @return a {@link DataGridUserBookmark}
+ */
+ public DataGridUserBookmark findByUserAndPath(DataGridUser user, String path);
+
+ /**
+ * Retrieve a given UserBookmark based on the user
+ *
+ * @param user
+ * @return a {@link DataGridUserBookmark}
+ */
+ public List findByUser(DataGridUser user);
+
+ /**
+ * Retrieves all the bookmarks on a given path
+ *
+ * @param path
+ * @return list of {@link DataGridUserBookmark}
+ */
+ public List findBookmarksByPath(String path);
+
+ /**
+ * Find list of bookmarks paginated
+ *
+ * @param user
+ * @param start
+ * represents the starting row in the query
+ * @param length
+ * how many elements will have the result
+ * @param searchString
+ * is different from null if filter is used
+ * @param orderBy
+ * order by a column
+ * @param orderDir
+ * the direction of the order can be 'desc' or 'asc'
+ * @param onlyCollections
+ * indicates if the results should contain only collections
+ * @return list of {@link DataGridUserBookmark}
+ */
+ public List findByUserPaginated(DataGridUser user, int start, int length, String searchString, String orderBy,
+ String orderDir, boolean onlyCollections);
+
+ /**
+ * Find list of bookmarks paginated
+ *
+ * @param user
+ * @param start
+ * represents the starting row in the query
+ * @param length
+ * how many elements will have the result
+ * @param searchString
+ * is different from null if filter is used
+ * @param orderBy
+ * list of columns the database will order the results by
+ * @param orderDir
+ * list of directions (ASC or DESC) that will applied to the columns in the order by
+ * clause
+ * @param onlyCollections
+ * indicates if the results should contain only collections
+ * @return list of {@link DataGridUserBookmark}
+ */
+ public List findByUserPaginated(DataGridUser user, int start, int length, String searchString, List orderBy,
+ List orderDir, boolean onlyCollections);
+
+ /**
+ * Changes an existing bookmark to a new value.
+ *
+ * @param oldPath
+ * existing path that will be updated
+ * @param newPath
+ * new path
+ * @return True, if oldePath was successfully changed to newPath. False, otherwise.
+ */
+ boolean updateBookmark(String oldPath, String newPath);
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/UserDao.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/UserDao.java
new file mode 100755
index 000000000..090758468
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/UserDao.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.metalnx.core.domain.dao;
+
+import com.emc.metalnx.core.domain.dao.generic.GenericDao;
+import com.emc.metalnx.core.domain.entity.DataGridUser;
+
+import java.util.List;
+
+public interface UserDao extends GenericDao {
+
+ /**
+ * Find a user by his ID
+ * @param ids
+ * @return DataGridUser
+ */
+ DataGridUser findByDataGridId(long id);
+
+ /**
+ * Find a list of users by their IDs
+ * @param ids
+ * @return List of users
+ */
+ List findByDataGridIdList(String[] ids);
+
+ /**
+ * Find a user by its username
+ * @param username
+ * @return List of users
+ */
+ List findByUsername(String username);
+
+ /**
+ * Find user by username and zone
+ * @param username
+ * @param zone
+ * @return
+ */
+ DataGridUser findByUsernameAndZone(String username, String zone);
+
+ /**
+ * Deletes a user by hid id
+ * @param username
+ * @param zone
+ * @return
+ */
+ boolean deleteByDataGridId(long id);
+
+ /**
+ * Deletes a user by its username
+ * @param username
+ * @param zone
+ * @return
+ */
+ boolean deleteByUsername(String username);
+
+ /**
+ * Finds users matching the specified query
+ * @param query
+ * @return list of users
+ */
+ public List findByQueryString(String query);
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/UserProfileDao.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/UserProfileDao.java
new file mode 100755
index 000000000..66f600d9d
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/UserProfileDao.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.metalnx.core.domain.dao;
+
+import com.emc.metalnx.core.domain.dao.generic.GenericDao;
+import com.emc.metalnx.core.domain.entity.UserProfile;
+
+import java.util.List;
+
+public interface UserProfileDao extends GenericDao {
+
+ /**
+ * Returns the list of UserProfiles matching the input string.
+ * @param query
+ * @return
+ */
+ List findByQueryString(String query);
+
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/generic/GenericDao.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/generic/GenericDao.java
new file mode 100755
index 000000000..7d7c5e6b7
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/generic/GenericDao.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.metalnx.core.domain.dao.generic;
+
+import org.hibernate.Query;
+
+import java.io.Serializable;
+import java.util.List;
+
+@SuppressWarnings("rawtypes")
+public interface GenericDao {
+
+ /**
+ * Persists a new entry on the database.
+ * @param entity
+ */
+ public id save(T entity);
+
+ /**
+ * Updates an existing entry on the database.
+ * @param entity
+ */
+ public void merge(T entity);
+
+ /**
+ * Deletes an entry from the database.
+ * @param entity
+ */
+ public void delete(T entity);
+
+ /**
+ * Returns a list of entities of class T matching the query.
+ * @param query
+ * @return
+ */
+ public List findMany(Query query);
+
+ /**
+ * Returns one single entity of class T matching the query.
+ * @param query
+ * @return
+ */
+ public T findOne(Query query);
+
+ /**
+ * Returns all the entries for the class.
+ * @param clazz
+ * @return
+ */
+ public List findAll(Class clazz);
+
+ /**
+ * Find an entry by its ID.
+ * @param clazz
+ * @param id
+ * @return
+ */
+ public T findByID(Class clazz, Long id);
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/generic/GenericDaoImpl.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/generic/GenericDaoImpl.java
new file mode 100755
index 000000000..6e50b9309
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/generic/GenericDaoImpl.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.metalnx.core.domain.dao.generic;
+
+import org.hibernate.Query;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.io.Serializable;
+import java.util.List;
+
+@Component
+@Transactional
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public abstract class GenericDaoImpl implements GenericDao {
+
+ @Resource(name = "sessionFactory")
+ private SessionFactory sessionFactory;
+
+ protected Session getSession() {
+ return sessionFactory.getCurrentSession();
+ }
+
+ public id save(T entity) {
+ Session hibernateSession = this.getSession();
+ return (id) hibernateSession.save(entity);
+ }
+
+ public void merge(T entity) {
+ Session hibernateSession = this.getSession();
+ hibernateSession.merge(entity);
+ }
+
+ public void delete(T entity) {
+ Session hibernateSession = this.getSession();
+ hibernateSession.delete(entity);
+ }
+
+ public List findMany(Query query) {
+ List t;
+ t = (List) query.list();
+ return t;
+ }
+
+ public T findOne(Query query) {
+ T t;
+ t = (T) query.uniqueResult();
+ return t;
+ }
+
+ public T findByID(Class clazz, Long id) {
+ Session hibernateSession = this.getSession();
+ T t = null;
+ t = (T) hibernateSession.get(clazz, id);
+ return t;
+ }
+
+ public List findAll(Class clazz) {
+ Session hibernateSession = this.getSession();
+ List T = null;
+ Query query = hibernateSession.createQuery("from " + clazz.getName());
+ T = query.list();
+ return T;
+ }
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/impl/FavoriteDaoImpl.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/impl/FavoriteDaoImpl.java
new file mode 100755
index 000000000..70ca0d352
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/impl/FavoriteDaoImpl.java
@@ -0,0 +1,195 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.metalnx.core.domain.dao.impl;
+
+import com.emc.metalnx.core.domain.dao.FavoriteDao;
+import com.emc.metalnx.core.domain.dao.UserDao;
+import com.emc.metalnx.core.domain.dao.generic.GenericDaoImpl;
+import com.emc.metalnx.core.domain.entity.DataGridUser;
+import com.emc.metalnx.core.domain.entity.DataGridUserFavorite;
+import org.hibernate.Query;
+import org.hibernate.SessionFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Repository;
+
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+
+@Repository
+@SuppressWarnings("unchecked")
+public class FavoriteDaoImpl extends GenericDaoImpl implements FavoriteDao {
+
+ private static final Logger logger = LoggerFactory.getLogger(FavoriteDaoImpl.class);
+
+ @Autowired
+ private SessionFactory sessionFactory;
+
+ @Autowired
+ UserDao userDao;
+
+ @Override
+ public DataGridUserFavorite findByUserAndPath(DataGridUser user, String path) {
+ if(user == null || path == null || path.isEmpty()) return null;
+
+ Query q = sessionFactory.getCurrentSession().createQuery("from DataGridUserFavorite where user_id = :user_id and path = :path");
+ q.setLong("user_id", user.getId());
+ q.setString("path", path);
+ return (DataGridUserFavorite) q.uniqueResult();
+ }
+
+ @Override
+ public Long addByUserAndPath(DataGridUser user, String path, boolean isCollection) {
+
+ String parentPath = path.substring(0, path.lastIndexOf("/"));
+ if (parentPath.isEmpty()) {
+ parentPath = "/";
+ }
+ String fileName = path != null ? path.substring(path.lastIndexOf("/") + 1, path.length()) : "";
+
+ DataGridUserFavorite favorite = new DataGridUserFavorite();
+ favorite.setUser(user);
+ favorite.setPath(path);
+ favorite.setPathHash(path.hashCode());
+ favorite.setName(fileName);
+ favorite.setCreateTs(new Date());
+ favorite.setIsCollection(isCollection);
+ return save(favorite);
+ }
+
+ @Override
+ public boolean removeByUserAndPath(DataGridUser user, String path) {
+
+ boolean operationResult = true;
+
+ logger.info("Attempting to remove favorite on {} from user {}", path, user.getUsername());
+ try {
+ DataGridUserFavorite favorite = findByUserAndPath(user, path);
+ delete(favorite);
+ logger.info("Successfully removed favorite {} from user{}", path, user.getUsername());
+ }
+ catch (Exception e) {
+ operationResult = false;
+ logger.error("Could not remove favorite on {} from user {}: {}", path, user.getUsername(), e.getMessage());
+ }
+
+ return operationResult;
+ }
+
+ @Override
+ public List findByUser(DataGridUser user) {
+ Query q = sessionFactory.getCurrentSession().createQuery("from DataGridUserFavorite where user_id = :user_id");
+ q.setLong("user_id", user.getId());
+ return q.list();
+ }
+
+ @Override
+ public List findByUserPaginated(DataGridUser user, int offset, int limit, String searchString, String orderBy,
+ String orderDir, boolean onlyCollections) {
+ String queryString = "from DataGridUserFavorite where user_id = :user_id and path like :path ";
+ if (onlyCollections) {
+ queryString += " and is_collection = true ";
+ }
+ queryString += " order by " + orderBy + " " + orderDir;
+ Query q = sessionFactory.getCurrentSession().createQuery(queryString);
+ q.setLong("user_id", user.getId());
+ q.setString("path", '%' + searchString + '%');
+ q.setFirstResult(offset);
+ q.setMaxResults(limit);
+ return q.list();
+ }
+
+ @Override
+ public List findFavoritesByPath(String path) {
+ Query q = sessionFactory.getCurrentSession().createQuery("from DataGridUserFavorite where path = :path");
+ q.setString("path", path);
+ return q.list();
+ }
+
+ @Override
+ public boolean removeByPath(String path) {
+ logger.debug("Removing favorite by path: {} ", path);
+ boolean removalSuccessful = false;
+
+ try {
+ List favorites = findFavoritesByPath(path);
+ Iterator it = favorites.iterator();
+ while (it.hasNext()) {
+ DataGridUserFavorite favorite = it.next();
+ logger.debug("Removing favorite {} from database", favorite.getPath());
+ delete(favorite);
+ }
+
+ removalSuccessful = true;
+ }
+ catch (Exception e) {
+ logger.error("Could not remove favorite for path {} ", path);
+ }
+
+ return removalSuccessful;
+ }
+
+ @Override
+ public boolean removeByParentPath(String parentPath) {
+ logger.debug("Removing favorite by relative path: {} ", parentPath);
+ boolean removalSuccessful = false;
+
+ try {
+ Query q = sessionFactory.getCurrentSession().createQuery("from DataGridUserFavorite where path LIKE :path");
+ q.setString("path", parentPath + "%");
+
+ List favorites = q.list();
+
+ Iterator favoritesIterator = favorites.iterator();
+ while (favoritesIterator.hasNext()) {
+ DataGridUserFavorite currFavorite = favoritesIterator.next();
+ logger.debug("Removing relative favorite {} from database", currFavorite.getPath());
+ delete(currFavorite);
+ }
+ }
+ catch (Exception e) {
+ logger.error("Could not relative paths on favorite for path {} ", parentPath);
+ }
+
+ return removalSuccessful;
+ }
+
+ @Override
+ public boolean removeByUser(DataGridUser user) {
+ logger.debug("Removing favorite by user: {} ", user.getUsername());
+ boolean removalSuccessful = false;
+
+ try {
+ List favorites = findByUser(user);
+ Iterator it = favorites.iterator();
+ while (it.hasNext()) {
+ DataGridUserFavorite favorite = it.next();
+ logger.debug("Removing favorite {} from database", favorite.getPath());
+ delete(favorite);
+ }
+
+ removalSuccessful = true;
+ }
+ catch (Exception e) {
+ logger.error("Could not remove favorite for user {} ", user.getUsername());
+ }
+
+ return removalSuccessful;
+ }
+
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/impl/GroupBookmarkDaoImpl.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/impl/GroupBookmarkDaoImpl.java
new file mode 100755
index 000000000..43e98b853
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/impl/GroupBookmarkDaoImpl.java
@@ -0,0 +1,250 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.metalnx.core.domain.dao.impl;
+
+import com.emc.metalnx.core.domain.dao.GroupBookmarkDao;
+import com.emc.metalnx.core.domain.dao.GroupDao;
+import com.emc.metalnx.core.domain.dao.generic.GenericDaoImpl;
+import com.emc.metalnx.core.domain.entity.DataGridGroup;
+import com.emc.metalnx.core.domain.entity.DataGridGroupBookmark;
+import org.hibernate.Query;
+import org.hibernate.SessionFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Repository;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+
+@Repository
+@SuppressWarnings("unchecked")
+public class GroupBookmarkDaoImpl extends GenericDaoImpl implements GroupBookmarkDao {
+
+ private static final Logger logger = LoggerFactory.getLogger(GroupBookmarkDaoImpl.class);
+
+ @Autowired
+ private SessionFactory sessionFactory;
+
+ @Autowired
+ GroupDao groupDao;
+
+ @Override
+ public Long addByGroupAndPath(DataGridGroup group, String path, boolean isCollection) {
+
+ String parentPath = path.substring(0, path.lastIndexOf("/"));
+ if (parentPath.isEmpty()) {
+ parentPath = "/";
+ }
+
+ DataGridGroupBookmark bookmark = new DataGridGroupBookmark();
+ bookmark.setGroup(group);
+ bookmark.setPath(path);
+ bookmark.setIsCollection(isCollection);
+ bookmark.setCreateTs(new Date());
+ bookmark.setIsNotified(false);
+ return save(bookmark);
+ }
+
+ @Override
+ public boolean removeByGroupAndPath(DataGridGroup group, String path) {
+
+ boolean madeModifications = false;
+ boolean operationResult = true;
+
+ logger.info("Attempting to remove bookmark on {} from group {}", path, group.getGroupname());
+ try {
+ Iterator it = group.getGroupBookmarks().iterator();
+ while (it.hasNext()) {
+ DataGridGroupBookmark bk = it.next();
+ if (bk.getPath().compareTo(path) == 0) {
+ madeModifications = true;
+ it.remove();
+ }
+ }
+
+ if (madeModifications) {
+ logger.debug("Attempting to merge group entity [{}]", group.getId());
+ groupDao.merge(group);
+ logger.info("Successfully removed bookmark {} from group{}", path, group.getGroupname());
+ }
+ }
+ catch (Exception e) {
+ operationResult = false;
+ logger.error("Could not remove bookmark on {} from group {}", path, group.getGroupname(), e);
+ }
+
+ return operationResult;
+ }
+
+ @Override
+ public List findByGroup(DataGridGroup group) {
+ Query q = sessionFactory.getCurrentSession().createQuery("from DataGridGroupBookmark where group_id = :group_id");
+ q.setLong("group_id", group.getId());
+ return q.list();
+ }
+
+ @Override
+ public List findBookmarksByPath(String path) {
+ Query q = sessionFactory.getCurrentSession().createQuery("from DataGridGroupBookmark where path = :path");
+ q.setString("path", path);
+ return q.list();
+ }
+
+ @Override
+ public boolean removeByPath(String path) {
+ logger.debug("Removing bookmarks by path: {} ", path);
+ boolean removalSuccessful = false;
+
+ try {
+ List bookmarks = findBookmarksByPath(path);
+ Iterator it = bookmarks.iterator();
+ while (it.hasNext()) {
+ DataGridGroupBookmark bookmark = it.next();
+ logger.debug("Removing bookmark {} from database", bookmark.getPath());
+ delete(bookmark);
+ }
+
+ removalSuccessful = true;
+ }
+ catch (Exception e) {
+ logger.error("Could not remove bookmark for path {} ", path);
+ }
+
+ return removalSuccessful;
+ }
+
+ @Override
+ public boolean removeByParentPath(String parentPath) {
+ logger.debug("Removing bookmarks by relative path: {} ", parentPath);
+ boolean removalSuccessful = false;
+
+ try {
+ Query q = sessionFactory.getCurrentSession().createQuery("from DataGridUserBookmark where path LIKE :path");
+ q.setString("path", parentPath + "%");
+
+ List bookmarks = q.list();
+
+ Iterator bookmarksIterator = bookmarks.iterator();
+ while (bookmarksIterator.hasNext()) {
+ DataGridGroupBookmark currBookmark = bookmarksIterator.next();
+ logger.debug("Removing relative bookmark {} from database", currBookmark.getPath());
+ delete(currBookmark);
+ }
+ }
+ catch (Exception e) {
+ logger.error("Could not relative paths on bookmarks for path {} ", parentPath);
+ }
+
+ return removalSuccessful;
+ }
+
+ @Override
+ public boolean removeByGroup(DataGridGroup group) {
+ boolean operationResult = true;
+
+ List bookmarks = findByGroup(group);
+ Iterator it = bookmarks.iterator();
+ while (it.hasNext()) {
+ try {
+ delete(it.next());
+ }
+ catch (Exception e) {
+ operationResult = false;
+ }
+ }
+
+ return operationResult;
+ }
+
+ @Override
+ public List findGroupBookmarksByGroupsIds(String[] groupIds, int offset, int limit, String searchString, String orderBy,
+ String orderDir, boolean onlyCollections) {
+ if (groupIds != null && groupIds.length > 0) {
+ Long[] groupIdsLong = convertStringsToLongs(groupIds);
+ String queryString = "select Dggb from DataGridGroupBookmark Dggb left join Dggb.group Dgg where Dgg.dataGridId in (:groupIds) and (Dggb.path LIKE :path or Dgg.groupname LIKE :groupname) ";
+ if (onlyCollections) {
+ queryString += "and Dggb.isCollection = true ";
+ }
+ queryString += "order by " + orderBy + " " + orderDir;
+ Query q = sessionFactory.getCurrentSession().createQuery(queryString);
+ q.setParameterList("groupIds", groupIdsLong);
+ q.setString("path", '%' + searchString + '%');
+ q.setString("groupname", '%' + searchString + '%');
+ q.setFirstResult(offset);
+ q.setMaxResults(limit);
+
+ return q.list();
+ }
+
+ // If the input list is null, the method returns null
+ return new ArrayList();
+ }
+
+ @Override
+ public Long countGroupBookmarksByGroupsIds(String[] groupIds) {
+ if (groupIds != null && groupIds.length > 0) {
+ Long[] groupIdsLong = convertStringsToLongs(groupIds);
+ Query q = sessionFactory.getCurrentSession().createQuery(
+ "select count(*) from DataGridGroupBookmark Dggb left join Dggb.group Dgg where Dgg.dataGridId in (:groupIds)");
+ q.setParameterList("groupIds", groupIdsLong);
+
+ return (Long) q.uniqueResult();
+ }
+ return (long) 0;
+ }
+
+ @Override
+ public boolean updateBookmark(String oldPath, String newPath) {
+ logger.debug("Updating bookmark");
+
+ if (oldPath == null || newPath == null) {
+ logger.debug("Could not update bookmark. Null values provided");
+ return false;
+ }
+
+ if (oldPath.equals(newPath)) {
+ logger.debug("Old bookmark is the same as the new one. No need for an update.");
+ return false;
+ }
+
+ Query q = sessionFactory.getCurrentSession().createQuery("update DataGridGroupBookmark set path = :newPath where path = :oldPath");
+ q.setString("newPath", newPath);
+ q.setString("oldPath", oldPath);
+
+ return q.executeUpdate() > 0;
+ }
+
+ /**
+ * Converts an array of strings into an array of longs.
+ *
+ * @param strArray
+ * array of strings to be converted
+ * @return array of longs
+ */
+ private Long[] convertStringsToLongs(String[] strArray) {
+ Long[] intArray = new Long[strArray.length];
+
+ for (int i = 0; i < strArray.length; i++) {
+ intArray[i] = Long.valueOf(strArray[i]);
+ }
+
+ return intArray;
+ }
+
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/impl/GroupDaoImpl.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/impl/GroupDaoImpl.java
new file mode 100755
index 000000000..5d4ca0b41
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/impl/GroupDaoImpl.java
@@ -0,0 +1,167 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.metalnx.core.domain.dao.impl;
+
+import com.emc.metalnx.core.domain.dao.GroupDao;
+import com.emc.metalnx.core.domain.dao.generic.GenericDaoImpl;
+import com.emc.metalnx.core.domain.entity.DataGridGroup;
+import org.hibernate.Query;
+import org.hibernate.SessionFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Repository;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@SuppressWarnings("unchecked")
+@Repository
+public class GroupDaoImpl extends GenericDaoImpl implements GroupDao {
+
+ @Autowired
+ private SessionFactory sessionFactory;
+
+ @Override
+ public List findByGroupname(String groupname) {
+
+ List dataGridGroups = null;
+ Query q = sessionFactory.getCurrentSession().createQuery("from DataGridGroup where groupname = :groupname");
+ q.setString("groupname", groupname);
+
+ dataGridGroups = q.list();
+
+ return dataGridGroups;
+ }
+
+ @Override
+ public DataGridGroup findByGroupnameAndZone(String groupname, String zone) {
+
+ Query q = sessionFactory.getCurrentSession().createQuery("from DataGridGroup where groupname = :groupname and additional_info = :zone");
+ q.setString("groupname", groupname);
+ q.setParameter("zone", zone);
+
+ return (DataGridGroup) q.uniqueResult();
+ }
+
+ @Override
+ public boolean deleteByGroupname(String groupname) {
+
+ boolean operationResult = true;
+
+ try {
+ List dataGridGroups = findByGroupname(groupname);
+
+ for (DataGridGroup dataGridGroup : dataGridGroups) {
+ delete(dataGridGroup);
+ }
+ }
+ catch (Exception e) {
+ operationResult = false;
+ }
+
+ return operationResult;
+ }
+
+ @Override
+ public List findByQueryString(String query) {
+ Query q = sessionFactory.getCurrentSession().createQuery(
+ "from DataGridGroup where groupname like :groupname or additional_info like :additional_info");
+
+ q.setParameter("groupname", "%" + query + "%");
+ q.setParameter("additional_info", "%" + query + "%");
+
+ // Returning results
+ return q.list();
+ }
+
+ @Override
+ public List findByDataGridIdList(String[] ids) {
+ // Checking if the input ID list is empty
+ if (ids == null || ids.length == 0) {
+ return new ArrayList();
+ }
+
+ Long[] idsLong = convertStringsToLongs(ids);
+ Query q = sessionFactory.getCurrentSession().createQuery("from DataGridGroup where data_grid_id in (:ids)");
+ q.setParameterList("ids", idsLong);
+
+ return q.list();
+
+ }
+
+ @Override
+ public List findByGroupNameList(String[] groupNames) {
+ // Checking if the input ID list is empty
+ if (groupNames == null || groupNames.length == 0) {
+ return new ArrayList();
+ }
+
+ Query q = sessionFactory.getCurrentSession().createQuery("from DataGridGroup where groupname in (:groupNames)");
+ q.setParameterList("groupNames", groupNames);
+
+ return q.list();
+ }
+
+ @Override
+ public boolean deleteByDataGridGroupId(long id) {
+ DataGridGroup dataGridGroup = findByDataGridId(id);
+
+ if (dataGridGroup != null) {
+ delete(dataGridGroup);
+ return true;
+ }
+
+ return false;
+ }
+
+ @Override
+ public DataGridGroup findByDataGridId(long id) {
+ Query q = sessionFactory.getCurrentSession().createQuery("from DataGridGroup where data_grid_id=(:id)");
+ q.setParameter("id", id);
+
+ List groups = q.list();
+ return groups.size() > 0 ? groups.get(0) : null;
+ }
+
+ @Override
+ public List findByIdList(Long[] ids) {
+ if (ids == null || ids.length == 0) {
+ return new ArrayList();
+ }
+
+ Query q = sessionFactory.getCurrentSession().createQuery("from DataGridGroup where id in (:ids)");
+ q.setParameterList("ids", ids);
+
+ return q.list();
+ }
+
+ /**
+ * Converts an array of strings into an array of longs.
+ *
+ * @param strArray
+ * array of strings to be converted
+ * @return array of longs
+ */
+ private Long[] convertStringsToLongs(String[] strArray) {
+ Long[] intArray = new Long[strArray.length];
+
+ for (int i = 0; i < strArray.length; i++) {
+ intArray[i] = Long.valueOf(strArray[i]);
+ }
+
+ return intArray;
+ }
+
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/impl/TemplateDaoImpl.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/impl/TemplateDaoImpl.java
new file mode 100755
index 000000000..08f9c397a
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/impl/TemplateDaoImpl.java
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.metalnx.core.domain.dao.impl;
+
+import com.emc.metalnx.core.domain.dao.TemplateDao;
+import com.emc.metalnx.core.domain.dao.generic.GenericDaoImpl;
+import com.emc.metalnx.core.domain.entity.DataGridTemplate;
+import com.emc.metalnx.core.domain.entity.DataGridTemplateField;
+import org.hibernate.Query;
+import org.hibernate.SessionFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Repository;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@SuppressWarnings("unchecked")
+@Repository
+public class TemplateDaoImpl extends GenericDaoImplimplements TemplateDao {
+
+ @Autowired
+ private SessionFactory sessionFactory;
+
+ @Override
+ public long getTemplateId(String templateName) {
+ DataGridTemplate dataGridTemplate = this.findByName(templateName);
+
+ if (dataGridTemplate == null) {
+ return -1;
+ }
+
+ return dataGridTemplate.getId();
+ }
+
+ @Override
+ public DataGridTemplate findById(long id) {
+
+ Query q = this.sessionFactory.getCurrentSession().createQuery("from DataGridTemplate where template_id=(:id)");
+ q.setParameter("id", id);
+
+ return (DataGridTemplate) q.uniqueResult();
+ }
+
+ @Override
+ public DataGridTemplate findByName(String templateName) {
+
+ Query q = this.sessionFactory.getCurrentSession()
+ .createQuery("from DataGridTemplate where template_name = :templateName");
+ q.setString("templateName", templateName);
+
+ return (DataGridTemplate) q.uniqueResult();
+ }
+
+ @Override
+ public boolean deleteById(long id) {
+ DataGridTemplate dataGridTemplate = this.findById(id);
+
+ if (dataGridTemplate == null) {
+ return false;
+ }
+
+ this.delete(dataGridTemplate);
+
+ return true;
+ }
+
+ @Override
+ public List findByQueryString(String query) {
+ Query q = this.sessionFactory.getCurrentSession()
+ .createQuery("from DataGridTemplate where template_name like :templateName");
+
+ q.setParameter("templateName", "%" + query + "%");
+
+ // Returning results
+ return q.list();
+ }
+
+ @Override
+ public List listTemplateFields(Long id) {
+ Query q = this.sessionFactory.getCurrentSession()
+ .createQuery("from DataGridTemplateField where template_id = :templateID");
+
+ q.setParameter("templateID", id);
+
+ // Returning results
+ return q.list();
+ }
+
+ @Override
+ public List listTemplateFields(String template) {
+ long id = this.getTemplateId(template);
+
+ if (id > 0) {
+ return this.listTemplateFields(id);
+ }
+
+ return new ArrayList();
+ }
+
+ @Override
+ public List listPublicTemplates() {
+ Query q = this.sessionFactory.getCurrentSession()
+ .createQuery("from DataGridTemplate where access_type = :accessType");
+
+ q.setParameter("accessType", "system");
+
+ // Returning results
+ return q.list();
+ }
+
+ @Override
+ public List listPrivateTemplatesByUser(String user) {
+ Query q = this.sessionFactory.getCurrentSession()
+ .createQuery("from DataGridTemplate where access_type = :accessType and owner = :owner");
+
+ q.setParameter("accessType", "private");
+ q.setParameter("owner", user);
+
+ // Returning results
+ return q.list();
+ }
+
+ @Override
+ public void merge(DataGridTemplate template) {
+ if (template.isModified()) {
+ template.setVersion(template.getVersion() + 1);
+ }
+
+ super.merge(template);
+ }
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/impl/TemplateFieldsDaoImpl.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/impl/TemplateFieldsDaoImpl.java
new file mode 100755
index 000000000..daf685e02
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/impl/TemplateFieldsDaoImpl.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.metalnx.core.domain.dao.impl;
+
+import com.emc.metalnx.core.domain.dao.TemplateFieldDao;
+import com.emc.metalnx.core.domain.dao.generic.GenericDaoImpl;
+import com.emc.metalnx.core.domain.entity.DataGridTemplateField;
+import com.emc.metalnx.core.domain.exceptions.DataGridTemplateAttrException;
+import com.emc.metalnx.core.domain.exceptions.DataGridTemplateUnitException;
+import com.emc.metalnx.core.domain.exceptions.DataGridTemplateValueException;
+import org.hibernate.Query;
+import org.hibernate.SessionFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Repository;
+
+@SuppressWarnings("unchecked")
+@Repository
+public class TemplateFieldsDaoImpl extends GenericDaoImpl implements TemplateFieldDao {
+
+ @Autowired
+ private SessionFactory sessionFactory;
+
+ @Override
+ public DataGridTemplateField findById(long id) {
+
+ Query q = sessionFactory.getCurrentSession().createQuery("from DataGridTemplateField where template_field_id=(:id)");
+ q.setParameter("id", id);
+
+ return (DataGridTemplateField) q.uniqueResult();
+ }
+
+ @Override
+ public boolean modifyById(long id, String attribute, String value, String unit) throws DataGridTemplateAttrException,
+ DataGridTemplateValueException, DataGridTemplateUnitException {
+ DataGridTemplateField templateField = findById(id);
+
+ if (templateField == null) {
+ return false;
+ }
+
+ templateField.setAttribute(attribute);
+ templateField.setValue(value);
+ templateField.setUnit(unit);
+ merge(templateField);
+
+ return true;
+ }
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/impl/UserBookmarkDaoImpl.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/impl/UserBookmarkDaoImpl.java
new file mode 100755
index 000000000..c1aa6e0f9
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/impl/UserBookmarkDaoImpl.java
@@ -0,0 +1,249 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.metalnx.core.domain.dao.impl;
+
+import com.emc.metalnx.core.domain.dao.UserBookmarkDao;
+import com.emc.metalnx.core.domain.dao.UserDao;
+import com.emc.metalnx.core.domain.dao.generic.GenericDaoImpl;
+import com.emc.metalnx.core.domain.entity.DataGridUser;
+import com.emc.metalnx.core.domain.entity.DataGridUserBookmark;
+import org.hibernate.Query;
+import org.hibernate.SessionFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Repository;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+
+@Repository
+@SuppressWarnings("unchecked")
+public class UserBookmarkDaoImpl extends GenericDaoImpl implements UserBookmarkDao {
+
+ private static final Logger logger = LoggerFactory.getLogger(UserBookmarkDaoImpl.class);
+
+ @Autowired
+ private SessionFactory sessionFactory;
+
+ @Autowired
+ UserDao userDao;
+
+ @Override
+ public DataGridUserBookmark findByUserAndPath(DataGridUser user, String path) {
+ Query q = sessionFactory.getCurrentSession().createQuery("from DataGridUserBookmark where user_id = :user_id and path = :path");
+ q.setLong("user_id", user.getId());
+ q.setString("path", path);
+ return (DataGridUserBookmark) q.uniqueResult();
+ }
+
+ @Override
+ public Long addByUserAndPath(DataGridUser user, String path, boolean isCollection) {
+
+ String parentPath = path.substring(0, path.lastIndexOf("/"));
+ if (parentPath.isEmpty()) {
+ parentPath = "/";
+ }
+
+ String fileName = path != null ? path : "";
+ fileName = fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length());
+
+ DataGridUserBookmark bookmark = new DataGridUserBookmark();
+ bookmark.setUser(user);
+ bookmark.setPath(path);
+ bookmark.setName(fileName);
+ bookmark.setCreateTs(new Date());
+ bookmark.setIsNotified(false);
+ bookmark.setIsCollection(isCollection);
+ return save(bookmark);
+ }
+
+ @Override
+ public boolean removeByUserAndPath(DataGridUser user, String path) {
+
+ boolean operationResult = true;
+
+ logger.info("Attempting to remove bookmark on {} from user {}", path, user.getUsername());
+ try {
+ DataGridUserBookmark bookmark = findByUserAndPath(user, path);
+ delete(bookmark);
+ logger.info("Successfully removed bookmark {} from user{}", path, user.getUsername());
+ }
+ catch (Exception e) {
+ operationResult = false;
+ logger.error("Could not remove bookmark on {} from user {}: {}", path, user.getUsername(), e.getMessage());
+ }
+
+ return operationResult;
+ }
+
+ @Override
+ public List findByUser(DataGridUser user) {
+ Query q = sessionFactory.getCurrentSession().createQuery("from DataGridUserBookmark where user_id = :user_id");
+ q.setLong("user_id", user.getId());
+ return q.list();
+ }
+
+ @Override
+ public List findBookmarksByPath(String path) {
+ Query q = sessionFactory.getCurrentSession().createQuery("from DataGridUserBookmark where path = :path");
+ q.setString("path", path);
+ return q.list();
+ }
+
+ @Override
+ public boolean removeByPath(String path) {
+ logger.debug("Removing bookmarks by path: {} ", path);
+ boolean removalSuccessful = false;
+
+ try {
+ List bookmarks = findBookmarksByPath(path);
+ Iterator it = bookmarks.iterator();
+ while (it.hasNext()) {
+ DataGridUserBookmark bookmark = it.next();
+ logger.debug("Removing bookmark {} from database", bookmark.getPath());
+ delete(bookmark);
+ }
+
+ removalSuccessful = true;
+ }
+ catch (Exception e) {
+ logger.error("Could not remove bookmark for path {} ", path);
+ }
+
+ return removalSuccessful;
+ }
+
+ @Override
+ public boolean removeByParentPath(String parentPath) {
+ logger.debug("Removing bookmarks by relative path: {} ", parentPath);
+ boolean removalSuccessful = false;
+
+ try {
+ Query q = sessionFactory.getCurrentSession().createQuery("from DataGridUserBookmark where path LIKE :path");
+ q.setString("path", parentPath + "%");
+
+ List bookmarks = q.list();
+
+ Iterator bookmarksIterator = bookmarks.iterator();
+ while (bookmarksIterator.hasNext()) {
+ DataGridUserBookmark currBookmark = bookmarksIterator.next();
+ logger.debug("Removing relative bookmark {} from database", currBookmark.getPath());
+ delete(currBookmark);
+ }
+ }
+ catch (Exception e) {
+ logger.error("Could not relative paths on bookmarks for path {} ", parentPath);
+ }
+
+ return removalSuccessful;
+ }
+
+ @Override
+ public List findByUserPaginated(DataGridUser user, int start, int length, String searchString, String orderBy,
+ String orderDir, boolean onlyCollections) {
+ List orderByList = new ArrayList();
+ orderByList.add(orderBy);
+
+ List orderDirList = new ArrayList();
+ orderDirList.add(orderDir);
+
+ return this.findByUserPaginated(user, start, length, searchString, orderByList, orderDirList, onlyCollections);
+ }
+
+ @Override
+ public List findByUserPaginated(DataGridUser user, int start, int length, String searchString, List orderBy,
+ List orderDir, boolean onlyCollections) {
+
+ if (orderBy.size() != orderDir.size()) {
+ return null;
+ }
+
+ StringBuilder query = new StringBuilder();
+ query.append("from DataGridUserBookmark ");
+ query.append("where ");
+ query.append("user_id = :user_id ");
+ query.append("and ");
+ query.append("path like :path ");
+ if (onlyCollections) {
+ query.append("and is_collection = true ");
+ }
+ query.append("order by ");
+
+ for (int i = 0; i < orderBy.size(); i++) {
+ query.append(orderBy.get(i));
+ query.append(" ");
+ query.append(orderDir.get(i));
+ query.append(" ");
+ if (i + 1 < orderBy.size()) {
+ query.append(",");
+ }
+ }
+
+ Query q = sessionFactory.getCurrentSession().createQuery(query.toString());
+ q.setLong("user_id", user.getId());
+ q.setString("path", '%' + searchString + '%');
+ q.setFirstResult(start);
+ q.setMaxResults(length);
+ return q.list();
+ }
+
+ @Override
+ public boolean removeByUser(DataGridUser user) {
+
+ boolean operationResult = true;
+ Query q = sessionFactory.getCurrentSession().createQuery("from DataGridUserBookmark where user_id = :user_id");
+ q.setLong("user_id", user.getId());
+ List bookmarks = q.list();
+ Iterator it = bookmarks.iterator();
+
+ try {
+ while (it.hasNext()) {
+ delete(it.next());
+ }
+ }
+ catch (Exception e) {
+ operationResult = false;
+ }
+
+ return operationResult;
+ }
+
+ @Override
+ public boolean updateBookmark(String oldPath, String newPath) {
+ logger.debug("Updating bookmark");
+
+ if (oldPath == null || newPath == null) {
+ logger.debug("Could not update bookmark. Null values provided");
+ return false;
+ }
+
+ if (oldPath.equals(newPath)) {
+ logger.debug("Old bookmark is the same as the new one. No need for an update.");
+ return false;
+ }
+
+ String newBookmarkName = newPath.substring(newPath.lastIndexOf("/") + 1, newPath.length());
+
+ Query q = sessionFactory.getCurrentSession().createQuery("update DataGridUserBookmark set path = :newPath, name = :name where path = :oldPath");
+ q.setString("newPath", newPath);
+ q.setString("name", newBookmarkName);
+ q.setString("oldPath", oldPath);
+ return q.executeUpdate() > 0;
+ }
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/impl/UserDaoImpl.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/impl/UserDaoImpl.java
new file mode 100755
index 000000000..a82ab88b3
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/impl/UserDaoImpl.java
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.metalnx.core.domain.dao.impl;
+
+import com.emc.metalnx.core.domain.dao.UserDao;
+import com.emc.metalnx.core.domain.dao.generic.GenericDaoImpl;
+import com.emc.metalnx.core.domain.entity.DataGridUser;
+import org.hibernate.Query;
+import org.hibernate.SessionFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@SuppressWarnings("unchecked")
+@Repository
+@Transactional
+public class UserDaoImpl extends GenericDaoImpl implements UserDao {
+
+ @Autowired
+ private SessionFactory sessionFactory;
+
+ @Override
+ public List findByUsername(String username) {
+
+ List users = null;
+ Query q = sessionFactory.getCurrentSession().createQuery("from DataGridUser where username = :username");
+ q.setString("username", username);
+
+ users = q.list();
+
+ return users;
+ }
+
+ @Override
+ public DataGridUser findByUsernameAndZone(String username, String zone) {
+
+ List users = null;
+
+ Query q = sessionFactory.getCurrentSession().createQuery("from DataGridUser where username = :username and additional_info = :zone");
+ q.setString("username", username);
+ q.setString("zone", zone);
+
+ users = q.list();
+ return users.size() > 0 ? users.get(0) : null;
+ }
+
+ @Override
+ public boolean deleteByUsername(String username) {
+ List users = findByUsername(username);
+ for (DataGridUser user : users) {
+ delete(user);
+ }
+ return true;
+ }
+
+ @Override
+ public List findByQueryString(String query) {
+ Query q = sessionFactory.getCurrentSession().createQuery(
+ "from DataGridUser where username like :username or additional_info like :additional_info "
+ + "or first_name like :first_name or last_name like :last_name " + "or email like :email order by username");
+
+ q.setParameter("username", "%" + query + "%");
+ q.setParameter("additional_info", "%" + query + "%");
+ q.setParameter("first_name", "%" + query + "%");
+ q.setParameter("last_name", "%" + query + "%");
+ q.setParameter("email", "%" + query + "%");
+
+ // Returning results
+ return q.list();
+ }
+
+ @Override
+ public List findByDataGridIdList(String[] ids) {
+ List result = new ArrayList();
+
+ if (ids != null) {
+ int i = 0;
+ Integer ids_int[] = new Integer[ids.length];
+
+ for (String id_str : ids) {
+ ids_int[i++] = Integer.parseInt(id_str);
+ }
+
+ // Checking if the input ID list is empty
+ if (ids_int != null) {
+ Query q = sessionFactory.getCurrentSession().createQuery("from DataGridUser where data_grid_id in (:ids)");
+ q.setParameterList("ids", ids_int);
+ result = q.list();
+ }
+ }
+
+ // If the input list is null, the method returns null
+ return result;
+ }
+
+ @Override
+ public DataGridUser findByDataGridId(long id) {
+
+ Query q = sessionFactory.getCurrentSession().createQuery("from DataGridUser where data_grid_id=(:id)");
+ q.setParameter("id", id);
+
+ List users = q.list();
+
+ return users.size() > 0 ? users.get(0) : null;
+ }
+
+ @Override
+ public boolean deleteByDataGridId(long id) {
+ DataGridUser user = findByDataGridId(id);
+ if (user != null) {
+ delete(user);
+ }
+ return false;
+ }
+
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/impl/UserProfileDaoImpl.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/impl/UserProfileDaoImpl.java
new file mode 100755
index 000000000..2c53ecdab
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/dao/impl/UserProfileDaoImpl.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.metalnx.core.domain.dao.impl;
+
+import com.emc.metalnx.core.domain.dao.UserProfileDao;
+import com.emc.metalnx.core.domain.dao.generic.GenericDaoImpl;
+import com.emc.metalnx.core.domain.entity.UserProfile;
+import org.hibernate.Query;
+import org.hibernate.SessionFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+@SuppressWarnings("unchecked")
+@Repository
+@Transactional
+public class UserProfileDaoImpl extends GenericDaoImpl
+ implements UserProfileDao {
+
+ @Autowired
+ private SessionFactory sessionFactory;
+
+ @Override
+ public List findByQueryString(String query) {
+ Query q = sessionFactory
+ .getCurrentSession()
+ .createQuery(
+ "from UserProfile where profile_name like :name or description like :description ");
+
+ q.setParameter("name", "%" + query + "%");
+ q.setParameter("description", "%" + query + "%");
+
+ // Returning results
+ return q.list();
+ }
+
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridCollectionAndDataObject.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridCollectionAndDataObject.java
new file mode 100755
index 000000000..e0989b8f0
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridCollectionAndDataObject.java
@@ -0,0 +1,511 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.metalnx.core.domain.entity;
+
+import java.io.Serializable;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+
+public class DataGridCollectionAndDataObject implements Serializable {
+
+ private static final String DATE_FORMAT_STR = "MMM dd yyyy HH:mm";
+
+ private String name;
+ private String path;
+ private String parentPath;
+ private String owner;
+ private Date modifiedAt;
+ private Date createdAt;
+ private boolean isCollection;
+ private String checksum;
+ private String replicaNumber;
+ private int numberOfReplicas;
+ private String displaySize;
+ private String mostPermissiveAccessForCurrentUser;
+ private long size;
+ private String resourceName;
+ private boolean inheritanceOption;
+ private boolean visibleToCurrentUser;
+ /**
+ * Indicates that this collection is actually a proxy to a collection the user
+ * cannot see in iRODS, but is necessary in order to drill down when StrictACLs
+ * are active
+ */
+ private boolean isProxy = false;
+
+ // number of matches on a metadata search
+ private int numberOfMatches;
+
+ private static final long serialVersionUID = 1L;
+
+ public DataGridCollectionAndDataObject() {
+
+ }
+
+ public DataGridCollectionAndDataObject(String path, String parentPath, boolean isCollection) {
+ this.path = path;
+ this.parentPath = parentPath;
+ this.name = findCollectionName(path);
+ this.isCollection = isCollection;
+ }
+
+ public DataGridCollectionAndDataObject(String path, String name, String parentPath, boolean isCollection) {
+ this.path = path;
+ this.name = name;
+ this.parentPath = parentPath;
+ this.isCollection = isCollection;
+ }
+
+ /**
+ * Finds a collection name based on its path
+ *
+ * @param collectionPath
+ * @return
+ */
+ public String findCollectionName(String collectionPath) {
+ String[] pathParts = collectionPath.split("/");
+ return pathParts[pathParts.length - 1];
+ }
+
+ /**
+ * @return the collectionName
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param name
+ * the collectionName to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * @return the collectionPath
+ */
+ public String getPath() {
+ return path;
+ }
+
+ /**
+ * @param path
+ * the collectionPath to set
+ */
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ /**
+ * @return the parentCollectionPath
+ */
+ public String getParentPath() {
+ return parentPath;
+ }
+
+ /**
+ * @param parentPath
+ * the parentCollectionPath to set
+ */
+ public void setParentPath(String parentPath) {
+ this.parentPath = parentPath;
+ }
+
+ /**
+ * @return the isCollection
+ */
+ public boolean isCollection() {
+ return isCollection;
+ }
+
+ /**
+ * Checks if current object corresponds data object in the grid.
+ *
+ * @return True, if current object is a data object in the grid. False,
+ * otherwise.
+ */
+ public boolean isDataObject() {
+ return !isCollection;
+ }
+
+ /**
+ * @param isCollection
+ * the isCollection to set
+ */
+ public void setCollection(boolean isCollection) {
+ this.isCollection = isCollection;
+ }
+
+ /**
+ * Gets the icon type that will be shown on the UI.
+ *
+ * @return the icon type as String
+ */
+ public String getIconToDisplay() {
+
+ if (isCollection)
+ return "fa fa-folder";
+
+ String icon = "";
+ String extension = this.getFileExtension(this.getName());
+
+ switch (extension) {
+
+ case "jpg":
+ case "jpeg":
+ case "png":
+ case "gif":
+ icon = "fa fa-file-image-o";
+ break;
+
+ case "html":
+ case "htm":
+ case "xml":
+ case "tex":
+ icon = "fa fa-code";
+ break;
+
+ case "c":
+ case "cpp":
+ case "java":
+ case "py":
+ icon = "fa fa-file-code-o";
+ break;
+
+ case "docx":
+ case "doc":
+ icon = "fa fa-file-word-o";
+ break;
+
+ case "xlsx":
+ case "xls":
+ icon = "fa fa-file-excel-o";
+ break;
+
+ case "pptx":
+ case "ppt":
+ icon = "fa fa-file-powerpoint-o";
+ break;
+
+ case "pdf":
+ icon = "fa fa-file-pdf-o";
+ break;
+
+ case "zip":
+ case "rar":
+ icon = "fa fa-file-archive-o";
+ break;
+
+ default:
+ icon = "fa fa-file";
+ break;
+ }
+
+ return icon;
+
+ }
+
+ private String getFileExtension(String fileName) {
+
+ int lastIndexOfFileName = fileName.lastIndexOf(".");
+ if (lastIndexOfFileName != -1 && lastIndexOfFileName != 0) {
+ return fileName.substring(lastIndexOfFileName + 1);
+ }
+
+ else
+ return "unknown";
+
+ }
+
+ /**
+ * @return the modified
+ */
+ public Date getModifiedAt() {
+ return modifiedAt;
+ }
+
+ /**
+ * @param modifiedAt
+ * the modified to set
+ */
+ public void setModifiedAt(Date modifiedAt) {
+ this.modifiedAt = modifiedAt;
+ }
+
+ /**
+ * @return the owner
+ */
+ public String getOwner() {
+ return owner;
+ }
+
+ /**
+ * @param owner
+ * the owner to set
+ */
+ public void setOwner(String owner) {
+ this.owner = owner;
+ }
+
+ /**
+ * @return the created
+ */
+ public Date getCreatedAt() {
+ return createdAt;
+ }
+
+ /**
+ * @param createdAt
+ * the created to set
+ */
+ public void setCreatedAt(Date createdAt) {
+ this.createdAt = createdAt;
+ }
+
+ /**
+ * Formats the date when a collection/data object was modified
+ *
+ * @return String in the format MM/DD/YYYY HH:MM
+ */
+ public String getModifiedAtFormatted() {
+ if (modifiedAt == null)
+ return "";
+ return new SimpleDateFormat(DATE_FORMAT_STR).format(modifiedAt);
+ }
+
+ /**
+ * Formats the date when a collection/data object was modified for the CSV
+ * report
+ *
+ * @return String in the format MM/DD/YYYY HH:MM
+ */
+ public String getModifiedAtFormattedForCSVReport() {
+ return new SimpleDateFormat("MMM-dd-yyyy_HH-mm").format(modifiedAt);
+ }
+
+ /**
+ * Formats the date when a collection/data object was created
+ *
+ * @return the modified
+ */
+ @JsonIgnore
+ public String getCreatedAtFormatted() {
+ if (createdAt == null)
+ return "";
+ return new SimpleDateFormat(DATE_FORMAT_STR).format(createdAt);
+ }
+
+ /**
+ * @return the checksum
+ */
+ public String getChecksum() {
+ return checksum;
+ }
+
+ /**
+ * @param checksum
+ * the checksum to set
+ */
+ public void setChecksum(String checksum) {
+ this.checksum = checksum;
+ }
+
+ /**
+ * @return the replicaNumber
+ */
+ public String getReplicaNumber() {
+ return replicaNumber;
+ }
+
+ /**
+ * @param replicaNumber
+ * the replicaNumber to set
+ */
+ public void setReplicaNumber(String replicaNumber) {
+ this.replicaNumber = replicaNumber;
+ }
+
+ /**
+ * @return the numerOfReplicas
+ */
+ public int getNumberOfReplicas() {
+ return numberOfReplicas;
+ }
+
+ /**
+ * @param numerOfReplicas
+ * the numerOfReplicas to set
+ */
+ public void setNumberOfReplicas(int numerOfReplicas) {
+ this.numberOfReplicas = numerOfReplicas;
+ }
+
+ /**
+ * @return the displaySize
+ */
+ public String getDisplaySize() {
+ return displaySize;
+ }
+
+ /**
+ * @param displaySize
+ * the displaySize to set
+ */
+ public void setDisplaySize(String displaySize) {
+ this.displaySize = displaySize;
+ }
+
+ /**
+ * @return the size
+ */
+ public long getSize() {
+ return size;
+ }
+
+ /**
+ * @param size
+ * the size to set
+ */
+ public void setSize(long size) {
+ this.size = size;
+ }
+
+ /**
+ * @return the resourceName
+ */
+ public String getResourceName() {
+ return resourceName;
+ }
+
+ /**
+ * @param resourceName
+ * the resourceName to set
+ */
+ public void setResourceName(String resourceName) {
+ this.resourceName = resourceName;
+ }
+
+ /**
+ * @return the inheritance option
+ */
+ public boolean isInheritanceOption() {
+ return inheritanceOption;
+ }
+
+ /**
+ * @param inheritanceOption
+ * the inheritance option to set
+ */
+ public void setInheritanceOption(boolean inheritanceOption) {
+ this.inheritanceOption = inheritanceOption;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder();
+ builder.append("DataGridCollectionAndDataObject [");
+ if (name != null) {
+ builder.append("name=").append(name).append(", ");
+ }
+ if (path != null) {
+ builder.append("path=").append(path).append(", ");
+ }
+ if (parentPath != null) {
+ builder.append("parentPath=").append(parentPath).append(", ");
+ }
+ if (owner != null) {
+ builder.append("owner=").append(owner).append(", ");
+ }
+ if (modifiedAt != null) {
+ builder.append("modifiedAt=").append(modifiedAt).append(", ");
+ }
+ if (createdAt != null) {
+ builder.append("createdAt=").append(createdAt).append(", ");
+ }
+ builder.append("isCollection=").append(isCollection).append(", ");
+ if (checksum != null) {
+ builder.append("checksum=").append(checksum).append(", ");
+ }
+ if (replicaNumber != null) {
+ builder.append("replicaNumber=").append(replicaNumber).append(", ");
+ }
+ builder.append("numberOfReplicas=").append(numberOfReplicas).append(", ");
+ if (displaySize != null) {
+ builder.append("displaySize=").append(displaySize).append(", ");
+ }
+ if (mostPermissiveAccessForCurrentUser != null) {
+ builder.append("mostPermissiveAccessForCurrentUser=").append(mostPermissiveAccessForCurrentUser)
+ .append(", ");
+ }
+ builder.append("size=").append(size).append(", ");
+ if (resourceName != null) {
+ builder.append("resourceName=").append(resourceName).append(", ");
+ }
+ builder.append("inheritanceOption=").append(inheritanceOption).append(", visibleToCurrentUser=")
+ .append(visibleToCurrentUser).append(", isProxy=").append(isProxy).append(", numberOfMatches=")
+ .append(numberOfMatches).append("]");
+ return builder.toString();
+ }
+
+ /**
+ * @return the numberOfMatches
+ */
+ public int getNumberOfMatches() {
+ return numberOfMatches;
+ }
+
+ /**
+ * @param numberOfMatches
+ * the numberOfMatches to set
+ */
+ public void setNumberOfMatches(int numberOfMatches) {
+ this.numberOfMatches = numberOfMatches;
+ }
+
+ /**
+ * @return the visibleToCurrentUser
+ */
+ public boolean isVisibleToCurrentUser() {
+ return visibleToCurrentUser;
+ }
+
+ /**
+ * @param visibleToCurrentUser
+ * the visibleToCurrentUser to set
+ */
+ public void setVisibleToCurrentUser(boolean visibleToCurrentUser) {
+ this.visibleToCurrentUser = visibleToCurrentUser;
+ }
+
+ public String getMostPermissiveAccessForCurrentUser() {
+ return mostPermissiveAccessForCurrentUser;
+ }
+
+ public void setMostPermissiveAccessForCurrentUser(String mostPermissiveAccessForCurrentUser) {
+ this.mostPermissiveAccessForCurrentUser = mostPermissiveAccessForCurrentUser;
+ }
+
+ public boolean isProxy() {
+ return isProxy;
+ }
+
+ public void setProxy(boolean isProxy) {
+ this.isProxy = isProxy;
+ }
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridFilePermission.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridFilePermission.java
new file mode 100755
index 000000000..842d574c1
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridFilePermission.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.metalnx.core.domain.entity;
+
+import java.io.Serializable;
+
+public class DataGridFilePermission implements Serializable {
+ private String userId;
+ private String username;
+ private String permission;
+ private String userType;
+ private String userZone;
+ private static final long serialVersionUID = 1L;
+
+ public DataGridFilePermission() {
+
+ }
+
+ public String getPermission() {
+ return permission;
+ }
+
+ public void setPermission(String permission) {
+ this.permission = permission;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public String getUserId() {
+ return userId;
+ }
+
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
+
+ public String getUserZone() {
+ return userZone;
+ }
+
+ public void setUserZone(String userZone) {
+ this.userZone = userZone;
+ }
+
+ public String getUserType() {
+ return userType;
+ }
+
+ public void setUserType(String userType) {
+ this.userType = userType;
+ }
+
+}
\ No newline at end of file
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridFilePropertySearch.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridFilePropertySearch.java
new file mode 100755
index 000000000..b0b3d32d1
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridFilePropertySearch.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.metalnx.core.domain.entity;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+
+import com.emc.metalnx.core.domain.entity.enums.DataGridSearchOperatorEnum;
+import com.emc.metalnx.core.domain.entity.enums.FilePropertyField;
+
+public class DataGridFilePropertySearch {
+
+ private final FilePropertyField attribute;
+ private final DataGridSearchOperatorEnum operator;
+ private final String value;
+
+ public DataGridFilePropertySearch(FilePropertyField filePropertyField, DataGridSearchOperatorEnum operator,
+ String value) throws ParseException {
+ attribute = filePropertyField;
+ this.operator = operator;
+ if (filePropertyField == FilePropertyField.CREATION_DATE
+ || filePropertyField == FilePropertyField.MODIFICATION_DATE) {
+ long timeInMilliseconds = new SimpleDateFormat("MM/dd/yyyy hh:mm aa").parse(value).getTime();
+ this.value = String.valueOf(timeInMilliseconds / 1000);
+ } else {
+ this.value = value;
+ }
+ }
+
+ @Override
+ public String toString() {
+ return String.format("%s %s %s", attribute.getFieldName(), operator.toString(), value);
+ }
+
+ /**
+ * @return the attribute
+ */
+ public FilePropertyField getAttribute() {
+ return attribute;
+ }
+
+ /**
+ * @return the operator
+ */
+ public DataGridSearchOperatorEnum getOperator() {
+ return operator;
+ }
+
+ /**
+ * @return the value
+ */
+ public String getValue() {
+ return value;
+ }
+
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridGroup.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridGroup.java
new file mode 100755
index 000000000..8e3d92bae
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridGroup.java
@@ -0,0 +1,154 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.metalnx.core.domain.entity;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import org.hibernate.envers.Audited;
+import org.hibernate.envers.NotAudited;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.util.Set;
+
+@Entity
+@Audited
+@Table(name = "groups")
+public class DataGridGroup implements Serializable, Comparable {
+
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @NotAudited
+ @Column(name = "id", unique = true, nullable = false)
+ private Long id;
+
+ @Column(name = "data_grid_id", unique = true, nullable = false)
+ private long dataGridId;
+
+ @Column(name = "groupname", unique = true, nullable = false, length = 60)
+ private String groupname;
+
+ @Column(name = "additional_info", nullable = true, length = 60)
+ private String additional_info;
+
+ @ManyToMany(fetch = FetchType.EAGER, cascade = { CascadeType.PERSIST })
+ @JoinTable(name = "user_profile_groups", joinColumns = { @JoinColumn(name = "group_id") }, inverseJoinColumns = { @JoinColumn(name = "profile_id") })
+ private Set userProfiles;
+
+ @JsonIgnore
+ @OneToMany(mappedBy = "group", fetch = FetchType.EAGER, cascade = CascadeType.DETACH, orphanRemoval = true)
+ private Set groupBookmarks;
+
+ public DataGridGroup() {
+
+ }
+
+ public DataGridGroup(String groupname, String additional_info) {
+ this.groupname = groupname;
+ this.additional_info = additional_info;
+ }
+
+ public String getDisplayName() {
+
+ return groupname;
+ }
+
+ /**
+ * @return the id
+ */
+ public long getId() {
+ return id;
+ }
+
+ /**
+ * @return the dataGridId
+ */
+ public long getDataGridId() {
+ return dataGridId;
+ }
+
+ /**
+ * @param id
+ * the id to set
+ */
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ /**
+ * @param dataGridId
+ * the dataGridId to set
+ */
+ public void setDataGridId(long dataGridId) {
+ this.dataGridId = dataGridId;
+ }
+
+ /**
+ * @return the groupName
+ */
+ public String getGroupname() {
+ return groupname;
+ }
+
+ /**
+ * @param the
+ * groupName to set
+ */
+ public void setGroupname(String groupName) {
+ groupname = groupName;
+ }
+
+ /**
+ * @return group's zone
+ */
+ public String getAdditionalInfo() {
+ return additional_info;
+ }
+
+ /**
+ * @param the
+ * zone to set
+ */
+ public void setAdditionalInfo(String additional_info) {
+ this.additional_info = additional_info;
+ }
+
+ /**
+ * @return the groupBookmarks
+ */
+ public Set getGroupBookmarks() {
+ return groupBookmarks;
+ }
+
+ /**
+ * @param groupBookmarks
+ * the groupBookmarks to set
+ */
+ public void setGroupBookmarks(Set groupBookmarks) {
+ this.groupBookmarks = groupBookmarks;
+ }
+
+ @Override
+ public int compareTo(DataGridGroup dgg) {
+ return groupname.compareTo(dgg.getGroupname());
+ }
+
+ @Override
+ public String toString() {
+ return groupname;
+ }
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridGroupBookmark.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridGroupBookmark.java
new file mode 100755
index 000000000..a8451a848
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridGroupBookmark.java
@@ -0,0 +1,185 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.metalnx.core.domain.entity;
+
+import com.emc.metalnx.core.domain.utils.DataGridCoreUtils;
+import org.hibernate.envers.Audited;
+import org.hibernate.envers.NotAudited;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+@Entity
+@Audited
+@Table(name = "group_bookmarks")
+public class DataGridGroupBookmark implements Serializable, Comparable {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @NotAudited
+ @Column(name = "id", unique = true, nullable = false)
+ private Long id;
+
+ @ManyToOne(fetch = FetchType.EAGER, optional = true)
+ @JoinColumn(name = "group_id", nullable = false, updatable = true)
+ private DataGridGroup group;
+
+ @Column(name = "path", nullable = false, length = 512)
+ private String path;
+
+ @Column(name = "is_notified", nullable = true)
+ private Boolean isNotified;
+
+ @Column(name = "is_collection", nullable = true)
+ private Boolean isCollection;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name = "created_at", nullable = false, length = 60, updatable = false)
+ private Date createTs;
+
+ private static final long serialVersionUID = -229875209906357557L;
+
+ /**
+ * @return the id
+ */
+ public Long getId() {
+ return id;
+ }
+
+ /**
+ * @return the group
+ */
+ public DataGridGroup getGroup() {
+ return group;
+ }
+
+ /**
+ * @return the path
+ */
+ public String getPath() {
+ return path;
+ }
+
+ /**
+ * @return the isNotified
+ */
+ public Boolean getIsNotified() {
+ return isNotified;
+ }
+
+ /**
+ * @return the createTs
+ */
+ public Date getCreateTs() {
+ return createTs;
+ }
+
+ /**
+ * @param id
+ * the id to set
+ */
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ /**
+ * @param group
+ * the group to set
+ */
+ public void setGroup(DataGridGroup group) {
+ this.group = group;
+ }
+
+ /**
+ * @param path
+ * the path to set
+ */
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ /**
+ * @param isNotified
+ * the isNotified to set
+ */
+ public void setIsNotified(Boolean isNotified) {
+ this.isNotified = isNotified;
+ }
+
+ /**
+ * @return the isCollection
+ */
+ public Boolean getIsCollection() {
+ return isCollection;
+ }
+
+ /**
+ * @param isCollection
+ * the isCollection to set
+ */
+ public void setIsCollection(Boolean isCollection) {
+ this.isCollection = isCollection;
+ }
+
+ /**
+ * @param createTs
+ * the createTs to set
+ */
+ public void setCreateTs(Date createTs) {
+ this.createTs = createTs;
+ }
+
+ /**
+ * Finds the file name based on its path
+ *
+ * @return file name
+ */
+ public String getFileName() {
+ if (getPath() == null) {
+ return new String();
+ }
+
+ String fileName = getPath() != null ? getPath() : "";
+ fileName = fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length());
+ return fileName;
+ }
+
+ /**
+ * Gets the icon to be displayed for a bookmarks based on its extension
+ *
+ * @return String containing the icon name to be displayed
+ */
+ public String getDisplayIcon() {
+ return DataGridCoreUtils.getIconToDisplay(getPath());
+ }
+
+ /**
+ * Formats the date when a collection/data object was modified
+ *
+ * @return String in the format MM/DD/YYYY HH:MM
+ */
+ public String getCreatedAtFormatted() {
+ return new SimpleDateFormat("MMM dd yyyy, HH:mm").format(createTs);
+ }
+
+ @Override
+ public int compareTo(DataGridGroupBookmark dgub) {
+ return getFileName().compareTo(dgub.getFileName());
+ }
+
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridGroupPermission.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridGroupPermission.java
new file mode 100755
index 000000000..74512bde3
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridGroupPermission.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.metalnx.core.domain.entity;
+
+public class DataGridGroupPermission {
+
+ private Integer dataGridId;
+ private String groupName;
+ private String permission;
+
+ /**
+ * @return the dataGridId
+ */
+ public Integer getDataGridId() {
+ return dataGridId;
+ }
+
+ /**
+ * @return the groupName
+ */
+ public String getGroupName() {
+ return groupName;
+ }
+
+ /**
+ * @return the permission
+ */
+ public String getPermission() {
+ return permission;
+ }
+
+ /**
+ * @param dataGridId
+ * the dataGridId to set
+ */
+ public void setDataGridId(Integer dataGridId) {
+ this.dataGridId = dataGridId;
+ }
+
+ /**
+ * @param groupName
+ * the groupName to set
+ */
+ public void setGroupName(String groupName) {
+ this.groupName = groupName;
+ }
+
+ /**
+ * @param permission
+ * the permission to set
+ */
+ public void setPermission(String permission) {
+ this.permission = permission;
+ }
+
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridMSIPkgInfo.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridMSIPkgInfo.java
new file mode 100755
index 000000000..6d523fc41
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridMSIPkgInfo.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.core.domain.entity;
+
+import com.emc.metalnx.core.domain.utils.DataGridCoreUtils;
+
+import java.util.List;
+
+/**
+ * Represents the status of the MSI package on the grid.
+ */
+public class DataGridMSIPkgInfo {
+ private List servers;
+ private boolean isThereAnyPkgMissing; // MSI pkg is not installed in one or more servers
+ private boolean isThereAnyPkgNotSupported; // MSI Pkg is installed but out-of-date
+
+ public DataGridMSIPkgInfo(List servers, String msiVersionSupported) {
+ this.servers = servers;
+ String versionSupported = DataGridCoreUtils.getAPIVersion(msiVersionSupported);
+
+ for(DataGridServer server: servers) {
+ String versionInstalled = DataGridCoreUtils.getAPIVersion(server.getMSIVersion());
+
+ if(versionInstalled.isEmpty()) isThereAnyPkgMissing = true;
+ else if(!versionInstalled.equalsIgnoreCase(versionSupported)) isThereAnyPkgNotSupported = true;
+ }
+ }
+
+ public List getServers() {
+ return servers;
+ }
+
+ public void setServers(List servers) {
+ this.servers = servers;
+ }
+
+ public boolean isThereAnyPkgMissing() {
+ return isThereAnyPkgMissing;
+ }
+
+ public boolean isThereAnyPkgNotSupported() {
+ return isThereAnyPkgNotSupported;
+ }
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridMetadata.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridMetadata.java
new file mode 100755
index 000000000..66fef5c14
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridMetadata.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.metalnx.core.domain.entity;
+
+public class DataGridMetadata implements Comparable {
+
+ private String attribute;
+
+ private String value;
+
+ private String unit;
+
+ public DataGridMetadata(){
+
+ }
+
+ public DataGridMetadata(String attribute, String value, String unit){
+ this.attribute = attribute;
+ this.value = value;
+ this.unit = unit;
+ }
+
+ @Override
+ public boolean equals(Object obj){
+ if(obj == null || !(obj instanceof DataGridMetadata)) return false;
+
+ DataGridMetadata m = (DataGridMetadata) obj;
+ return attribute.equals(m.getAttribute()) && value.equals(m.getValue()) && unit.equals(m.getUnit());
+ }
+
+ public String getAttribute() {
+ return attribute;
+ }
+
+ public void setAttribute(String attribute) {
+ this.attribute = attribute;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public String getUnit() {
+ return unit;
+ }
+
+ public void setUnit(String unit) {
+ this.unit = unit;
+ }
+
+ @Override
+ public int compareTo(DataGridMetadata o) {
+ return this.attribute.compareToIgnoreCase(o.getAttribute());
+ }
+
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridMetadataFields.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridMetadataFields.java
new file mode 100755
index 000000000..189ae9950
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridMetadataFields.java
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.metalnx.core.domain.entity;
+
+import org.hibernate.envers.Audited;
+import org.hibernate.envers.NotAudited;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@Entity
+@Audited
+@Table(name = "metadata_fields")
+public class DataGridMetadataFields implements Serializable, Comparable {
+
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ @NotAudited
+ @GeneratedValue(strategy=GenerationType.IDENTITY)
+ @Column(name = "id", unique = true, nullable = false)
+ private Long id;
+
+ @Column(name = "attribute", length = 60)
+ private String attribute;
+
+ @Column(name = "attribute_value", length = 60)
+ private String attributeValue;
+
+ @Column(name = "attribute_unit", length = 60)
+ private String attributeUnit;
+
+ @Column(name = "start_range")
+ private float startRange;
+
+ @Column(name = "end_range")
+ private float endRange;
+
+ @Column(name = "field_order")
+ private int order;
+
+ @ManyToOne(fetch = FetchType.EAGER, optional=true)
+ @JoinColumn(name = "template_id", nullable = false, updatable = true)
+ private DataGridTemplate template;
+
+ public DataGridMetadataFields() {
+
+ }
+
+ public DataGridMetadataFields(String attribute, String value, String unit) {
+ this.attribute = attribute;
+ this.attributeValue = value;
+ this.attributeUnit = unit;
+ }
+
+ /**
+ * @return the id
+ */
+ public long getId() {
+ return id;
+ }
+
+ /**
+ * @param id the id to set
+ */
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ /**
+ * @return the attribute
+ */
+ public String getAttribute() {
+ return attribute;
+ }
+
+ /**
+ * @param attribute the attribute to set
+ */
+ public void setAttribute(String attribute) {
+ this.attribute = attribute;
+ }
+
+ /**
+ * @return the value
+ */
+ public String getValue() {
+ return attributeValue;
+ }
+
+ /**
+ * @param value the value to set
+ */
+ public void setValue(String value) {
+ this.attributeValue = value;
+ }
+
+ /**
+ * @return the unit
+ */
+ public String getUnit() {
+ return attributeUnit;
+ }
+
+ /**
+ * @param unit the unit to set
+ */
+ public void setUnit(String unit) {
+ this.attributeUnit = unit;
+ }
+
+ @Override
+ public int compareTo(DataGridMetadataFields dgmf) {
+ return this.attributeValue.compareTo(dgmf.getValue());
+ }
+
+
+
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridMetadataSearch.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridMetadataSearch.java
new file mode 100755
index 000000000..5aa2857b4
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridMetadataSearch.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.metalnx.core.domain.entity;
+
+import com.emc.metalnx.core.domain.entity.enums.DataGridSearchOperatorEnum;
+
+/**
+ * This is a definition of metadata search criteria. A search criteria is broken into an object to
+ * manipulate its attribute, operator, and value.
+ *
+ */
+public class DataGridMetadataSearch {
+
+ private String attribute;
+ private DataGridSearchOperatorEnum operator;
+ private String value;
+ private String unit;
+ private String regex = "([^A-Za-z0-9-_.,:=! ]+)";
+ private String attrColName = "m.meta_attr_name";
+ private String valueColName = "m.meta_attr_value";
+ private String unitColName = "m.meta_attr_unit";
+
+ public DataGridMetadataSearch(String attribute, String value, String unit,
+ DataGridSearchOperatorEnum operator) {
+ this.attribute = attribute;
+ this.operator = operator;
+ this.value = value;
+ this.unit = unit;
+ }
+
+ /**
+ * Builds a SQL query string to look for a piece of metadata (attribute, operator, and value).
+ *
+ * @return SQL query string
+ */
+ public String getSpecQueryAsString() {
+ String attr = this.attribute.replaceAll(regex, "");
+ String opt = this.operator.toString().replaceAll(regex, "");
+ String val = this.value.replaceAll(regex, "");
+ String unit = this.unit.replaceAll(regex, "");
+
+ boolean hasAttr = !attr.isEmpty();
+ boolean hasVal = !val.isEmpty();
+ boolean hasUnit = !unit.isEmpty();
+
+ val = addSQLCharToQueryParamBasedOnOperator(val);
+ unit = addSQLCharToQueryParamBasedOnOperator(unit);
+
+ String attrQuery = hasAttr ? String.format(" LOWER( %s ) = LOWER( '%s' ) ", attrColName, attr) : "";
+ String valueQuery = hasVal ? String.format(" LOWER( %s ) %s LOWER( %s ) ", valueColName, opt, val) : "";
+ String unitQuery = hasUnit ? String.format(" LOWER( %s ) %s LOWER( %s ) ", unitColName, opt, unit) : "";
+
+ if (hasAttr && (hasVal || hasUnit)) {
+ attrQuery = String.format(" %s AND ", attrQuery);
+ }
+
+ if (hasVal && hasUnit) {
+ valueQuery = String.format(" %s AND ", valueQuery);
+ }
+
+ StringBuilder sb = new StringBuilder();
+ sb.append(" SELECT map.object_id AS map_object_id ");
+ sb.append(" FROM r_objt_metamap map ");
+ sb.append(" JOIN ( ");
+ sb.append(" SELECT m.meta_id, m.meta_attr_name, m.meta_attr_value");
+ sb.append(" FROM r_meta_main m ");
+ sb.append(" WHERE ");
+ sb.append(attrQuery);
+ sb.append(valueQuery);
+ sb.append(unitQuery);
+ sb.append(" )");
+ sb.append(" AS metadata ON (metadata.meta_id = map.meta_id)");
+ sb.append(" GROUP BY map.object_id");
+ sb.append(" HAVING COUNT(map.meta_id) > 0 ");
+ return sb.toString();
+ }
+
+ @Override
+ public String toString() {
+ return String.format("%s %s %s", this.attribute, this.operator.toString(), this.value);
+ }
+
+ /**
+ * Based on the operator applied to the query (LIKE or NOT LIKE), this method checks if any
+ * SQL special character needs to be added to the parameter in order for the query to run
+ * properly.
+ *
+ * @param param
+ * @return String representing the given parameters along with the proper SQL character for the
+ * query.
+ */
+ private String addSQLCharToQueryParamBasedOnOperator(String param) {
+ if (this.operator == DataGridSearchOperatorEnum.LIKE
+ || this.operator == DataGridSearchOperatorEnum.NOT_LIKE) {
+ return String.format(" '%%%s%%' ", param);
+ }
+ return String.format(" '%s' ", param);
+ }
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridPageContext.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridPageContext.java
new file mode 100755
index 000000000..b3832b78f
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridPageContext.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.metalnx.core.domain.entity;
+
+public class DataGridPageContext {
+
+ private int startItemNumber;
+ private int endItemNumber;
+ private int totalNumberOfItems;
+
+ /**
+ * @return the startItemNumber
+ */
+ public int getStartItemNumber() {
+ return startItemNumber;
+ }
+ /**
+ * @param startItemNumber the startItemNumber to set
+ */
+ public void setStartItemNumber(int startItemNumber) {
+ this.startItemNumber = startItemNumber;
+ }
+ /**
+ * @return the endItemNumber
+ */
+ public int getEndItemNumber() {
+ return endItemNumber;
+ }
+ /**
+ * @param endItemNumber the endItemNumber to set
+ */
+ public void setEndItemNumber(int endItemNumber) {
+ this.endItemNumber = endItemNumber;
+ }
+ /**
+ * @return the totalNumberOfItems
+ */
+ public int getTotalNumberOfItems() {
+ return totalNumberOfItems;
+ }
+ /**
+ * @param totalNumberOfItems the totalNumberOfItems to set
+ */
+ public void setTotalNumberOfItems(int totalNumberOfItems) {
+ this.totalNumberOfItems = totalNumberOfItems;
+ }
+
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridResource.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridResource.java
new file mode 100755
index 000000000..d2c02c53b
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridResource.java
@@ -0,0 +1,492 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.metalnx.core.domain.entity;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+public class DataGridResource implements Serializable, Comparable {
+
+ // resource id in the data grid
+ private long id;
+
+ // resource name ("demoResc")
+ private String name;
+
+ // resource zone name
+ private String zone;
+
+ // resource type ("unix file system", "replication", etc)
+ private String type;
+
+ // resource path
+ private String path;
+
+ // resource free space
+ private long freeSpace;
+
+ // when the free space was calculated
+ private Date freeSpaceTimeStamp;
+
+ // other resources existing inside this resource
+ private List children;
+
+ // resource parent name
+ private String parent;
+
+ // resource status ("up", "down")
+ private String status;
+
+ // resource host name
+ private String host;
+
+ // when the resource was created
+ private Date createTime;
+
+ // last time the resource was modified
+ private Date modifyTime;
+
+ // any information related to this resource
+ private String info;
+
+ // number of records existing in the resource
+ private int totalRecords;
+
+ // comment about a resource
+ private String comment;
+
+ // Context string of a resource
+ private String contextString;
+
+ private static final long serialVersionUID = 1L;
+
+ public DataGridResource(long id, String name, String zone, String type, String path, long freeSpace, Date freeSpaceTimeStamp,
+ List children, String parent, String status, String host, Date createTime, Date modifyTime, String info, int totalRecords,
+ String contextString) {
+ super();
+ this.id = id;
+ this.name = name;
+ this.zone = zone;
+ this.type = type;
+ this.path = path;
+ this.freeSpace = freeSpace;
+ this.freeSpaceTimeStamp = freeSpaceTimeStamp;
+ this.children = children;
+ this.parent = parent;
+ this.status = status;
+ this.host = host;
+ this.contextString = contextString;
+ }
+
+ public DataGridResource(long id, String name, String zone, String type, String path) {
+ this(id, name, zone, type, "unknown", -1, null, null, "unknown", "unknown", "unknown", new Date(), new Date(), "unknown", 0, null);
+ }
+
+ public DataGridResource() {
+ // empty constructor
+ }
+
+ @Override
+ public String toString() {
+ return "Resource Info" + "\n id=" + id + "\n name= " + name + "\n zone= " + zone + "\n type= " + type + "\n path= " + path + "\n freeSpace= "
+ + freeSpace + "\n freeSpaceDate= " + freeSpaceTimeStamp + "\n children= " + children + "\n parent= " + parent + "\n status= "
+ + status + "\n host= " + host + "\n context= " + contextString;
+ }
+
+ /**
+ * @return the id
+ */
+ public long getId() {
+ return id;
+ }
+
+ /**
+ * @param id
+ * the id to set
+ */
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ /**
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param name
+ * the name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * @return the zone
+ */
+ public String getZone() {
+ return zone;
+ }
+
+ /**
+ * @param zone
+ * the zone to set
+ */
+ public void setZone(String zone) {
+ this.zone = zone;
+ }
+
+ /**
+ * @return the type
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * @param type
+ * the type to set
+ */
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ /**
+ * @return the path
+ */
+ public String getPath() {
+ return path;
+ }
+
+ /**
+ * @param path
+ * the path to set
+ */
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ /**
+ * @return the freeSpace
+ */
+ public long getFreeSpace() {
+ return freeSpace;
+ }
+
+ /**
+ * @param freeSpace
+ * the freeSpace to set
+ */
+ public void setFreeSpace(long freeSpace) {
+ this.freeSpace = freeSpace;
+ }
+
+ /**
+ * @return the freeSpaceDate
+ */
+ public Date getFreeSpaceDate() {
+ return freeSpaceTimeStamp;
+ }
+
+ /**
+ * @param freeSpaceDate
+ * the freeSpaceDate to set
+ */
+ public void setFreeSpaceDate(Date freeSpaceDate) {
+ freeSpaceTimeStamp = freeSpaceDate;
+ }
+
+ /**
+ * @return the children
+ */
+ public List getChildren() {
+ if (children == null) return new ArrayList<>();
+ return children;
+ }
+
+ /**
+ * @param children
+ * the children to set
+ */
+ public void setChildren(List children) {
+ this.children = children;
+ }
+
+ public void addChildResc(String childResc) {
+ if (children == null) children = new ArrayList<>();
+ children.add(childResc);
+ }
+
+ /**
+ * @return the parent
+ */
+ public String getParent() {
+ if (parent == null) return "";
+ return parent;
+ }
+
+ /**
+ * @param parent
+ * the parent to set
+ */
+ public void setParent(String parent) {
+ this.parent = parent;
+ }
+
+ /**
+ * @return the status
+ */
+ public String getStatus() {
+ return status;
+ }
+
+ /**
+ * @param status
+ * the status to set
+ */
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ /**
+ * @return the host
+ */
+ public String getHost() {
+ return host;
+ }
+
+ /**
+ * @param host
+ * the host to set
+ */
+ public void setHost(String host) {
+ this.host = host;
+ }
+
+ /**
+ * @return the freeSpaceTimeStamp
+ */
+ public Date getFreeSpaceTimeStamp() {
+ return freeSpaceTimeStamp;
+ }
+
+ /**
+ * @param freeSpaceTimeStamp
+ * the freeSpaceTimeStamp to set
+ */
+ public void setFreeSpaceTimeStamp(Date freeSpaceTimeStamp) {
+ this.freeSpaceTimeStamp = freeSpaceTimeStamp;
+ }
+
+ /**
+ * @return the createTime
+ */
+ public Date getCreateTime() {
+ return createTime;
+ }
+
+ /**
+ * @param createTime
+ * the createTime to set
+ */
+ public void setCreateTime(Date createTime) {
+ this.createTime = createTime;
+ }
+
+ /**
+ * @return the modifyTime
+ */
+ public Date getModifyTime() {
+ return modifyTime;
+ }
+
+ /**
+ * @param modifyTime
+ * the modifyTime to set
+ */
+ public void setModifyTime(Date modifyTime) {
+ this.modifyTime = modifyTime;
+ }
+
+ /**
+ * @return the info
+ */
+ public String getInfo() {
+ return info;
+ }
+
+ /**
+ * @param info
+ * the info to set
+ */
+ public void setInfo(String info) {
+ this.info = info;
+ }
+
+ /**
+ * @return the totalRecords
+ */
+ public int getTotalRecords() {
+ return totalRecords;
+ }
+
+ /**
+ * @param totalRecords
+ * the totalRecords to set
+ */
+ public void setTotalRecords(int totalRecords) {
+ this.totalRecords = totalRecords;
+ }
+
+ /**
+ * @return the comment
+ */
+ public String getComment() {
+ return comment;
+ }
+
+ /**
+ * @param comment
+ * the comment to set
+ */
+ public void setComment(String comment) {
+ this.comment = comment;
+ }
+
+ /**
+ * @return the contextString
+ */
+ public String getContextString() {
+ return contextString;
+ }
+
+ /**
+ * @param contextString
+ * the contextString to set
+ */
+ public void setContextString(String contextString) {
+ this.contextString = contextString;
+ }
+
+ /**
+ * @return the isiHost
+ */
+ public String getIsiHost() {
+ String isiHost = "";
+
+ if (contextString == null || contextString.isEmpty()) {
+ return "";
+ }
+
+ if (contextString.contains("isi_host")) {
+ String[] contextStringSplitted = contextString.split(";");
+ // checking if after splitting we have the parts: isi_host, isi_port, isi_user
+ if (contextStringSplitted.length == 3) {
+ // isi_host=, getting the host_ip value
+ if (contextStringSplitted[0].length() == 2) {
+ isiHost = contextStringSplitted[0].split("=")[1];
+ }
+ else {
+ isiHost = null;
+ }
+ }
+ }
+
+ return isiHost;
+ }
+
+ /**
+ * @return the isiPort
+ */
+ public String getIsiPort() {
+ String isiPort = "";
+
+ if (contextString == null || contextString.isEmpty()) {
+ return "";
+ }
+
+ if (contextString.contains("isi_port")) {
+ String[] contextStringSplitted = contextString.split(";");
+ // checking if after splitting we have the parts: isi_host, isi_port, isi_user
+ if (contextStringSplitted.length == 3) {
+ // isi_port=, getting the port value
+ isiPort = contextStringSplitted[1].split("=")[1];
+ }
+ }
+
+ return isiPort;
+ }
+
+ /**
+ * @return the isiUser
+ */
+ public String getIsiUser() {
+ String isiUser = "";
+
+ if (contextString == null || contextString.isEmpty()) {
+ return "";
+ }
+
+ if (contextString.contains("isi_user")) {
+ String[] contextStringSplitted = contextString.split(";");
+ // checking if after splitting we have the parts: isi_host, isi_port, isi_user
+ if (contextStringSplitted.length == 3) {
+ // isi_user=, getting the username value
+ isiUser = contextStringSplitted[2].split("=")[1];
+ }
+ }
+
+ return isiUser;
+ }
+
+ /**
+ * Checks whether the resource is a root resource or not. Root resource is a resource
+ * that is not a child of any other resource.
+ *
+ * @return
+ */
+ public boolean isFirstLevelResc() {
+ String parent = getParent();
+ boolean isFirstLevel = false;
+
+ if (parent == null || parent.isEmpty() || parent.equals(zone)) {
+ isFirstLevel = true;
+ }
+
+ return isFirstLevel;
+ }
+
+ @Override
+ public int compareTo(DataGridResource dataGridResource) {
+ return getName().toLowerCase().compareTo(dataGridResource.getName().toLowerCase());
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ boolean isEqual = false;
+
+ if (object != null && object instanceof DataGridResource) {
+ isEqual = id == ((DataGridResource) object).getId();
+ }
+
+ return isEqual;
+ }
+
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridResourceType.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridResourceType.java
new file mode 100755
index 000000000..cce6e794d
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridResourceType.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.metalnx.core.domain.entity;
+
+import com.emc.metalnx.core.domain.entity.enums.DataGridResourceTypeEnum;
+
+public class DataGridResourceType implements Comparable {
+ private DataGridResourceTypeEnum dataGridType;
+ private String dataGridResourceTypeName;
+ private String dataGridResourceTypeNamePrettified;
+
+ public DataGridResourceType() {
+
+ }
+
+ public DataGridResourceType(String dataGridResourceTypeNamePrettified,
+ String dataGridResourceTypeName, DataGridResourceTypeEnum dataGridType) {
+ this.dataGridResourceTypeNamePrettified = dataGridResourceTypeNamePrettified;
+ this.dataGridType = dataGridType;
+ this.dataGridResourceTypeName = dataGridResourceTypeName;
+ }
+
+ @Override
+ public int compareTo(DataGridResourceType dgrt) {
+ return this.getDataGridResourceTypeName().compareTo(dgrt.getDataGridResourceTypeName());
+ }
+
+ /**
+ * @return the dataGridType
+ */
+ public DataGridResourceTypeEnum getDataGridType() {
+ return dataGridType;
+ }
+
+ /**
+ * @param dataGridType
+ * the dataGridType to set
+ */
+ public void setDataGridType(DataGridResourceTypeEnum dataGridType) {
+ this.dataGridType = dataGridType;
+ }
+
+ /**
+ * @return the dataGridTypeName
+ */
+ public String getDataGridResourceTypeName() {
+ return dataGridResourceTypeName;
+ }
+
+ /**
+ * @param dataGridTypeName
+ * the dataGridTypeName to set
+ */
+ public void setDataGridResourceTypeName(String dataGridResourceTypeName) {
+ this.dataGridResourceTypeName = dataGridResourceTypeName;
+ }
+
+ /**
+ * @return the dataGridResourceTypeNamePrettified
+ */
+ public String getDataGridResourceTypeNamePrettified() {
+ return dataGridResourceTypeNamePrettified;
+ }
+
+ /**
+ * @param dataGridResourceTypeNamePrettified
+ * the dataGridResourceTypeNamePrettified to set
+ */
+ public void setDataGridResourceTypeNamePrettified(String dataGridResourceTypeNamePrettified) {
+ this.dataGridResourceTypeNamePrettified = dataGridResourceTypeNamePrettified;
+ }
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridRule.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridRule.java
new file mode 100755
index 000000000..8a7991801
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridRule.java
@@ -0,0 +1,202 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.core.domain.entity;
+
+import org.springframework.beans.factory.annotation.Value;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * iRODS Rule.
+ */
+public class DataGridRule {
+ @Value("${irods.host}")
+ private String iCATHost;
+ private String[] inputRuleParams; // rule input parameters
+
+ private String[] outputRuleParams; // rule output parameters
+ private String host;
+ private String rule;
+ private boolean declareRuleOutputParams;
+ private static final String INPUT = "INPUT";
+
+ private static final String OUTPUT = "OUTPUT";
+ private static final String RULE_EXEC_OUT = "ruleExecOut";
+ private static final String RULE_INPUT_NULL = "null";
+ public static final String GET_VERSION_RULE = "getVersion";
+
+ public static final String POPULATE_RULE = "populateMetadataForFile";
+ public static final String JPG_RULE = "automaticJpgMetadataExtraction";
+ public static final String VCF_RULE = "automaticVcfMetadataExtraction";
+ public static final String BAM_CRAM_RULE = "automaticBamMetadataExtraction";
+ public static final String XML_MANIFEST_RULE = "automaticExtractMetadataFromXMLManifest";
+ public static final String REPL_DATA_OBJ_RULE = "replicateDataObjInAdminMode";
+ public static final String ILLUMINA_RULE = "illuminaMetadataForFile";
+ public static final String TAR_RULE = "extractTar";
+ public static final String GET_MSIS_RULE = "getMicroservices";
+ public static final String EMPTY_TRASH_RULE = "emptyTrash";
+ public static final String DEPLOYMENT_RULE = "deploymentRule";
+
+ // Maps rules for their respective microservices
+ private static final Map rulesMap;
+
+ static {
+ Map map = new HashMap<>();
+ map.put(POPULATE_RULE, "msiobjput_populate");
+ map.put(JPG_RULE, "msiobjjpeg_extract");
+ map.put(VCF_RULE, "msiobjput_mdvcf");
+ map.put(BAM_CRAM_RULE, "msiobjput_mdbam");
+ map.put(XML_MANIFEST_RULE, "msiobjput_mdmanifest");
+ map.put(REPL_DATA_OBJ_RULE, "msiDataObjRepl");
+ map.put(GET_VERSION_RULE, "msiobjget_version");
+ map.put(ILLUMINA_RULE, "msiget_illumina_meta");
+ map.put(TAR_RULE, "msiTarFileExtract");
+ map.put(GET_MSIS_RULE, "msiobjget_microservices");
+ map.put(EMPTY_TRASH_RULE, "msiRmColl");
+ map.put(DEPLOYMENT_RULE, "msirule_deployment");
+ rulesMap = Collections.unmodifiableMap(map);
+ }
+
+ public DataGridRule(String rule, String host, boolean declareRuleOutputParams) {
+ this.host = host;
+ this.rule = rule;
+ this.declareRuleOutputParams = declareRuleOutputParams;
+ }
+
+ public DataGridRule(String rule, String host) {
+ this(rule, host, true);
+ }
+
+ public void setInputRuleParams(String... params) { this.inputRuleParams = params; }
+
+ public void setOutputRuleParams(String... params) { this.outputRuleParams = params; }
+
+ public boolean declareRuleOutputParams() {
+ return declareRuleOutputParams;
+ }
+
+ private String getInputParamsAsString() {
+ StringBuilder sb = new StringBuilder();
+
+ sb.append(INPUT);
+ if(inputRuleParams != null) {
+ String[] params = inputRuleParams;
+ for (int i = 0; i < params.length - 1; i++) sb.append(String.format(" *p%d=\"%s\",", i, params[i]));
+ sb.append(String.format(" *p%d=\"%s\"\n", params.length - 1, params[params.length - 1]));
+ }
+ else {
+ sb.append(" ");
+ sb.append(RULE_INPUT_NULL);
+ sb.append("\n");
+ }
+
+ return sb.toString();
+ }
+
+ private String getOutputParamsAsString() {
+ StringBuilder sb = new StringBuilder();
+
+ sb.append(OUTPUT);
+
+ if(outputRuleParams != null) {
+ String[] params = outputRuleParams;
+ for (int i = 0; i < params.length - 1; i++) sb.append(String.format(" *%s,", params[i]));
+ sb.append(String.format(" *%s\n", params[params.length - 1]));
+ }
+ else {
+ sb.append(" ");
+ sb.append(RULE_EXEC_OUT);
+ sb.append("\n");
+ }
+
+ return sb.toString();
+ }
+
+ private String getMSIParamsAsString() {
+ StringBuilder paramsEscaped = new StringBuilder();
+ paramsEscaped.append(" ");
+ paramsEscaped.append(rulesMap.get(rule));
+ paramsEscaped.append("(");
+
+ if(inputRuleParams != null) {
+ for (int i = 0; i < inputRuleParams.length - 1; i++) paramsEscaped.append(String.format("*p%d, ", i));
+ paramsEscaped.append(String.format("*p%d", inputRuleParams.length - 1));
+
+ if(outputRuleParams != null) paramsEscaped.append(", ");
+ }
+
+ if(outputRuleParams != null) {
+ for (int i = 0; i < outputRuleParams.length - 1; i++) paramsEscaped.append(String.format("*%s, ", outputRuleParams[i]));
+ paramsEscaped.append(String.format("*%s", outputRuleParams[outputRuleParams.length - 1]));
+ }
+
+ paramsEscaped.append(");\n");
+
+ return paramsEscaped.toString();
+ }
+
+ private String initializeOutputParams() {
+ if(outputRuleParams == null) return "";
+
+ StringBuilder outputParams = new StringBuilder();
+ outputParams.append(" ");
+
+ for (int i = 0; i < outputRuleParams.length - 1; i++) outputParams.append(String.format("*%s=\"\",", outputRuleParams[i]));
+ outputParams.append(String.format("*%s=\"\";", outputRuleParams[outputRuleParams.length - 1]));
+
+ return outputParams.toString();
+ }
+
+ public String toString() {
+ RemoteRuleHeader header = new RemoteRuleHeader(host);
+ StringBuilder ruleString = new StringBuilder();
+ ruleString.append("\n");
+ ruleString.append(rule);
+ ruleString.append("{");
+ ruleString.append("\n");
+ if(declareRuleOutputParams) ruleString.append(initializeOutputParams() + "\n");
+ ruleString.append(header.getRemoteRuleHeader());
+ ruleString.append(getMSIParamsAsString());
+ ruleString.append(header.getRemoteRuleFooter());
+ ruleString.append("}");
+ ruleString.append("\n");
+ ruleString.append(getInputParamsAsString());
+ ruleString.append(getOutputParamsAsString());
+
+ return ruleString.toString();
+ }
+
+ private class RemoteRuleHeader {
+ private String remoteHeader = null;
+ private String remoteFooter = null;
+
+ RemoteRuleHeader(String host) {
+ remoteHeader = String.format(" remote(\"%s\", \"\") {\n", host);
+ remoteFooter = " }\n";
+ }
+
+ String getRemoteRuleHeader() {
+ return this.remoteHeader;
+ }
+
+ String getRemoteRuleFooter() {
+ return this.remoteFooter;
+ }
+ }
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridServer.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridServer.java
new file mode 100755
index 000000000..9f2428fa3
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridServer.java
@@ -0,0 +1,391 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.metalnx.core.domain.entity;
+
+import com.emc.metalnx.core.domain.entity.enums.DataGridServerType;
+
+import java.util.*;
+
+public class DataGridServer implements Comparable {
+
+ private DataGridServerType type;
+ private String hostname;
+ private String ip;
+ private String machineStatus;
+ private String dataGridStatus;
+ private String memoryStatus;
+ private String diskStatus;
+ private long totalStorageUsed;
+ private long totalStorageAvailable;
+ private long totalStorage;
+ private List resources;
+ private boolean isRmdPackageRunning;
+ private String rmdPackageRelease;
+ private String rmdPackageVersion;
+ private String msiVersion;
+ private List msisInstaleld;
+
+ private List mlxMSIsExpected;
+ private List irodsMSIsExpected;
+ private List otherMSIsExpected;
+
+ private Map metalnxMSIs;
+ private Map irodsMSIs;
+ private Map otherMSIs;
+
+ public DataGridServer() {
+ metalnxMSIs = new HashMap<>();
+ irodsMSIs = new HashMap<>();
+ otherMSIs = new HashMap<>();
+ }
+
+ /**
+ * @return the type
+ */
+ public DataGridServerType getType() {
+ return type;
+ }
+
+ /**
+ * @return the hostname
+ */
+ public String getHostname() {
+ return hostname;
+ }
+
+ /**
+ * Gets the resources of this server sorted by resource name
+ * @return the resources
+ */
+ public List getResources() {
+ if(resources != null) Collections.sort(resources);
+ return resources;
+ }
+
+ /**
+ * @param type
+ * the type to set
+ */
+ public void setType(DataGridServerType type) {
+ this.type = type;
+ }
+
+ /**
+ * @param hostname
+ * the hostname to set
+ */
+ public void setHostname(String hostname) {
+ this.hostname = hostname;
+ }
+
+ /**
+ * @param resources
+ * the resources to set
+ */
+ public void setResources(List resources) {
+ this.resources = resources;
+ }
+
+ /**
+ * Adds resource to the server
+ * @param resource to be added
+ */
+ public void addResource(DataGridResource resource) {
+ if (this.resources == null) {
+ this.resources = new ArrayList<>();
+ }
+ this.resources.add(resource);
+ }
+
+ public String getIp() {
+ return ip;
+ }
+
+ public void setIp(String ip) {
+ this.ip = ip;
+ }
+
+ /**
+ * @return the machineStatus
+ */
+ public String getMachineStatus() {
+ return machineStatus;
+ }
+
+ /**
+ * @return the dataGridStatus
+ */
+ public String getDataGridStatus() {
+ return dataGridStatus;
+ }
+
+ /**
+ * @return the memoryStatus
+ */
+ public String getMemoryStatus() {
+ return memoryStatus;
+ }
+
+ /**
+ * @return the diskStatus
+ */
+ public String getDiskStatus() {
+ return diskStatus;
+ }
+
+ /**
+ * @param machineStatus the machineStatus to set
+ */
+ public void setMachineStatus(String machineStatus) {
+ this.machineStatus = machineStatus;
+ }
+
+ /**
+ * @param dataGridStatus the dataGridStatus to set
+ */
+ public void setDataGridStatus(String dataGridStatus) {
+ this.dataGridStatus = dataGridStatus;
+ }
+
+ /**
+ * @param memoryStatus the memoryStatus to set
+ */
+ public void setMemoryStatus(String memoryStatus) {
+ this.memoryStatus = memoryStatus;
+ }
+
+ /**
+ * @param diskStatus the diskStatus to set
+ */
+ public void setDiskStatus(String diskStatus) {
+ this.diskStatus = diskStatus;
+ }
+
+ /**
+ * @return the totalStorageUsed
+ */
+ public long getTotalStorageUsed() {
+ return totalStorageUsed;
+ }
+
+ /**
+ * @return the totalStorageAvailable
+ */
+ public long getTotalStorageAvailable() {
+ return totalStorageAvailable;
+ }
+
+ /**
+ * @return the totalStorage
+ */
+ public long getTotalStorage() {
+ return totalStorage;
+ }
+
+ /**
+ * @param totalStorageUsed the totalStorageUsed to set
+ */
+ public void setTotalStorageUsed(long totalStorageUsed) {
+ this.totalStorageUsed = totalStorageUsed;
+ }
+
+ /**
+ * @param totalStorageAvailable the totalStorageAvailable to set
+ */
+ public void setTotalStorageAvailable(long totalStorageAvailable) {
+ this.totalStorageAvailable = totalStorageAvailable;
+ }
+
+ /**
+ * @param totalStorage the totalStorage to set
+ */
+ public void setTotalStorage(long totalStorage) {
+ this.totalStorage = totalStorage;
+ }
+
+ /**
+ * @return the isRmdPackageRunning
+ */
+ public boolean isRmdPackageRunning() {
+ return isRmdPackageRunning;
+ }
+
+ /**
+ * @param isRmdPackageRunning the isRmdPackageRunning to set
+ */
+ public void setRmdPackageRunning(boolean isRmdPackageRunning) {
+ this.isRmdPackageRunning = isRmdPackageRunning;
+ }
+
+ /**
+ * This method compares if two DataGridServer objects are the same. They will be the same
+ * if they have the same host name.
+ * @return true, if they are equal. False, otherwise.
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if(obj == null) {
+ return false;
+ }
+
+ if(this == obj) {
+ return true;
+ }
+
+ if(obj instanceof DataGridServer) {
+ String hostName = ((DataGridServer) obj).getHostname();
+ return this.getHostname().equals(hostName) ;
+ }
+
+ return false;
+ }
+
+ /**
+ * This method provides consistent results for the equals method. If two DataGridServer objects
+ * are equal, they both must have the same hash code.
+ * @return a hash code based on the host name
+ */
+ @Override
+ public int hashCode() {
+ return this.getHostname().hashCode();
+ }
+
+ @Override
+ public int compareTo(DataGridServer dgs) {
+ return this.ip.compareTo(dgs.getIp());
+ }
+
+ /**
+ * @return the rmdPackageRelease
+ */
+ public String getRmdPackageRelease() {
+ return rmdPackageRelease;
+ }
+
+ /**
+ * @param rmdPackageRelease the rmdPackageRelease to set
+ */
+ public void setRmdPackageRelease(String rmdPackageRelease) {
+ this.rmdPackageRelease = rmdPackageRelease;
+ }
+
+ /**
+ * @return the rmdPackageVersion
+ */
+ public String getRmdPackageVersion() {
+ return rmdPackageVersion;
+ }
+
+ /**
+ * @param rmdPackageVersion the rmdPackageVersion to set
+ */
+ public void setRmdPackageVersion(String rmdPackageVersion) {
+ this.rmdPackageVersion = rmdPackageVersion;
+ }
+
+ public void setMSIVersion(String msiVersion) { this.msiVersion = msiVersion; }
+
+ public String getMSIVersion() {
+ if(msiVersion == null ){
+ return "";
+ }
+ return msiVersion;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append(getHostname());
+ sb.append(" - ");
+ sb.append(getIp());
+ sb.append(" - ");
+ sb.append(getMSIVersion());
+ return sb.toString();
+ }
+
+ public void setMSIInstalledList(List msisInstalled) {
+ if(msisInstalled == null || msisInstalled.isEmpty()) return;
+
+ this.msisInstaleld = msisInstalled;
+
+ // classifying MSIs by their type
+ for(String msi: msisInstalled) {
+ if(mlxMSIsExpected.contains(msi)) addToMsiMetalnx(msi);
+ else if(irodsMSIsExpected.contains(msi)) addToMsiIRODS(msi);
+ else addToMsiOther(msi);
+ }
+ }
+
+ public List getMSIInstalledList() {
+ return this.msisInstaleld != null ? this.msisInstaleld : new ArrayList<>();
+ }
+
+ public void setMetalnxExpectedMSIs(List mlxMSIsExpected) {
+ if(mlxMSIsExpected == null || mlxMSIsExpected.isEmpty()) return;
+
+ this.mlxMSIsExpected = mlxMSIsExpected;
+ for(String msi: mlxMSIsExpected) {
+ if (!msi.isEmpty()) metalnxMSIs.put(msi, false);
+ }
+ }
+
+ public void setIRodsExpectedMSIs(List irodsMSIsExpected) {
+ if(irodsMSIsExpected == null || irodsMSIsExpected.isEmpty()) return;
+
+ this.irodsMSIsExpected = irodsMSIsExpected;
+ for(String msi: irodsMSIsExpected) {
+ if (!msi.isEmpty()) irodsMSIs.put(msi, false);
+ }
+ }
+
+ public void setOtherExpectedMSIs(List otherMSIsExpected) {
+ if(otherMSIsExpected == null || otherMSIsExpected.isEmpty()) return;
+
+ this.otherMSIsExpected = otherMSIsExpected;
+ for(String msi: otherMSIsExpected) {
+ if (!msi.isEmpty()) otherMSIs.put(msi, false);
+ }
+ }
+
+ // used by frontend
+ public Map getMetalnxMSIs() { return metalnxMSIs; }
+
+ // used by frontend
+ public Map getIRODSMSIs() { return irodsMSIs; }
+
+ // used by frontend
+ public Map getOtherMSIs() { return otherMSIs; }
+
+ // used by frontend
+ public boolean isThereAnyMSI() {
+ return !getMSIInstalledList().isEmpty();
+ }
+
+ private void addToMsiMetalnx(String msi) {
+ if(msi == null || msi.isEmpty()) return;
+ this.metalnxMSIs.put(msi, true);
+ }
+
+ private void addToMsiIRODS(String msi) {
+ if(msi == null || msi.isEmpty()) return;
+ this.irodsMSIs.put(msi, true);
+ }
+
+ private void addToMsiOther(String msi) {
+ if(msi == null || msi.isEmpty()) return;
+ this.otherMSIs.put(msi, true);
+ }
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridSpecificQuery.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridSpecificQuery.java
new file mode 100755
index 000000000..a2008381f
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridSpecificQuery.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.metalnx.core.domain.entity;
+
+public class DataGridSpecificQuery {
+
+ private String alias;
+ private String query;
+
+ /**
+ * @return the alias
+ */
+ public String getAlias() {
+ return alias;
+ }
+
+ /**
+ * @return the query
+ */
+ public String getQuery() {
+ return query;
+ }
+
+ /**
+ * @param alias the alias to set
+ */
+ public void setAlias(String alias) {
+ this.alias = alias;
+ }
+
+ /**
+ * @param query the query to set
+ */
+ public void setQuery(String query) {
+ this.query = query;
+ }
+
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridTemplate.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridTemplate.java
new file mode 100755
index 000000000..6d83069c6
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridTemplate.java
@@ -0,0 +1,284 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.metalnx.core.domain.entity;
+
+import com.emc.metalnx.core.domain.exceptions.DataGridTooLongTemplateNameException;
+import org.hibernate.envers.Audited;
+import org.hibernate.envers.NotAudited;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.util.Date;
+import java.util.Set;
+
+@Entity
+@Audited
+@Table(name = "templates")
+public class DataGridTemplate implements Serializable, Comparable {
+
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ @NotAudited
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Column(name = "template_id", unique = true, nullable = false)
+ private Long id;
+
+ @Column(name = "template_name", unique = true, nullable = false, length = 100)
+ private String templateName;
+
+ @Column(name = "owner", nullable = false, length = 100)
+ private String owner;
+
+ @Column(name = "description", nullable = false, length = 512)
+ private String description;
+
+ @Column(name = "usage_info", length = 100)
+ private String usageInformation;
+
+ @Column(name = "access_type", length = 32)
+ private String accessType;
+
+ @Column(name = "version")
+ private Integer version;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name = "create_ts", nullable = false, length = 60, updatable = false)
+ private Date createTs;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name = "modify_ts", nullable = false, length = 60)
+ private Date modifyTs;
+
+ @OneToMany(mappedBy = "template", fetch = FetchType.EAGER)
+ private Set fields;
+
+ private static final int TEMPLATE_NAME_MAX_LENGTH = 100;
+ private static final int TEMPLATE_DESC_MAX_LENGTH = 100;
+
+ private boolean isModified = false;
+
+ public DataGridTemplate() {
+ // empty constructor
+ }
+
+ public DataGridTemplate(String templateName) throws DataGridTooLongTemplateNameException {
+ if (templateName.length() > TEMPLATE_NAME_MAX_LENGTH) {
+ throw new DataGridTooLongTemplateNameException("Template name exceeded " + TEMPLATE_NAME_MAX_LENGTH + " characters.");
+ }
+
+ this.templateName = templateName;
+ }
+
+ /**
+ * @return the owner
+ */
+ public String getOwner() {
+ return owner;
+ }
+
+ /**
+ * @param owner
+ * the owner to set
+ */
+ public void setOwner(String owner) {
+ this.owner = owner;
+ }
+
+ /**
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * @param description
+ * the description to set
+ * @throws DataGridTooLongTemplateNameException
+ */
+ public void setDescription(String description) throws DataGridTooLongTemplateNameException {
+ if (description.length() > TEMPLATE_NAME_MAX_LENGTH) {
+ throw new DataGridTooLongTemplateNameException("Template description exceeded " + TEMPLATE_DESC_MAX_LENGTH + " characters.");
+ }
+ this.description = description;
+ }
+
+ /**
+ * @return the createTs
+ */
+ public Date getCreateTs() {
+ return createTs;
+ }
+
+ /**
+ * @param createTs
+ * the createTs to set
+ */
+ public void setCreateTs(Date createTs) {
+ this.createTs = createTs;
+ }
+
+ /**
+ * @return the modifyTs
+ */
+ public Date getModifyTs() {
+ return modifyTs;
+ }
+
+ /**
+ * @param modifyTs
+ * the modifyTs to set
+ */
+ public void setModifyTs(Date modifyTs) {
+ this.modifyTs = modifyTs;
+ }
+
+ /**
+ * @return the id
+ */
+ public long getId() {
+ return id;
+ }
+
+ /**
+ * @param id
+ * the id to set
+ */
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ /**
+ * @return the templateName
+ */
+ public String getTemplateName() {
+ return templateName;
+ }
+
+ /**
+ * @param the
+ * templateName to set
+ * @throws DataGridTooLongTemplateNameException
+ */
+ public void setTemplateName(String templateName) throws DataGridTooLongTemplateNameException {
+ if (templateName.length() > TEMPLATE_NAME_MAX_LENGTH) {
+ throw new DataGridTooLongTemplateNameException("Template name exceeded " + TEMPLATE_NAME_MAX_LENGTH + " characters.");
+ }
+
+ this.templateName = templateName;
+ }
+
+ /**
+ * @return the usageInformation
+ */
+ public String getUsageInformation() {
+ return usageInformation;
+ }
+
+ /**
+ * @param usageInformation
+ * the usageInformation to set
+ */
+ public void setUsageInformation(String usageInformation) {
+ this.usageInformation = usageInformation;
+ }
+
+ /**
+ * @return the accessType
+ */
+ public String getAccessType() {
+ return accessType;
+ }
+
+ /**
+ * @param accessType
+ * the accessType to set
+ */
+ public void setAccessType(String accessType) {
+ this.accessType = accessType;
+ }
+
+ /**
+ * @return the fields
+ */
+ public Set getFields() {
+ return fields;
+ }
+
+ /**
+ * @param fields
+ * the fields to set
+ */
+ public void setFields(Set fields) {
+ this.fields = fields;
+ }
+
+ /**
+ * @return the version
+ */
+ public Integer getVersion() {
+ return version;
+ }
+
+ /**
+ * @param version
+ * the version to set
+ */
+ public void setVersion(Integer version) {
+ this.version = version;
+ }
+
+ /**
+ * @return the isModified
+ */
+ public boolean isModified() {
+ return isModified;
+ }
+
+ /**
+ * @param isModified
+ * the isModified to set
+ */
+ public void setModified(boolean isModified) {
+ this.isModified = isModified;
+ }
+
+ @Override
+ public int compareTo(DataGridTemplate dgt) {
+ return templateName.compareTo(dgt.getTemplateName());
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("Template: ");
+ sb.append(templateName);
+ sb.append("\nDescription: ");
+ sb.append(description);
+ sb.append("\nOwner: ");
+ sb.append(owner);
+ sb.append("\nAccess Type: ");
+ sb.append(accessType);
+ sb.append("\nCreated: ");
+ sb.append(createTs);
+ sb.append("\nModified: ");
+ sb.append(modifyTs);
+ sb.append("\n");
+ return sb.toString();
+ }
+
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridTemplateField.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridTemplateField.java
new file mode 100755
index 000000000..fd96c80a6
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridTemplateField.java
@@ -0,0 +1,295 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.metalnx.core.domain.entity;
+
+import com.emc.metalnx.core.domain.exceptions.DataGridTemplateAttrException;
+import com.emc.metalnx.core.domain.exceptions.DataGridTemplateUnitException;
+import com.emc.metalnx.core.domain.exceptions.DataGridTemplateValueException;
+import org.hibernate.envers.Audited;
+import org.hibernate.envers.NotAudited;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+@Entity
+@Audited
+@Table(name = "template_fields")
+public class DataGridTemplateField implements Serializable, Comparable {
+
+ private static final long serialVersionUID = 1L;
+
+ private final int MAX_ATTR_LENGTH = 100;
+ private final int MAX_VAL_LENGTH = 100;
+ private final int MAX_UNT_LENGTH = 100;
+
+ @Id
+ @NotAudited
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Column(name = "template_field_id", unique = true, nullable = false)
+ private Long id;
+
+ @Column(name = "attribute", length = MAX_ATTR_LENGTH)
+ private String attribute;
+
+ @Column(name = "attribute_value", length = MAX_VAL_LENGTH)
+ private String attributeValue;
+
+ @Column(name = "attribute_unit", length = MAX_UNT_LENGTH)
+ private String attributeUnit;
+
+ @Column(name = "start_range")
+ private float startRange;
+
+ @Column(name = "end_range")
+ private float endRange;
+
+ @Column(name = "field_order")
+ private int order;
+
+ @ManyToOne(fetch = FetchType.EAGER, optional = true)
+ @JoinColumn(name = "template_id", nullable = false, updatable = true)
+ private DataGridTemplate template;
+
+ public DataGridTemplateField() {
+
+ }
+
+ public DataGridTemplateField(String attribute, String value, String unit, DataGridTemplate template) throws DataGridTemplateAttrException,
+ DataGridTemplateValueException, DataGridTemplateUnitException {
+ if (attribute == null || attribute.length() > MAX_ATTR_LENGTH) {
+ throw new DataGridTemplateAttrException("Template attribute is null or exceed " + MAX_ATTR_LENGTH + " characters.");
+ }
+
+ if (value == null || value.length() > MAX_VAL_LENGTH) {
+ throw new DataGridTemplateValueException("Template attribute is null or exceed " + MAX_ATTR_LENGTH + " characters.");
+ }
+
+ if (unit == null || unit.length() > MAX_UNT_LENGTH) {
+ throw new DataGridTemplateUnitException("Template attribute is null or exceed " + MAX_ATTR_LENGTH + " characters.");
+ }
+
+ this.attribute = attribute;
+ attributeValue = value;
+ attributeUnit = unit;
+ this.template = template;
+ }
+
+ public DataGridTemplateField(String attribute, String value, String unit) throws DataGridTemplateAttrException, DataGridTemplateValueException,
+ DataGridTemplateUnitException {
+ this(attribute, value, unit, null);
+ }
+
+ /**
+ * @return the id
+ */
+ public Long getId() {
+ return id;
+ }
+
+ /**
+ * @param id
+ * the id to set
+ */
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ /**
+ * @return the attribute
+ */
+ public String getAttribute() {
+ return attribute;
+ }
+
+ /**
+ * @param attribute
+ * the attribute to set
+ * @throws DataGridTemplateAttrException
+ */
+ public void setAttribute(String attribute) throws DataGridTemplateAttrException {
+ if (attribute == null || attribute.length() > MAX_ATTR_LENGTH) {
+ throw new DataGridTemplateAttrException("Template attribute is null or exceed " + MAX_ATTR_LENGTH + " characters.");
+ }
+
+ this.attribute = attribute;
+ }
+
+ /**
+ * @return the value
+ */
+ public String getValue() {
+ return attributeValue;
+ }
+
+ /**
+ * @param value
+ * the value to set
+ * @throws DataGridTemplateValueException
+ */
+ public void setValue(String value) throws DataGridTemplateValueException {
+ if (value == null || value.length() > MAX_VAL_LENGTH) {
+ throw new DataGridTemplateValueException("Template attribute is null or exceed " + MAX_ATTR_LENGTH + " characters.");
+ }
+
+ attributeValue = value;
+ }
+
+ /**
+ * @return the unit
+ */
+ public String getUnit() {
+ return attributeUnit;
+ }
+
+ /**
+ * @param unit
+ * the unit to set
+ * @throws DataGridTemplateUnitException
+ */
+ public void setUnit(String unit) throws DataGridTemplateUnitException {
+ if (unit == null || unit.length() > MAX_UNT_LENGTH) {
+ throw new DataGridTemplateUnitException("Template attribute is null or exceed " + MAX_ATTR_LENGTH + " characters.");
+ }
+
+ attributeUnit = unit;
+ }
+
+ /**
+ * @return the template
+ */
+ public DataGridTemplate getTemplate() {
+ return template;
+ }
+
+ /**
+ * @param template
+ * the template to set
+ */
+ public void setTemplate(DataGridTemplate template) {
+ this.template = template;
+ }
+
+ /**
+ * @return the startRange
+ */
+ public float getStartRange() {
+ return startRange;
+ }
+
+ /**
+ * @param startRange
+ * the startRange to set
+ */
+ public void setStartRange(float startRange) {
+ this.startRange = startRange;
+ }
+
+ /**
+ * @return the endRange
+ */
+ public float getEndRange() {
+ return endRange;
+ }
+
+ /**
+ * @param endRange
+ * the endRange to set
+ */
+ public void setEndRange(float endRange) {
+ this.endRange = endRange;
+ }
+
+ /**
+ * @return the order
+ */
+ public int getOrder() {
+ return order;
+ }
+
+ /**
+ * @param order
+ * the order to set
+ */
+ public void setOrder(int order) {
+ this.order = order;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("Id: ");
+ sb.append(id);
+ sb.append("\nAttribute: ");
+ sb.append(getAttribute());
+ sb.append("\nValue: ");
+ sb.append(getValue());
+ sb.append("\nUnit: ");
+ sb.append(getUnit());
+ sb.append("\nOrder: ");
+ sb.append(getOrder());
+ sb.append("\nStart Range: ");
+ sb.append(getStartRange());
+ sb.append("\nEnd Range: ");
+ sb.append(getEndRange());
+ sb.append("\nTemplate: ");
+ sb.append(getTemplate().getTemplateName());
+ return sb.toString();
+ }
+
+ @Override
+ public int compareTo(DataGridTemplateField dgmf) {
+ if (attribute != null) {
+ return attribute.compareTo(dgmf.getAttribute());
+ }
+ else if (attributeValue != null) {
+ return attributeValue.compareTo(dgmf.getValue());
+ }
+ else if (attributeUnit != null) {
+ return attributeUnit.compareTo(dgmf.getUnit());
+ }
+
+ return 0;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == null) {
+ return false;
+ }
+
+ if (obj instanceof DataGridTemplateField) {
+ DataGridTemplateField dgmf = (DataGridTemplateField) obj;
+
+ if (dgmf.getAttribute() == null || dgmf.getValue() == null) {
+ return false;
+ }
+
+ boolean areAttributesEqual = getAttribute().equals(dgmf.getAttribute());
+ boolean areValuesEqual = getValue().equals(dgmf.getValue());
+
+ if (areAttributesEqual && areValuesEqual) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return (getAttribute() + getValue()).hashCode();
+ }
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridTicket.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridTicket.java
new file mode 100755
index 000000000..82f872833
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridTicket.java
@@ -0,0 +1,266 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.core.domain.entity;
+
+import com.emc.metalnx.core.domain.utils.DataGridJsonDateDeserializer;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.Serializable;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Class that represents a ticket.
+ */
+public class DataGridTicket implements Serializable {
+ private static final Logger logger = LoggerFactory.getLogger(DataGridTicket.class);
+ public static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+
+ private String ticketString, path, owner;
+ private TicketType type;
+ private boolean isCollection;
+ private int usesLimit;
+ private int usesCount;
+ private long writeByteLimit;
+ private long writeByteCount;
+ private int writeFileLimit;
+ private int writeFileCount;
+
+ @JsonDeserialize(using = DataGridJsonDateDeserializer.class)
+ private Date expirationDate;
+
+ private String expirationDateStr;
+
+ // Ticket restrictions
+ private List hosts;
+ private List users;
+ private List groups;
+
+ public enum TicketType {
+ READ, WRITE, UNKNOWN;
+ }
+
+ /**
+ * Empty constructor
+ */
+ public DataGridTicket() {
+ this("");
+ }
+
+ /**
+ * Constructor.
+ * @param path path in the grid that the ticket
+ */
+ public DataGridTicket(String path) {
+ this.path = path;
+ ticketString = "";
+ owner = "";
+ expirationDateStr = "";
+ type = TicketType.READ;
+ usesLimit = 0;
+ writeByteLimit = 0;
+ hosts = new ArrayList<>();
+ users = new ArrayList<>();
+ groups = new ArrayList<>();
+ }
+
+ public void addHost(String newHost) {
+ if(hosts == null) hosts = new ArrayList<>();
+ if(!hosts.contains(newHost)) hosts.add(newHost);
+ }
+
+ public void addUser(String user) {
+ if(users == null) users = new ArrayList<>();
+ if(!users.contains(user)) users.add(user);
+ }
+
+ public void addGroup(String group) {
+ if(groups == null) groups = new ArrayList<>();
+ if(!groups.contains(group)) groups.add(group);
+ }
+
+ public void setGroups(List groups) {
+ this.groups = groups;
+ }
+
+ public void setUsers(List users) {
+ this.users = users;
+ }
+
+ public void setHosts(List hosts) {
+ this.hosts = hosts;
+ }
+
+ public void setWriteFileLimit(int writeFileLimit) {
+ this.writeFileLimit = writeFileLimit;
+ }
+
+ public void setWriteFileCount(int writeFileCount) {
+ this.writeFileCount = writeFileCount;
+ }
+
+ public void setWriteByteLimit(long writeByteLimit) {
+ this.writeByteLimit = writeByteLimit;
+ }
+
+ public void setWriteByteCount(long writeByteCount) {
+ this.writeByteCount = writeByteCount;
+ }
+
+ public void setUsesCount(int usesCount) {
+ this.usesCount = usesCount;
+ }
+
+ public void setExpirationDate(Date expirationDate) {
+ this.expirationDate = expirationDate;
+ }
+
+ public void setExpirationDateStr(String expirationDateStr) {
+ if (expirationDateStr == null) {
+ this.expirationDateStr = "";
+ return;
+ }
+ this.expirationDateStr = expirationDateStr;
+ }
+
+ public void setUsesLimit(int usesLimit) {
+ this.usesLimit = usesLimit;
+ }
+
+ public void setTicketString(String ticketString) {
+ this.ticketString = ticketString;
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ public void setOwner(String owner) {
+ this.owner = owner;
+ }
+
+ public void setType(TicketType type) {
+ this.type = type;
+ }
+
+ /**
+ * Tells whether or not the ticket is for a collection.
+ * @param isTicketForCollection True if the path associated to the ticket is a collection. False, otherwise.
+ */
+ public void setIsCollection(boolean isTicketForCollection) {
+ isCollection = isTicketForCollection;
+ }
+
+ public List getGroups() {
+ if(groups == null) users = new ArrayList<>();
+ return groups;
+ }
+
+ public List getUsers() {
+ if(users == null) users = new ArrayList<>();
+ return users;
+ }
+
+ public List getHosts() {
+ if(hosts == null) users = new ArrayList<>();
+ return hosts;
+ }
+
+ public int getWriteFileLimit() {
+ return writeFileLimit;
+ }
+
+ public int getWriteFileCount() {
+ return writeFileCount;
+ }
+
+ public long getWriteByteCount() {
+ return writeByteCount;
+ }
+
+ public long getWriteByteLimit() {
+ return writeByteLimit;
+ }
+
+ public int getUsesCount() {
+ return usesCount;
+ }
+
+ public String getExpirationDateStr() {
+ if (expirationDate != null) {
+ expirationDateStr = dateFormat.format(expirationDate);
+ } else if (expirationDateStr.isEmpty()) {
+ expirationDateStr = "";
+ }
+ return expirationDateStr;
+ }
+
+ public Date getExpirationDate() {
+ if (!expirationDateStr.isEmpty()) {
+ try {
+ expirationDate = dateFormat.parse(expirationDateStr);
+ } catch (ParseException e) {
+ logger.error("Could not parse expiration date");
+ }
+ }
+
+ return expirationDate;
+ }
+
+ public int getUsesLimit() {
+ return usesLimit;
+ }
+
+ public String getTicketString() {
+ if(ticketString == null) ticketString = "";
+ return ticketString;
+ }
+
+ public String getPath() {
+ if(path == null) path = "";
+ return path;
+ }
+
+ public String getOwner() {
+ if(owner == null) owner = "";
+ return owner;
+ }
+
+ public TicketType getType() {
+ return type;
+ }
+
+ public boolean isCollection() {
+ return isCollection;
+ }
+
+ @Override
+ public String toString() {
+ return "DataGridTicket{" +
+ "ticketString='" + ticketString + '\'' +
+ ", path='" + path + '\'' +
+ ", owner='" + owner + '\'' +
+ ", type=" + type +
+ ", isCollection=" + isCollection +
+ '}';
+ }
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridUser.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridUser.java
new file mode 100755
index 000000000..095c9c76b
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridUser.java
@@ -0,0 +1,420 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.metalnx.core.domain.entity;
+
+import org.hibernate.envers.Audited;
+import org.hibernate.envers.NotAudited;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+
+@Entity
+@Audited
+@Table(name = "users", uniqueConstraints = @UniqueConstraint(columnNames = { "username", "additional_info" }) )
+public class DataGridUser implements Serializable, Comparable {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @NotAudited
+ private Long id;
+
+ @Column(name = "data_grid_id", unique = true, nullable = false)
+ private long dataGridId;
+
+ @Column(name = "username", nullable = false, length = 60, unique = true)
+ private String username;
+
+ private String password;
+
+ @Column(name = "additional_info", nullable = true, length = 128)
+ private String additionalInfo;
+
+ @Column(name = "enabled", nullable = false)
+ private boolean enabled;
+
+ @Column(name = "first_name")
+ private String firstName;
+
+ @Column(name = "last_name")
+ private String lastName;
+
+ @Column(name = "email", nullable = true)
+ private String email;
+
+ @Column(name = "locale")
+ private String locale = "en";
+
+ @Column(name = "forceFileOverwriting", nullable = false)
+ private boolean forceFileOverwriting = false;
+
+ @Column(name = "user_type", nullable = false, length = 60)
+ private String userType;
+
+ @Column(name = "organizational_role", nullable = true, length = 60)
+ private String organizationalRole;
+
+ @ManyToOne(fetch = FetchType.EAGER, optional = true)
+ @JoinColumn(name = "userProfile_id", nullable = true, updatable = true)
+ private UserProfile userProfile;
+
+ @Column(name = "user_company", nullable = true, length = 60)
+ private String company;
+
+ @Column(name = "user_department", nullable = true, length = 60)
+ private String department;
+
+ @Column(name = "user_title", nullable = true, length = 60)
+ private String title;
+
+ @OneToMany(mappedBy = "user", fetch = FetchType.EAGER, cascade = CascadeType.DETACH, orphanRemoval = true)
+ private Set bookmarks;
+
+ @OneToMany(mappedBy = "user", fetch = FetchType.EAGER, cascade = CascadeType.DETACH, orphanRemoval = true)
+ private Set favorites;
+
+ private static final long serialVersionUID = -500578459147421831L;
+
+ public DataGridUser() {
+
+ }
+
+ public DataGridUser(String username, String password, boolean enabled) {
+ this.username = username;
+ this.enabled = enabled;
+ }
+
+ public String getDisplayName() {
+ if (firstName != null && !firstName.isEmpty()) {
+ return firstName;
+ }
+
+ return username;
+ }
+
+ /**
+ * Gets the user bookmarks sorted in ascending order
+ *
+ * @return the userBookmarks
+ */
+ public List getBookmarksSorted() {
+ List bookmarksSorted = new ArrayList(bookmarks);
+ Collections.sort(bookmarksSorted);
+ return bookmarksSorted;
+ }
+
+ /**
+ * @return the userBookmarks
+ */
+ public Set getBookmarks() {
+ return bookmarks;
+ }
+
+ /**
+ * @param userBookmarks
+ * the userBookmarks to set
+ */
+ public void setUserBookmarks(Set userBookmarks) {
+ bookmarks = userBookmarks;
+ }
+
+ /**
+ * Gets the user favorites sorted in ascending order
+ *
+ * @return the userFavorites
+ */
+ public List getFavoritesSorted() {
+ List favoritesSorted = new ArrayList(favorites);
+ Collections.sort(favoritesSorted);
+ return favoritesSorted;
+ }
+
+ /**
+ * @return the userFavorites
+ */
+ public Set getFavorites() {
+ return favorites;
+ }
+
+ /**
+ * @param userFavorites
+ * the userFavorites to set
+ */
+ public void setUserFavorites(Set userFavorites) {
+ favorites = userFavorites;
+ }
+
+ /**
+ * @return the id
+ */
+ public long getId() {
+ return id;
+ }
+
+ /**
+ * @return the dataGridId
+ */
+ public long getDataGridId() {
+ return dataGridId;
+ }
+
+ /**
+ * @return the username
+ */
+ public String getUsername() {
+ return username;
+ }
+
+ /**
+ * @return the additionalInfo
+ */
+ public String getAdditionalInfo() {
+ return additionalInfo;
+ }
+
+ /**
+ * @return the enabled
+ */
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ /**
+ * @param id
+ * the id to set
+ */
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ /**
+ * @param dataGridId
+ * the dataGridId to set
+ */
+ public void setDataGridId(long dataGridId) {
+ this.dataGridId = dataGridId;
+ }
+
+ /**
+ * @param username
+ * the username to set
+ */
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ /**
+ * @param additionalInfo
+ * the additionalInfo to set
+ */
+ public void setAdditionalInfo(String additionalInfo) {
+ this.additionalInfo = additionalInfo;
+ }
+
+ /**
+ * @param enabled
+ * the enabled to set
+ */
+ public void setEnabled(boolean enabled) {
+ this.enabled = enabled;
+ }
+
+ /**
+ * @return the firstName
+ */
+ public String getFirstName() {
+ return firstName;
+ }
+
+ /**
+ * @return the lastName
+ */
+ public String getLastName() {
+ return lastName;
+ }
+
+ /**
+ * @param firstName
+ * the firstName to set
+ */
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ /**
+ * @param lastName
+ * the lastName to set
+ */
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ /**
+ * @return the email
+ */
+ public String getEmail() {
+ return email;
+ }
+
+ /**
+ * @param email
+ * the email to set
+ */
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ /**
+ * @return the userProfile
+ */
+ public UserProfile getUserProfile() {
+ return userProfile;
+ }
+
+ /**
+ * @param userProfile
+ * the userProfile to set
+ */
+ public void setUserProfile(UserProfile userProfile) {
+ this.userProfile = userProfile;
+ }
+
+ /**
+ * @return the locale
+ */
+ public String getLocale() {
+ return locale;
+ }
+
+ /**
+ * @param locale
+ * the locale to set
+ */
+ public void setLocale(String locale) {
+ this.locale = locale;
+ }
+
+ public String getUserType() {
+ return userType;
+ }
+
+ public void setUserType(String userType) {
+ this.userType = userType;
+ }
+
+ /**
+ * @return the organizationalRole
+ */
+ public String getOrganizationalRole() {
+ return organizationalRole;
+ }
+
+ /**
+ * @param organizationalRole
+ * the organizationalRole to set
+ */
+ public void setOrganizationalRole(String organizationalRole) {
+ this.organizationalRole = organizationalRole;
+ }
+
+ /**
+ * @return the company
+ */
+ public String getCompany() {
+ return company;
+ }
+
+ /**
+ * @return the department
+ */
+ public String getDepartment() {
+ return department;
+ }
+
+ /**
+ * @return the title
+ */
+ public String getTitle() {
+ return title;
+ }
+
+ /**
+ * @param company
+ * the company to set
+ */
+ public void setCompany(String company) {
+ this.company = company;
+ }
+
+ /**
+ * @param department
+ * the department to set
+ */
+ public void setDepartment(String department) {
+ this.department = department;
+ }
+
+ /**
+ * @param title
+ * the title to set
+ */
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ @Override
+ public int compareTo(DataGridUser o) {
+ return username.compareTo(o.getUsername());
+ }
+
+ public boolean isAdmin() {
+ return userType.compareTo("rodsadmin") == 0;
+ }
+
+ /**
+ * @return the forceFileOverwriting
+ */
+ public boolean isForceFileOverwriting() {
+ return forceFileOverwriting;
+ }
+
+ /**
+ * @param forceFileOverwriting
+ * the forceFileOverwriting to set
+ */
+ public void setForceFileOverwriting(boolean forceFileOverwriting) {
+ this.forceFileOverwriting = forceFileOverwriting;
+ }
+
+ /**
+ * @return the password
+ */
+ public String getPassword() {
+ return password;
+ }
+
+ /**
+ * @param password
+ * the password to set
+ */
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridUserBookmark.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridUserBookmark.java
new file mode 100755
index 000000000..7ed6f68b3
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridUserBookmark.java
@@ -0,0 +1,184 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.metalnx.core.domain.entity;
+
+import com.emc.metalnx.core.domain.utils.DataGridCoreUtils;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import org.hibernate.envers.Audited;
+import org.hibernate.envers.NotAudited;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+@Entity
+@Audited
+@Table(name = "user_bookmarks")
+public class DataGridUserBookmark implements Serializable, Comparable {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @NotAudited
+ @Column(name = "id", unique = true, nullable = false)
+ private Long id;
+
+ @ManyToOne(fetch = FetchType.EAGER, optional = true)
+ @JoinColumn(name = "user_id", nullable = false, updatable = true)
+ private DataGridUser user;
+
+ @Column(name = "path", nullable = false, length = 512)
+ private String path;
+
+ @Column(name = "name", nullable = false, length = 512)
+ private String name;
+
+ @Column(name = "is_notified", nullable = true)
+ private Boolean isNotified;
+
+ @Column(name = "is_collection", nullable = false)
+ private Boolean isCollection;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name = "created_at", nullable = false, length = 60, updatable = false)
+ private Date createTs;
+
+ private static final long serialVersionUID = -229875209906357557L;
+
+ /**
+ * @return the id
+ */
+ public Long getId() {
+ return id;
+ }
+
+ /**
+ * @return the user
+ */
+ @JsonIgnore
+ public DataGridUser getUser() {
+ return user;
+ }
+
+ /**
+ * @return the path
+ */
+ public String getPath() {
+ return path;
+ }
+
+ /**
+ * @return the isNotified
+ */
+ public Boolean getIsNotified() {
+ return isNotified;
+ }
+
+ /**
+ * @return the createTs
+ */
+ public Date getCreateTs() {
+ return createTs;
+ }
+
+ public String getCreateTsFormatted() {
+ return new SimpleDateFormat("MMM dd yyyy, HH:mm").format(createTs);
+ }
+
+ /**
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param name
+ * the name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * @return the isCollection
+ */
+ public Boolean getIsCollection() {
+ return isCollection;
+ }
+
+ /**
+ * @param isCollection
+ * the isCollection to set
+ */
+ public void setIsCollection(Boolean isCollection) {
+ this.isCollection = isCollection;
+ }
+
+ /**
+ * @param id
+ * the id to set
+ */
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ /**
+ * @param user
+ * the user to set
+ */
+ public void setUser(DataGridUser user) {
+ this.user = user;
+ }
+
+ /**
+ * @param path
+ * the path to set
+ */
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ /**
+ * @param isNotified
+ * the isNotified to set
+ */
+ public void setIsNotified(Boolean isNotified) {
+ this.isNotified = isNotified;
+ }
+
+ /**
+ * @param createTs
+ * the createTs to set
+ */
+ public void setCreateTs(Date createTs) {
+ this.createTs = createTs;
+ }
+
+ /**
+ * Gets the icon to be displayed for a bookmarks based on its extension
+ *
+ * @return String containing the icon name to be displayed
+ */
+ public String getDisplayIcon() {
+ return DataGridCoreUtils.getIconToDisplay(this.getPath());
+ }
+
+ @Override
+ public int compareTo(DataGridUserBookmark dgub) {
+ return this.getName().compareTo(dgub.getName());
+ }
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridUserFavorite.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridUserFavorite.java
new file mode 100755
index 000000000..bc7aca9b2
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridUserFavorite.java
@@ -0,0 +1,190 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.metalnx.core.domain.entity;
+
+import com.emc.metalnx.core.domain.utils.DataGridCoreUtils;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import org.hibernate.envers.Audited;
+import org.hibernate.envers.NotAudited;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+@Entity
+@Audited
+@Table(name = "user_favorites", uniqueConstraints = @UniqueConstraint(columnNames = { "user_id",
+ "path_hash" }))
+public class DataGridUserFavorite implements Serializable, Comparable {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @NotAudited
+ @Column(name = "id", unique = true, nullable = false)
+ private Long id;
+
+ @ManyToOne(fetch = FetchType.EAGER, optional = true)
+ @JoinColumn(name = "user_id", nullable = false, updatable = true)
+ private DataGridUser user;
+
+ @Column(name = "path", nullable = false, length = 512)
+ private String path;
+
+ @Column(name = "name", nullable = false, length = 512)
+ private String name;
+
+ @Column(name = "is_collection", nullable = true)
+ private Boolean isCollection;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name = "created_at", nullable = false, length = 60, updatable = false)
+ private Date createTs;
+
+ @Column(name = "path_hash", nullable = false)
+ private int pathHash;
+
+ private static final long serialVersionUID = -7923823760209937080L;
+
+ /**
+ * @return the id
+ */
+ @JsonIgnore
+ public Long getId() {
+ return id;
+ }
+
+ /**
+ * @return the user
+ */
+ @JsonIgnore
+ public DataGridUser getUser() {
+ return user;
+ }
+
+ /**
+ * @return the path
+ */
+ public String getPath() {
+ return path;
+ }
+
+ /**
+ * @return the isCollection
+ */
+ public boolean getIsCollection() {
+ return isCollection;
+ }
+
+ /**
+ * @return the createTs
+ */
+ @JsonIgnore
+ public Date getCreateTs() {
+ return createTs;
+ }
+
+ public String getCreateTsFormatted() {
+ return new SimpleDateFormat("MMM dd yyyy, HH:mm").format(createTs);
+ }
+
+ /**
+ * @param id
+ * the id to set
+ */
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ /**
+ * @param user
+ * the user to set
+ */
+ public void setUser(DataGridUser user) {
+ this.user = user;
+ }
+
+ /**
+ * @param path
+ * the path to set
+ */
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ /**
+ * @param fileName
+ * the fileName to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * @param isNotified
+ * the isCollection to set
+ */
+ public void setIsCollection(Boolean isCollection) {
+ this.isCollection = isCollection;
+ }
+
+ /**
+ * @param createTs
+ * the createTs to set
+ */
+ public void setCreateTs(Date createTs) {
+ this.createTs = createTs;
+ }
+
+ /**
+ * Finds the file name based on its path
+ *
+ * @return file name
+ */
+ public String getName() {
+ return this.name;
+ }
+
+ /**
+ * @return the pathHash
+ */
+ public int getPathHash() {
+ return pathHash;
+ }
+
+ /**
+ * @param pathHash
+ * the pathHash to set
+ */
+ public void setPathHash(int pathHash) {
+ this.pathHash = pathHash;
+ }
+
+ /**
+ * Gets the icon to be displayed for a bookmarks based on its extension
+ *
+ * @return String containing the icon name to be displayed
+ */
+ public String getDisplayIcon() {
+ return DataGridCoreUtils.getIconToDisplay(this.getPath());
+ }
+
+ @Override
+ public int compareTo(DataGridUserFavorite dgub) {
+ return this.getName().compareTo(dgub.getName());
+ }
+
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridUserPermission.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridUserPermission.java
new file mode 100755
index 000000000..cd88d59ca
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridUserPermission.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.metalnx.core.domain.entity;
+
+public class DataGridUserPermission {
+
+ private Integer dataGridId;
+ private String userName;
+ private String userSystemRole;
+ private String permission;
+
+ /**
+ * @return the dataGridId
+ */
+ public Integer getDataGridId() {
+ return dataGridId;
+ }
+
+ /**
+ * @return the userName
+ */
+ public String getUserName() {
+ return userName;
+ }
+
+ /**
+ * @return the permission
+ */
+ public String getPermission() {
+ return permission;
+ }
+
+ /**
+ * @param dataGridId
+ * the dataGridId to set
+ */
+ public void setDataGridId(Integer dataGridId) {
+ this.dataGridId = dataGridId;
+ }
+
+ /**
+ * @param userName
+ * the userName to set
+ */
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ /**
+ * @param permission
+ * the permission to set
+ */
+ public void setPermission(String permission) {
+ this.permission = permission;
+ }
+
+ /**
+ * @return the userSystemRole
+ */
+ public String getUserSystemRole() {
+ return userSystemRole;
+ }
+
+ /**
+ * @param userSystemRole
+ * the userSystemRole to set
+ */
+ public void setUserSystemRole(String userSystemRole) {
+ this.userSystemRole = userSystemRole;
+ }
+
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridZone.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridZone.java
new file mode 100755
index 000000000..3b6012796
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/DataGridZone.java
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.metalnx.core.domain.entity;
+
+import java.util.Date;
+
+/**
+ * Represents an abstraction of a Zone in a data grid system
+ * @author guerra
+ *
+ */
+public class DataGridZone {
+
+ private long id;
+ private String name;
+ private String type;
+ private String connectionString;
+ private String comment;
+ private Date createTime;
+ private Date modifyTime;
+
+ public DataGridZone() {
+ //empty constructor
+ }
+
+ public DataGridZone(String name, String type) {
+ this.name = name;
+ this.type = type;
+ }
+
+ /**
+ * @return the id
+ */
+ public long getId() {
+ return id;
+ }
+ /**
+ * @param id the id to set
+ */
+ public void setId(long id) {
+ this.id = id;
+ }
+ /**
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+ /**
+ * @param name the name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+ /**
+ * @return the type
+ */
+ public String getType() {
+ return type;
+ }
+ /**
+ * @param type the type to set
+ */
+ public void setType(String type) {
+ this.type = type;
+ }
+ /**
+ * @return the connectionString
+ */
+ public String getConnectionString() {
+ return connectionString;
+ }
+ /**
+ * @param connectionString the connectionString to set
+ */
+ public void setConnectionString(String connectionString) {
+ this.connectionString = connectionString;
+ }
+ /**
+ * @return the comment
+ */
+ public String getComment() {
+ return comment;
+ }
+ /**
+ * @param comment the comment to set
+ */
+ public void setComment(String comment) {
+ this.comment = comment;
+ }
+ /**
+ * @return the createTime
+ */
+ public Date getCreateTime() {
+ return createTime;
+ }
+ /**
+ * @param createTime the createTime to set
+ */
+ public void setCreateTime(Date createTime) {
+ this.createTime = createTime;
+ }
+ /**
+ * @return the modifyTime
+ */
+ public Date getModifyTime() {
+ return modifyTime;
+ }
+ /**
+ * @param modifyTime the modifyTime to set
+ */
+ public void setModifyTime(Date modifyTime) {
+ this.modifyTime = modifyTime;
+ }
+
+
+
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/UserProfile.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/UserProfile.java
new file mode 100755
index 000000000..6b1b887b6
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/UserProfile.java
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.metalnx.core.domain.entity;
+
+import org.hibernate.envers.Audited;
+import org.hibernate.envers.NotAudited;
+
+import javax.persistence.*;
+import java.util.Set;
+
+@Entity
+@Audited
+@Table(name = "user_profile")
+public class UserProfile {
+
+ @Id
+ @Column(name="id")
+ @NotAudited
+ @GeneratedValue
+ private Long profileId;
+
+ @Column(name = "profile_name", nullable = false, length = 64)
+ private String profileName;
+
+ @Column(name = "description", nullable = false, length = 512)
+ private String description;
+
+ @ManyToMany(fetch = FetchType.EAGER, cascade = {CascadeType.PERSIST})
+ @JoinTable(name="user_profile_groups", joinColumns={@JoinColumn(name="profile_id")}, inverseJoinColumns={@JoinColumn(name="group_id")})
+ private Set groups;
+
+ @OneToMany(mappedBy = "userProfile", fetch = FetchType.EAGER)
+ private Set users;
+
+ public UserProfile() {
+
+ }
+
+ public UserProfile(String profileName, String description) {
+ this.profileName = profileName;
+ this.description = description;
+ }
+
+ public UserProfile(String profileName, String description, Set groups, Set users) {
+ this.profileName = profileName;
+ this.description = description;
+ this.groups = groups;
+ this.users = users;
+ }
+
+ /**
+ * @return the profileId
+ */
+ public Long getProfileId() {
+ return profileId;
+ }
+
+ /**
+ * @param profileId the profileId to set
+ */
+ public void setProfileId(Long profileId) {
+ this.profileId = profileId;
+ }
+
+ /**
+ * @return the profileName
+ */
+ public String getProfileName() {
+ return profileName;
+ }
+
+ /**
+ * @param profileName the profileName to set
+ */
+ public void setProfileName(String profileName) {
+ this.profileName = profileName;
+ }
+
+ /**
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * @param description the description to set
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * @return the groups
+ */
+ public Set getGroups() {
+ return groups;
+ }
+
+ /**
+ * @param groups the groups to set
+ */
+ public void setGroups(Set groups) {
+ this.groups = groups;
+ }
+
+ /**
+ * @return the users
+ */
+ public Set getUsers() {
+ return users;
+ }
+
+ /**
+ * @param users the users to set
+ */
+ public void setUsers(Set users) {
+ this.users = users;
+ }
+
+ public String toString() {
+ return this.profileName;
+ }
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/enums/DataGridPermType.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/enums/DataGridPermType.java
new file mode 100755
index 000000000..433d6b5db
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/enums/DataGridPermType.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.metalnx.core.domain.entity.enums;
+
+/*
+ * Defines all permission types that exist in the data grid.
+ * */
+
+public enum DataGridPermType {
+
+ OWN("OWN"), WRITE("WRITE"), READ("READ"), IRODS_ADMIN("ADMIN"), NONE("NONE");
+
+ private String stringType;
+
+ DataGridPermType(String type) {
+ this.stringType = type.toUpperCase();
+ }
+
+ @Override
+ public String toString() {
+ return this.stringType;
+ }
+
+}
\ No newline at end of file
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/enums/DataGridResourceTypeEnum.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/enums/DataGridResourceTypeEnum.java
new file mode 100755
index 000000000..736a08a78
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/enums/DataGridResourceTypeEnum.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.metalnx.core.domain.entity.enums;
+
+public enum DataGridResourceTypeEnum {
+
+ IRODS_COORDINATING("COORDINATING"), IRODS_STORAGE("STORAGE");
+
+ private String stringType;
+
+ DataGridResourceTypeEnum(String type) {
+ this.stringType = type;
+ }
+
+ @Override
+ public String toString() {
+ return this.stringType;
+ }
+
+}
\ No newline at end of file
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/enums/DataGridSearchOperatorEnum.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/enums/DataGridSearchOperatorEnum.java
new file mode 100755
index 000000000..3545609d8
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/enums/DataGridSearchOperatorEnum.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.metalnx.core.domain.entity.enums;
+
+public enum DataGridSearchOperatorEnum {
+
+ EQUAL("="),
+ NOT_EQUAL("!="),
+ LIKE("ILIKE"),
+ NOT_LIKE("NOT ILIKE"),
+ BIGGER_THAN(">"),
+ LESS_THAN("<");
+
+ private String stringType;
+
+ private DataGridSearchOperatorEnum(String type) {
+ this.stringType = type;
+ }
+
+ public String toString() {
+ return this.stringType;
+ }
+
+}
\ No newline at end of file
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/enums/DataGridServerType.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/enums/DataGridServerType.java
new file mode 100755
index 000000000..1b2fc3c2a
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/enums/DataGridServerType.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.metalnx.core.domain.entity.enums;
+
+public enum DataGridServerType {
+
+ ICAT_SERVER("ICAT_SERVER"),
+ RESOURCE_SERVER("RESOURCE_SERVER"),
+ ISILON("ISILON");
+
+ private String stringType;
+
+ private DataGridServerType(String type) {
+ this.stringType = type;
+ }
+
+ public String toString() {
+ return this.stringType;
+ }
+
+}
\ No newline at end of file
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/enums/FilePropertyField.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/enums/FilePropertyField.java
new file mode 100755
index 000000000..20cfe5d3f
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/enums/FilePropertyField.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.metalnx.core.domain.entity.enums;
+
+public enum FilePropertyField {
+
+ FILE_NAME("name"),
+ FILE_PATH("path"),
+ RESC_NAME("resc_name"),
+ OWNER_NAME("owner_name"),
+ CREATION_DATE("create_ts"),
+ MODIFICATION_DATE("modify_ts"),
+ SIZE("size"),
+ REPLICA_NUMBER("repl_num"),
+ CHECKSUM("checksum"),
+ COMMENT("r_comment");
+
+ private String fieldName;
+
+ FilePropertyField(String fieldName) {
+ this.fieldName = fieldName;
+ }
+
+ /**
+ * Finds the correct label associated to the input String
+ * @param fieldName field name as is written in front-end
+ * @return field name as is used in database
+ */
+ public static FilePropertyField findByString(String fieldName) {
+
+ if (fieldName == null) {
+ return null;
+ }
+
+ for(FilePropertyField field : FilePropertyField.values()) {
+ if (field.getFieldName().compareTo(fieldName) == 0) {
+ return field;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @return the fieldName
+ */
+ public String getFieldName() {
+ return fieldName;
+ }
+
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/enums/FilePropertySearchOperator.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/enums/FilePropertySearchOperator.java
new file mode 100755
index 000000000..087765cdb
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/entity/enums/FilePropertySearchOperator.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.core.domain.entity.enums;
+
+public enum FilePropertySearchOperator {
+
+ EQUALS("="),
+ NOT_EQUALS("!="),
+ CONTAINS("ILIKE"),
+ NOT_CONTAINS("NOT ILIKE");
+
+ private String operator;
+
+ FilePropertySearchOperator(String operator) {
+ this.operator = operator;
+ }
+
+ /**
+ * Finds the correct label associated to the input String
+ * @param accessType
+ * @return
+ */
+ public static FilePropertySearchOperator findByString(String operatorStr) {
+
+ if (operatorStr == null) {
+ return null;
+ }
+
+ for(FilePropertySearchOperator operator : FilePropertySearchOperator.values()) {
+ if (operator.getFieldName().compareTo(operatorStr) == 0) {
+ return operator;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @return the fieldName
+ */
+ public String getFieldName() {
+ return this.operator;
+ }
+
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridAuthenticationException.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridAuthenticationException.java
new file mode 100755
index 000000000..bf7c8c6ab
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridAuthenticationException.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.core.domain.exceptions;
+
+import org.springframework.security.core.AuthenticationException;
+
+public class DataGridAuthenticationException extends AuthenticationException {
+ private static final long serialVersionUID = 1L;
+
+ public DataGridAuthenticationException(String msg) {
+ super(msg);
+ }
+
+ public DataGridAuthenticationException(String msg, Throwable t) {
+ super(msg, t);
+ }
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridChecksumException.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridChecksumException.java
new file mode 100755
index 000000000..3b8a0133c
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridChecksumException.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.core.domain.exceptions;
+
+/**
+ * Exception used when no checksum can be calculated on a file in the grid.
+ */
+public class DataGridChecksumException extends DataGridException {
+ public DataGridChecksumException(String msg) {
+ super(msg);
+ }
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridConnectionRefusedException.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridConnectionRefusedException.java
new file mode 100755
index 000000000..2e3786899
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridConnectionRefusedException.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.core.domain.exceptions;
+
+public class DataGridConnectionRefusedException extends DataGridException {
+
+ private static final long serialVersionUID = 1L;
+
+ public DataGridConnectionRefusedException() {
+ super();
+ }
+
+ public DataGridConnectionRefusedException(String message) {
+ super(message);
+ }
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridCorruptedFileException.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridCorruptedFileException.java
new file mode 100755
index 000000000..9e7fca903
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridCorruptedFileException.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.core.domain.exceptions;
+
+public class DataGridCorruptedFileException extends DataGridException {
+ private static final long serialVersionUID = 1L;
+
+ public DataGridCorruptedFileException(String msg) {
+ super(msg);
+ }
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridDataNotFoundException.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridDataNotFoundException.java
new file mode 100755
index 000000000..86dc95bbe
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridDataNotFoundException.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.core.domain.exceptions;
+
+public class DataGridDataNotFoundException extends Exception {
+ private static final long serialVersionUID = 1L;
+
+ public DataGridDataNotFoundException() {
+ super();
+ }
+
+ public DataGridDataNotFoundException(String msg) {
+ super(msg);
+ }
+
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridDatabaseException.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridDatabaseException.java
new file mode 100755
index 000000000..6b456066f
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridDatabaseException.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.metalnx.core.domain.exceptions;
+
+import org.springframework.security.core.AuthenticationException;
+
+public class DataGridDatabaseException extends AuthenticationException {
+ public DataGridDatabaseException(String message) {
+ super(message);
+ }
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridException.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridException.java
new file mode 100755
index 000000000..b6ae2c05d
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridException.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.core.domain.exceptions;
+
+public class DataGridException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ public DataGridException() {
+ super();
+ }
+
+ public DataGridException(String msg) {
+ super(msg);
+ }
+
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridFileAlreadyExistsException.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridFileAlreadyExistsException.java
new file mode 100755
index 000000000..b3fb5174a
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridFileAlreadyExistsException.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.core.domain.exceptions;
+
+/**
+ * Exception classes used when a file is moved, copied, uploaded to a collection, but it already exists there.
+ */
+public class DataGridFileAlreadyExistsException extends DataGridException {
+ public DataGridFileAlreadyExistsException(String message) {
+ super(message);
+ }
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridInvalidPathException.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridInvalidPathException.java
new file mode 100755
index 000000000..b1644d4dd
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridInvalidPathException.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.core.domain.exceptions;
+
+public class DataGridInvalidPathException extends DataGridException {
+
+ private static final long serialVersionUID = 1L;
+
+ public DataGridInvalidPathException() {
+ super();
+ }
+
+ public DataGridInvalidPathException(String message) {
+ super(message);
+ }
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridMSIVersionNotSupported.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridMSIVersionNotSupported.java
new file mode 100755
index 000000000..f35c78e00
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridMSIVersionNotSupported.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.core.domain.exceptions;
+
+/**
+ * Exception thrown when the MSI package installed is not supported by this application.
+ */
+public class DataGridMSIVersionNotSupported extends DataGridException {
+ public DataGridMSIVersionNotSupported(String msg) { super(msg); }
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridQueryException.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridQueryException.java
new file mode 100755
index 000000000..bb0c98be2
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridQueryException.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.core.domain.exceptions;
+
+public class DataGridQueryException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ public DataGridQueryException() {
+ super();
+ }
+
+ public DataGridQueryException(String msg) {
+ super(msg);
+ }
+
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridReplicateException.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridReplicateException.java
new file mode 100755
index 000000000..b5a87f68f
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridReplicateException.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.core.domain.exceptions;
+
+/**
+ * Exception thrown when a replication of a file fails.
+ */
+public class DataGridReplicateException extends DataGridException {
+ public DataGridReplicateException(String msg) {
+ super(msg);
+ }
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridRuleException.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridRuleException.java
new file mode 100755
index 000000000..3c1bc0530
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridRuleException.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.core.domain.exceptions;
+
+/**
+ * Exception thrown when the data grid cannot execute a rule.
+ */
+public class DataGridRuleException extends DataGridException {
+
+ public DataGridRuleException(String msg) {
+ super(msg);
+ }
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridServerException.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridServerException.java
new file mode 100755
index 000000000..233738654
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridServerException.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.emc.metalnx.core.domain.exceptions;
+
+import org.springframework.security.core.AuthenticationException;
+
+public class DataGridServerException extends AuthenticationException {
+ public DataGridServerException(String message) {
+ super(message);
+ }
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridTemplateAttrException.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridTemplateAttrException.java
new file mode 100755
index 000000000..526a92c99
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridTemplateAttrException.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.core.domain.exceptions;
+
+/**
+ * Exception thrown when an attribute field of a template exceed the limit available in the database.
+ *
+ */
+public class DataGridTemplateAttrException extends DataGridException {
+ private static final long serialVersionUID = 1L;
+
+ public DataGridTemplateAttrException() {
+ super();
+ }
+
+ public DataGridTemplateAttrException(String msg) {
+ super(msg);
+ }
+
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridTemplateUnitException.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridTemplateUnitException.java
new file mode 100755
index 000000000..7f0525383
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridTemplateUnitException.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.core.domain.exceptions;
+
+/**
+ * Exception thrown when an unit field of a template exceed the limit available in the database.
+ *
+ */
+public class DataGridTemplateUnitException extends DataGridException {
+ private static final long serialVersionUID = 1L;
+
+ public DataGridTemplateUnitException() {
+ super();
+ }
+
+ public DataGridTemplateUnitException(String msg) {
+ super(msg);
+ }
+
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridTemplateValueException.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridTemplateValueException.java
new file mode 100755
index 000000000..dbe735f44
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridTemplateValueException.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.core.domain.exceptions;
+
+/**
+ * Exception thrown when a value field of a template exceed the limit available in the database.
+ *
+ */
+public class DataGridTemplateValueException extends DataGridException {
+ private static final long serialVersionUID = 1L;
+
+ public DataGridTemplateValueException() {
+ super();
+ }
+
+ public DataGridTemplateValueException(String msg) {
+ super(msg);
+ }
+
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridTicketDownloadException.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridTicketDownloadException.java
new file mode 100755
index 000000000..2c73e1f05
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridTicketDownloadException.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.core.domain.exceptions;
+
+/**
+ * Exception thrown when there is an error during download with tickets.
+ */
+public class DataGridTicketDownloadException extends DataGridException {
+ private String path, ticketString;
+
+ public DataGridTicketDownloadException(String msg, String path, String ticketString) {
+ super(msg);
+ this.path = path;
+ this.ticketString = ticketString;
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ public String getTicketString() {
+ return ticketString;
+ }
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridTicketException.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridTicketException.java
new file mode 100755
index 000000000..6d13971ca
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridTicketException.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.core.domain.exceptions;
+
+/**
+ * Exception thrown when an error occurs during any ticket operation
+ */
+public class DataGridTicketException extends DataGridException {
+ public DataGridTicketException(String msg) { super(msg); }
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridTicketFileNotFoundException.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridTicketFileNotFoundException.java
new file mode 100755
index 000000000..ce88e5905
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridTicketFileNotFoundException.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.core.domain.exceptions;
+
+public class DataGridTicketFileNotFoundException extends DataGridException {
+
+ private static final long serialVersionUID = 1L;
+
+ private String path, ticketString;
+
+ public DataGridTicketFileNotFoundException(String msg, String path, String ticketString) {
+ super(msg);
+ this.path = path;
+ this.ticketString = ticketString;
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ public String getTicketString() {
+ return ticketString;
+ }
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridTicketInvalidUserException.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridTicketInvalidUserException.java
new file mode 100755
index 000000000..ca5b58bf9
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridTicketInvalidUserException.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.core.domain.exceptions;
+
+/**
+ * Exception thrown when a not-authenticated user (anonymous) tries to access a file/collection via ticket.
+ */
+public class DataGridTicketInvalidUserException extends DataGridException {
+ public DataGridTicketInvalidUserException(String message) {
+ super(message);
+ }
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridTicketNotFoundException.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridTicketNotFoundException.java
new file mode 100755
index 000000000..e8f6f34c2
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridTicketNotFoundException.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.core.domain.exceptions;
+
+/**
+ * Exception thrown when ticket cannot be found.
+ */
+public class DataGridTicketNotFoundException extends DataGridException {
+ public DataGridTicketNotFoundException(String message) {
+ super(message);
+ }
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridTicketUploadException.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridTicketUploadException.java
new file mode 100755
index 000000000..27d7a65f4
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridTicketUploadException.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.core.domain.exceptions;
+
+/**
+ * Class that represents the error during an upload with a ticket
+ */
+public class DataGridTicketUploadException extends DataGridException {
+ public DataGridTicketUploadException(String message) {
+ super(message);
+ }
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridTooLongTemplateNameException.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridTooLongTemplateNameException.java
new file mode 100755
index 000000000..42779d264
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/DataGridTooLongTemplateNameException.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.core.domain.exceptions;
+
+/**
+ * Exception thrown when the name of a template exceed the limit available in the database.
+ *
+ */
+public class DataGridTooLongTemplateNameException extends DataGridException {
+ private static final long serialVersionUID = 1L;
+
+ public DataGridTooLongTemplateNameException() {
+ super();
+ }
+
+ public DataGridTooLongTemplateNameException(String msg) {
+ super(msg);
+ }
+
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/UnsupportedDataGridFeatureException.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/UnsupportedDataGridFeatureException.java
new file mode 100644
index 000000000..74c0e593e
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/exceptions/UnsupportedDataGridFeatureException.java
@@ -0,0 +1,30 @@
+/**
+ *
+ */
+package com.emc.metalnx.core.domain.exceptions;
+
+/**
+ * Signals an attempt at an operation not supported on the target data grid (due
+ * to version difference, plugin availability difference etc.
+ *
+ * @author Mike Conway - NIEHS
+ *
+ */
+public class UnsupportedDataGridFeatureException extends DataGridException {
+
+ private static final long serialVersionUID = 386934177608694036L;
+
+ /**
+ *
+ */
+ public UnsupportedDataGridFeatureException() {
+ }
+
+ /**
+ * @param msg
+ */
+ public UnsupportedDataGridFeatureException(String msg) {
+ super(msg);
+ }
+
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/utils/DataGridCoreUtils.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/utils/DataGridCoreUtils.java
new file mode 100755
index 000000000..922b8cf8e
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/utils/DataGridCoreUtils.java
@@ -0,0 +1,233 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.core.domain.utils;
+
+import java.util.*;
+
+/**
+ * Helper class for common operations with core classes.
+ *
+ */
+public class DataGridCoreUtils {
+
+ public static final String MSI_LIST_SEPARATOR = ",";
+
+ /**
+ * Finds the MSI API version currently supported.
+ * @return String containing the MSI API version
+ */
+ public static String getAPIVersion(String version) {
+ if(version == null || version.isEmpty()) return "";
+
+ int end = version.indexOf('.');
+
+ if (end < 0) end = version.length();
+
+ return version.substring(0, end);
+ }
+
+ public static boolean isIllumina(String path) {
+ return path.endsWith("_SSU.tar");
+ }
+
+ /**
+ * Checks whether or not a given path refers to a BAM or CRAM file.
+ * @param path file path
+ * @return True, if file is BAM/CRAM. False, otherwise.
+ */
+ public static boolean isBamOrCram(String path) {
+ return path.endsWith(".cram") || path.endsWith(".bam");
+ }
+
+ /**
+ * Auxiliary method to determine wether a file is an image file
+ *
+ * @param path file path
+ * @return bool True, if the given path is an image. False, otherwise.
+ */
+ public static boolean isImageFile(String path) {
+ Set extensions = new HashSet<>();
+ extensions.add("png");
+ extensions.add("PNG");
+ extensions.add("jpg");
+ extensions.add("JPG");
+ extensions.add("jpeg");
+ extensions.add("JPEG");
+ extensions.add("bmp");
+ extensions.add("BMP");
+
+ String fileExtension = "";
+
+ int i = path.lastIndexOf('.');
+ if (i > 0) fileExtension = path.substring(i + 1);
+
+ return extensions.contains(fileExtension);
+ }
+
+ /**
+ * Auxiliary method to determine wether a file is a VCF file
+ *
+ * @param path file path
+ * @return bool True, if the given path is a VCF file. False, otherwise.
+ */
+ public static boolean isVCFFile(String path) {
+ Set extensions = new HashSet<>();
+ extensions.add("vcf");
+ extensions.add("VCF");
+
+ String fileExtension = "";
+
+ int i = path.lastIndexOf('.');
+ if (i > 0) {
+ fileExtension = path.substring(i + 1);
+ }
+
+ return extensions.contains(fileExtension);
+ }
+
+ /**
+ * Auxiliary method to determine whether a file is a VCF file
+ *
+ * @param path file path
+ * @return bool True, if the given path is a manifest file. False, otherwise.
+ */
+ public static boolean isPrideXMLManifestFile(String path) {
+ Set extensions = new HashSet<>();
+ extensions.add("xml");
+
+ String fileExtension = "";
+
+ int i = path.lastIndexOf('.');
+ if (i > 0) {
+ fileExtension = path.substring(i + 1);
+ }
+
+ return extensions.contains(fileExtension);
+ }
+
+ /**
+ * Gets the icon type that will be shown on the UI.
+ *
+ * @param filePath path to the file
+ * @return the icon type as String
+ */
+ public static String getIconToDisplay(String filePath) {
+
+ String icon;
+ String extension = getFileExtension(filePath);
+
+ switch (extension) {
+
+ case "jpg":
+ case "jpeg":
+ case "png":
+ case "gif":
+ icon = "fa fa-file-image-o";
+ break;
+
+ case "html":
+ case "htm":
+ case "xml":
+ case "tex":
+ icon = "fa fa-code";
+ break;
+
+ case "c":
+ case "cpp":
+ case "java":
+ case "py":
+ icon = "fa fa-file-code-o";
+ break;
+
+ case "docx":
+ case "doc":
+ icon = "fa fa-file-word-o";
+ break;
+
+ case "xlsx":
+ case "xls":
+ icon = "fa fa-file-excel-o";
+ break;
+
+ case "pptx":
+ case "ppt":
+ icon = "fa fa-file-powerpoint-o";
+ break;
+
+ case "pdf":
+ icon = "fa fa-file-pdf-o";
+ break;
+
+ case "zip":
+ case "rar":
+ icon = "fa fa-file-archive-o";
+ break;
+
+ case "unknown":
+ icon = "fa fa-folder folder-icon";
+ break;
+
+ default:
+ icon = "fa fa-file";
+ break;
+ }
+
+ return icon;
+
+ }
+
+ /**
+ * Gets file extension based on its path
+ *
+ * @param filePath path to the file
+ * @return file extension
+ */
+ private static String getFileExtension(String filePath) {
+
+ if (filePath.lastIndexOf(".") != -1 && filePath.lastIndexOf(".") != 0) {
+ return filePath.substring(filePath.lastIndexOf(".") + 1);
+ }
+
+ else
+ return "unknown";
+
+ }
+
+ /**
+ * Parses a raw list of MSIs coming from a rule.
+ * @param msisAsString list of MSIs coming from the rule as a string
+ * @return List of MSIs
+ */
+ public static List getMSIsAsList(String msisAsString) {
+ List msis = new ArrayList<>();
+
+ if(msisAsString != null && !msisAsString.isEmpty()) {
+ for (String msi: msisAsString.split(MSI_LIST_SEPARATOR)) {
+ String msiName = msi.trim();
+ if (!msiName.isEmpty()) msis.add(msiName);
+ }
+ }
+
+ return msis;
+ }
+
+ public static void fillMSIMap(List msis, Map map) {
+ if(msis == null || msis.isEmpty()) return;
+
+ for(String msi: msis) if(!msi.isEmpty()) map.put(msi, false);
+ }
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/utils/DataGridJsonDateDeserializer.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/utils/DataGridJsonDateDeserializer.java
new file mode 100755
index 000000000..528be95cd
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/utils/DataGridJsonDateDeserializer.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.core.domain.utils;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.JsonDeserializer;
+
+import java.io.IOException;
+import java.text.ParseException;
+import java.util.Date;
+
+import static com.emc.metalnx.core.domain.entity.DataGridTicket.dateFormat;
+
+/**
+ * Custom deserializer for dates as a JSON.
+ */
+public class DataGridJsonDateDeserializer extends JsonDeserializer {
+ @Override
+ public Date deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException {
+ String date = jsonParser.getText();
+
+ if (date == null || date.isEmpty()) {
+ return null;
+ }
+
+ try {
+ return dateFormat.parse(date);
+ } catch (ParseException e) {
+ throw new RuntimeException(e);
+ }
+ }
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/utils/DataGridTemplateFieldComparator.java b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/utils/DataGridTemplateFieldComparator.java
new file mode 100755
index 000000000..772f31200
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/java/com/emc/metalnx/core/domain/utils/DataGridTemplateFieldComparator.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.core.domain.utils;
+
+import com.emc.metalnx.core.domain.entity.DataGridTemplateField;
+
+import java.util.Comparator;
+
+public class DataGridTemplateFieldComparator implements Comparator {
+
+ @Override
+ public int compare(DataGridTemplateField o1, DataGridTemplateField o2) {
+ if (o1.getAttribute().compareTo(o2.getAttribute()) != 0) {
+ return o1.getAttribute().compareTo(o2.getAttribute());
+ }
+
+ else if (o1.getValue().compareTo(o2.getValue()) != 0) {
+ return o1.getValue().compareTo(o2.getValue());
+ }
+
+ else if (o1.getUnit().compareTo(o2.getUnit()) != 0) {
+ return o1.getUnit().compareTo(o2.getUnit());
+ }
+
+ return 0;
+ }
+
+}
diff --git a/packaging/src/emc-metalnx-core/src/main/resources/META-INF/emc-metalnx-core/emc-metalnx-core-context.xml b/packaging/src/emc-metalnx-core/src/main/resources/META-INF/emc-metalnx-core/emc-metalnx-core-context.xml
new file mode 100755
index 000000000..e1e2c13f5
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/resources/META-INF/emc-metalnx-core/emc-metalnx-core-context.xml
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/packaging/src/emc-metalnx-core/src/main/resources/META-INF/emc-metalnx-core/emc-metalnx-core-jpa.xml b/packaging/src/emc-metalnx-core/src/main/resources/META-INF/emc-metalnx-core/emc-metalnx-core-jpa.xml
new file mode 100755
index 000000000..249f38a76
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/resources/META-INF/emc-metalnx-core/emc-metalnx-core-jpa.xml
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ${hibernate.dialect}
+ ${hibernate.format_sql}
+ ${hibernate.show_sql}
+ ${hibernate.hbm2ddl.auto}
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/packaging/src/emc-metalnx-core/src/main/xsd/global.xjb b/packaging/src/emc-metalnx-core/src/main/xsd/global.xjb
new file mode 100755
index 000000000..c35f5a1fe
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/xsd/global.xjb
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/packaging/src/emc-metalnx-core/src/main/xsd/mlx.metadata.template.001.xsd b/packaging/src/emc-metalnx-core/src/main/xsd/mlx.metadata.template.001.xsd
new file mode 100755
index 000000000..8433a992d
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/main/xsd/mlx.metadata.template.001.xsd
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/packaging/src/emc-metalnx-core/src/test/resources/META-INF/MANIFEST.MF b/packaging/src/emc-metalnx-core/src/test/resources/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..254272e1c
--- /dev/null
+++ b/packaging/src/emc-metalnx-core/src/test/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path:
+
diff --git a/packaging/src/emc-metalnx-services/pom.xml b/packaging/src/emc-metalnx-services/pom.xml
new file mode 100755
index 000000000..cc69b78ea
--- /dev/null
+++ b/packaging/src/emc-metalnx-services/pom.xml
@@ -0,0 +1,259 @@
+
+
+
+ 4.0.0
+
+ com.emc.metalnx
+ emc-metalnx
+ 1.4.0
+
+ emc-metalnx-services
+
+
+ org.springframework
+ spring-context
+
+
+ com.emc.metalnx
+ emc-metalnx-core
+ ${project.version}
+
+
+ org.irods.jargon
+ jargon-core
+
+
+ org.irods.jargon
+ jargon-ruleservice
+
+
+ org.irods.jargon
+ jargon-user-tagging
+
+
+ org.irods.jargon
+ jargon-ticket
+
+
+ javax.servlet
+ javax.servlet-api
+
+
+ org.springframework
+ spring-test
+
+
+
+ junit
+ junit
+ test
+
+
+
+ javax.el
+ el-api
+ test
+
+
+
+ org.mockito
+ mockito-core
+ test
+
+
+
+
+
+
+
+ maven-antrun-plugin
+
+
+
+ 0
+ validate
+
+
+
+
+
+ test.data.directory=${jargon.test.data.directory}
+ test.irods.admin=${jargon.test.irods.admin}
+ test.irods.admin.password=${jargon.test.irods.admin.password}
+ test.irods.user=${jargon.test.irods.user}
+ test.irods.password=${jargon.test.irods.password}
+ test.irods.resource=${jargon.test.irods.resource}
+ test2.irods.user=${jargon.test.irods.user2}
+ test2.irods.password=${jargon.test.irods.password2}
+ test2.irods.resource=${jargon.test.irods.resource2}
+ test3.irods.user=${jargon.test.irods.user3}
+ test3.irods.password=${jargon.test.irods.password3}
+ test3.irods.resource=${jargon.test.irods.resource3}
+ test.irods.host=${jargon.test.irods.host}
+ test.resource.host=${jargon.test.resource.host}
+ test.irods.port=${jargon.test.irods.port}
+ test.irods.zone=${jargon.test.irods.zone}
+ jargon.test.kerberos.user=${jargon.test.kerberos.user}
+ jargon.test.user.group=${jargon.test.user.group}
+ test.resource.group=${jargon.test.resource.group}
+ test.irods.userDN=${jargon.test.irods.userDN}
+ test.irods.scratch.subdir=${jargon.test.irods.scratch.subdir}
+ test.option.exercise.remoteexecstream=${jargon.test.option.exercise.remoteexecstream}
+ test.option.eirods=${test.option.eirods}
+ test.option.exercise.audit=${jargon.test.option.exercise.audit}
+ test.option.exercise.workflow=${jargon.test.option.exercise.workflow}
+ test.option.exercise.filesystem.mount=${jargon.test.option.exercise.filesystem.mount}
+ test.option.exercise.filesystem.mount.local=${jargon.test.option.exercise.filesystem.mount.local}
+ test.option.distributed.resources=${test.option.distributed.resources}
+ test.option.registration=${test.option.registration}
+ test.option.strictACL=${test.option.strictACL}
+ test.option.federated.zone=${test.option.federated.zone}
+ test.option.kerberos=${test.option.kerberos}
+ test.option.pam=${test.option.pam}
+ test.option.ssl.configured=${test.option.ssl.configured}
+ jargon.test.pam.user=${jargon.test.pam.user}
+ jargon.test.pam.password=${jargon.test.pam.password}
+ test.federated.irods.admin=${jargon.test.federated.irods.admin}
+ test.federated.irods.admin.password=${jargon.test.federated.irods.admin.password}
+ test.federated.irods.user=${jargon.test.federated.irods.user}
+ test.federated.irods.password=${jargon.test.federated.irods.password}
+ test.federated.irods.resource=${jargon.test.federated.irods.resource}
+ test.federated.irods.host=${jargon.test.federated.irods.host}
+ test.federated.irods.port=${jargon.test.federated.irods.port}
+ test.federated.irods.zone=${jargon.test.federated.irods.zone}
+ test.option.gsi=${test.option.gsi}
+ test.option.gsi.host=${test.option.gsi.host}
+ test.option.gsi.port=${test.option.gsi.port}
+ test.option.gsi.zone=${test.option.gsi.zone}
+ test.option.gsi.dn=${test.option.gsi.dn}
+ test.option.gsi.user=${test.option.gsi.user}
+ test.option.gsi.file=${test.option.gsi.file}
+ test.option.mount.basedir=${test.option.mount.basedir}
+ test.option.python=${test.option.python}
+
+
+
+
+ run
+
+
+
+
+ 2
+ validate
+
+
+
+
+
+ irods.host=${jargon.test.irods.host}
+ irods.port=${jargon.test.irods.port}
+ irods.zoneName=${jargon.test.irods.zone}
+ irods.admin.user=${jargon.test.irods.admin}
+ irods.admin.password=${jargon.test.irods.admin.password}
+
+
+ irods.auth.scheme=${metalnx.auth.scheme}
+ default.storage.resource=${jargon.test.irods.resource}
+ ssl.negotiation.policy=${metalnx.ssl.policy}
+
+ ##########################################################
+
+ utilize.packing.streams=${metalnx.packing.streams}
+
+
+ compute.checksum=${metalnx.compute.checksum}
+
+ ##########################################################
+
+ db.driverClassName=${metalnx.jdbc.driver}
+ db.url=${metalnx.jdbc.url}
+ db.username=${metalnx.jdbc.user}
+ db.password=${metalnx.jdbc.password}
+ hibernate.dialect=${metalnx.jdbc.dialect}
+
+
+ hibernate.show_sql=true
+ hibernate.format_sql=false
+
+
+ hibernate.hbm2ddl.auto=update
+
+
+ connection.pool_size=5
+
+ ######################################
+
+ jobs.irods.username=${jargon.test.irods.admin}
+ jobs.irods.password=${jargon.test.irods.admin.password}
+ jobs.irods.auth.scheme=${metalnx.auth.scheme}
+ runSyncJobs=true
+
+
+ rmd.connection.timeout=500
+ rmd.connection.port=8000
+
+ reverse.dns.lookup=false
+
+ ######################################
+
+ populate.msi.enabled=false
+ illumina.msi.enabled=true
+
+ msi.api.version=1.X.X
+
+ msi.metalnx.list=libmsiget_illumina_meta.so,libmsiobjget_microservices.so,libmsiobjget_version.so,libmsiobjjpeg_extract.so,libmsiobjput_mdbam.so,libmsiobjput_mdbam.so,libmsiobjput_mdmanifest.so,libmsiobjput_mdvcf.so,libmsiobjput_populate.so
+
+ msi.irods.list=libmsisync_to_archive.so,libmsi_update_unixfilesystem_resource_free_space.so,libmsiobjput_http.so,libmsiobjput_irods.so,libmsiobjget_irods.so,libmsiobjget_http.so,libmsiobjput_slink.so,libmsiobjget_slink.so
+
+ msi.irods.42.list=libmsisync_to_archive.so,libmsi_update_unixfilesystem_resource_free_space.so
+
+ msi.other.list=
+
+ resource.location.images=/images/,classpath:static/images/
+ resource.location.fonts=/fonts/,classpath:static/fonts/
+ resource.location.css=/css/,classpath:static/css/
+ resource.location.js=/js/,classpath:static/js/
+ resource.location.i18=classpath:i18n/messages
+ resource.location.i18-users=classpath:i18n-users/messages
+
+
+
+
+
+
+ run
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ ${maven.surefire.plugin.version}
+
+ 0
+
+
+
+
+
\ No newline at end of file
diff --git a/packaging/src/emc-metalnx-services/src/main/java/com/emc/metalnx/context/EncodedPropertiesConfigurer.java b/packaging/src/emc-metalnx-services/src/main/java/com/emc/metalnx/context/EncodedPropertiesConfigurer.java
new file mode 100755
index 000000000..e748b4462
--- /dev/null
+++ b/packaging/src/emc-metalnx-services/src/main/java/com/emc/metalnx/context/EncodedPropertiesConfigurer.java
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.context;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
+import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
+import org.springframework.util.Base64Utils;
+
+import java.io.UnsupportedEncodingException;
+import java.net.Inet4Address;
+import java.net.UnknownHostException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.*;
+
+public class EncodedPropertiesConfigurer extends PropertyPlaceholderConfigurer {
+
+ private static final String PROPERTIES_TO_BE_DECODED = "encoded.properties";
+ private static final String DEFAULT_ENCODED_FIELDS = "db.password,jobs.irods.password";
+ private static final String PWD_SALT = "!M3t4Lnx@1234";
+
+ private static final Logger logger = LoggerFactory.getLogger(EncodedPropertiesConfigurer.class);
+
+ @Override
+ protected void processProperties(ConfigurableListableBeanFactory beanFactory, Properties props) throws BeansException {
+
+ for (String prop : propertiesToBeDecoded(props)) {
+ logger.debug("Decoding property [{}]", prop);
+ String currentValue = props.getProperty(prop);
+ props.setProperty(prop, decodePassword(currentValue));
+ }
+
+ super.processProperties(beanFactory, props);
+ }
+
+ /**
+ * Decodes an encoded password on properties placeholders
+ *
+ * @param currentValue the current password value
+ * @return {@link String} decoded password
+ */
+ private String decodePassword(String currentValue) {
+ logger.debug("Decoding value [{}]", currentValue);
+
+ String pwd = "";
+ Integer key = 0;
+
+ try {
+ key = getKey();
+
+ byte[] encodedBytes = Base64Utils.decodeFromString(currentValue);
+ for(byte b: encodedBytes) {
+ pwd += (char) ((b ^ key) & 0xFF);
+ }
+
+ } catch (UnknownHostException e) {
+ logger.error("Could not get machine's hostname at start up.");
+ } catch (NoSuchAlgorithmException e) {
+ logger.error("Could not get a MD5 algorithm at start up.");
+ } catch (UnsupportedEncodingException e) {
+ logger.error("Encoding not supported (US_ASCII).");
+ }
+
+ logger.debug("Decoded value [{}]", pwd);
+ return pwd;
+ }
+
+ private Integer getKey() throws UnknownHostException,
+ NoSuchAlgorithmException, UnsupportedEncodingException {
+ MessageDigest md5 = MessageDigest.getInstance("MD5");
+
+ String hostname = Inet4Address.getLocalHost().getHostName();
+
+ // Using only FQDN
+ if (hostname.contains(".")) {
+ hostname = hostname.substring(0, hostname.indexOf("."));
+ }
+
+ String s = PWD_SALT + hostname;
+
+ Integer key = 0;
+ byte[] digestedBytes = md5.digest(s.getBytes());
+ for (byte b : digestedBytes) {
+ key += b & 0xFF;
+ }
+
+ return key;
+ }
+
+ /**
+ * Returns the name of the encoded properties on the configuration
+ * files
+ *
+ * @param props the properties hashtable
+ * @return {@link java.lang.reflect.Array} of {@link String}
+ */
+ private List propertiesToBeDecoded(Properties props) {
+ logger.debug("Looking for properties to be decoded");
+ String propertiesToBeDecodedRaw = props.getProperty(PROPERTIES_TO_BE_DECODED, DEFAULT_ENCODED_FIELDS);
+
+ logger.debug("The following properties will be decoded: {}", propertiesToBeDecodedRaw);
+ List properties = new ArrayList<>(Arrays.asList(propertiesToBeDecodedRaw.split(",")));
+
+ // Filtering out all the invalid property names
+ Set propertyNames = props.stringPropertyNames();
+ ListIterator lit = properties.listIterator();
+
+ while (lit.hasNext()) {
+ String currentPropName = (String) lit.next();
+ if (!propertyNames.contains(currentPropName)) {
+ logger.warn("Found invalid property [{}].", currentPropName);
+ lit.remove();
+ }
+ }
+
+ return properties;
+ }
+
+}
diff --git a/packaging/src/emc-metalnx-services/src/main/java/com/emc/metalnx/services/auth/IRODSAuthenticationProvider.java b/packaging/src/emc-metalnx-services/src/main/java/com/emc/metalnx/services/auth/IRODSAuthenticationProvider.java
new file mode 100755
index 000000000..a369e9955
--- /dev/null
+++ b/packaging/src/emc-metalnx-services/src/main/java/com/emc/metalnx/services/auth/IRODSAuthenticationProvider.java
@@ -0,0 +1,274 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.services.auth;
+
+import com.emc.metalnx.core.domain.dao.UserDao;
+import com.emc.metalnx.core.domain.entity.DataGridUser;
+import com.emc.metalnx.core.domain.exceptions.DataGridAuthenticationException;
+import com.emc.metalnx.core.domain.exceptions.DataGridDatabaseException;
+import com.emc.metalnx.core.domain.exceptions.DataGridServerException;
+import com.emc.metalnx.services.interfaces.AuthenticationProviderService;
+import org.irods.jargon.core.connection.AuthScheme;
+import org.irods.jargon.core.connection.IRODSAccount;
+import org.irods.jargon.core.connection.auth.AuthResponse;
+import org.irods.jargon.core.exception.InvalidUserException;
+import org.irods.jargon.core.exception.JargonException;
+import org.irods.jargon.core.protovalues.UserTypeEnum;
+import org.irods.jargon.core.pub.IRODSAccessObjectFactory;
+import org.irods.jargon.core.pub.UserAO;
+import org.irods.jargon.core.pub.domain.User;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.AuthenticationException;
+import org.springframework.security.core.GrantedAuthority;
+import org.springframework.transaction.TransactionException;
+import org.springframework.util.StringUtils;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+public class IRODSAuthenticationProvider implements AuthenticationProviderService, Serializable {
+ private static final String IRODS_ANONYMOUS_ACCOUNT = "anonymous";
+
+ @Autowired
+ UserDao userDao;
+
+ @Autowired
+ IRODSAccessObjectFactory irodsAccessObjectFactory;
+
+ private String irodsHost;
+ private String irodsPort;
+ private String irodsZoneName;
+
+ @Value("${irods.auth.scheme}")
+ private String irodsAuthScheme;
+
+ // Instance variables to be set to UserTokenDetails instance.
+ private IRODSAccount irodsAccount;
+
+ private DataGridUser user;
+
+ private static final Logger logger = LoggerFactory.getLogger(IRODSAuthenticationProvider.class);
+
+ private static final long serialVersionUID = -4984545776727334580L;
+
+ @Override
+ public Authentication authenticate(Authentication authentication) throws AuthenticationException {
+
+ String username = authentication.getName();
+ String password = authentication.getCredentials().toString();
+ AuthResponse authResponse;
+ UsernamePasswordAuthenticationToken authObject;
+
+ logger.debug("Setting username {} and password {}.", username, password);
+
+ try {
+ authResponse = this.authenticateAgainstIRODS(username, password);
+
+ // Settings iRODS account
+ this.irodsAccount = authResponse.getAuthenticatedIRODSAccount();
+
+ // Retrieving logging user
+ User irodsUser = new User();
+
+ try {
+ irodsUser = this.irodsAccessObjectFactory.getUserAO(this.irodsAccount).findByName(username);
+ } catch (JargonException e) {
+ logger.error("Could not find user: " + e.getMessage());
+ }
+
+ GrantedAuthority grantedAuth;
+ if (irodsUser.getUserType().equals(UserTypeEnum.RODS_ADMIN)) {
+ grantedAuth = new IRODSAdminGrantedAuthority();
+ } else {
+ grantedAuth = new IRODSUserGrantedAuthority();
+ }
+
+ // Settings granted authorities
+ List grantedAuths = new ArrayList();
+ grantedAuths.add(grantedAuth);
+
+ // Returning authentication token with the access object factory injected
+ authObject = new UsernamePasswordAuthenticationToken(username, password, grantedAuths);
+
+ // Creating UserTokenDetails instance for the current authenticated user
+ UserTokenDetails userDetails = new UserTokenDetails();
+ userDetails.setIrodsAccount(this.irodsAccount);
+ userDetails.setUser(this.user);
+
+ // Settings the user details object into the authentication object
+ authObject.setDetails(userDetails);
+ } catch (TransactionException e) {
+ logger.error("Database not responding");
+ throw new DataGridDatabaseException(e.getMessage());
+ } catch (InvalidUserException | org.irods.jargon.core.exception.AuthenticationException e) {
+ logger.error("Could not authenticate user: ", username);
+ throw new DataGridAuthenticationException(e.getMessage());
+ } catch (JargonException e) {
+ logger.error("Server not responding");
+ throw new DataGridServerException(e.getMessage());
+ }
+
+ return authObject;
+ }
+
+ @Override
+ public boolean supports(Class> authentication) {
+ return authentication.equals(UsernamePasswordAuthenticationToken.class);
+ }
+
+ private AuthResponse authenticateAgainstIRODS(String username, String password) throws JargonException {
+ if(username == null || username.isEmpty() || password == null || password.isEmpty()) {
+ throw new DataGridAuthenticationException("Username or password invalid: null or empty value(s) provided");
+ } else if (username.equalsIgnoreCase(IRODS_ANONYMOUS_ACCOUNT)) {
+ throw new DataGridAuthenticationException("Cannot log in as anonymous");
+ }
+
+ AuthResponse authResponse;
+
+ // Getting iRODS protocol set
+ logger.debug("Creating IRODSAccount object.");
+ this.irodsAccount = IRODSAccount.instance(this.irodsHost, Integer.parseInt(this.irodsPort), username, password,
+ "", this.irodsZoneName, "demoResc");
+ this.irodsAccount.setAuthenticationScheme(AuthScheme.findTypeByString(this.irodsAuthScheme));
+ logger.debug("Done.");
+
+ logger.debug(
+ "Authenticating IRODSAccount:\n\tusername: {}\n\tpassword: ***********\n\tirodsHost: {}\n\tirodsZone: {}",
+ username, this.irodsHost, this.irodsZoneName);
+ authResponse = this.irodsAccessObjectFactory.authenticateIRODSAccount(this.irodsAccount);
+ logger.debug("Done.");
+
+ if (authResponse.isSuccessful()) {
+
+ if (StringUtils.isEmpty(authResponse.getAuthMessage())) {
+ logger.debug("AuthMessage: {}", authResponse.getAuthMessage());
+ }
+
+ // Settings iRODS account
+ this.irodsAccount = authResponse.getAuthenticatingIRODSAccount();
+
+ // Retrieving logging user
+ UserAO userAO = this.irodsAccessObjectFactory.getUserAO(this.irodsAccount);
+ User irodsUser = userAO.findByName(username);
+
+ // If the user is found and has administrator permissions
+ if (irodsUser.getUserType().equals(UserTypeEnum.RODS_ADMIN)
+ || irodsUser.getUserType().equals(UserTypeEnum.RODS_USER)) {
+
+ // If the user is not yet persisted in our database
+ DataGridUser user = this.userDao.findByUsernameAndZone(irodsUser.getName(), irodsUser.getZone());
+
+ if (user == null) {
+ user = new DataGridUser();
+ user.setUsername(irodsUser.getName());
+ user.setAdditionalInfo(irodsUser.getZone());
+ user.setDataGridId(Long.parseLong(irodsUser.getId()));
+ user.setEnabled(true);
+ user.setFirstName("");
+ user.setLastName("");
+ if (irodsUser.getUserType().equals(UserTypeEnum.RODS_ADMIN)) {
+ user.setUserType(UserTypeEnum.RODS_ADMIN.getTextValue());
+ } else {
+ user.setUserType(UserTypeEnum.RODS_USER.getTextValue());
+ }
+ this.userDao.save(user);
+ }
+
+ this.user = user;
+ }
+ }
+
+ return authResponse;
+ }
+
+ /**
+ * @return the irodsHost
+ */
+ public String getIrodsHost() {
+ return this.irodsHost;
+ }
+
+ /**
+ * @param irodsHost
+ * the irodsHost to set
+ */
+ public void setIrodsHost(String irodsHost) {
+ this.irodsHost = irodsHost;
+ }
+
+ /**
+ * @return the irodsPort
+ */
+ public String getIrodsPort() {
+ return this.irodsPort;
+ }
+
+ /**
+ * @param irodsPort
+ * the irodsPort to set
+ */
+ public void setIrodsPort(String irodsPort) {
+ this.irodsPort = irodsPort;
+ }
+
+ /**
+ * @return the irodsZoneName
+ */
+ public String getIrodsZoneName() {
+ return this.irodsZoneName;
+ }
+
+ /**
+ * @param irodsZoneName
+ * the irodsZoneName to set
+ */
+ public void setIrodsZoneName(String irodsZoneName) {
+ this.irodsZoneName = irodsZoneName;
+ }
+
+ /**
+ * Temporary implementation of the GrantedAuthority interface for Admin authentication
+ */
+ private class IRODSAdminGrantedAuthority implements GrantedAuthority {
+
+ private static final long serialVersionUID = 357603546013216540L;
+
+ @Override
+ public String getAuthority() {
+ return "ROLE_ADMIN";
+ }
+ }
+
+ /**
+ * Temporary implementation of the GrantedAuthority interface for User authentication
+ */
+ private class IRODSUserGrantedAuthority implements GrantedAuthority {
+
+ private static final long serialVersionUID = 357603546013216540L;
+
+ @Override
+ public String getAuthority() {
+ return "ROLE_USER";
+ }
+ }
+}
diff --git a/packaging/src/emc-metalnx-services/src/main/java/com/emc/metalnx/services/auth/IRODSLogoutSuccessHandler.java b/packaging/src/emc-metalnx-services/src/main/java/com/emc/metalnx/services/auth/IRODSLogoutSuccessHandler.java
new file mode 100755
index 000000000..d132a7280
--- /dev/null
+++ b/packaging/src/emc-metalnx-services/src/main/java/com/emc/metalnx/services/auth/IRODSLogoutSuccessHandler.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.services.auth;
+
+import org.apache.commons.io.FileUtils;
+import org.irods.jargon.core.connection.IRODSAccount;
+import org.irods.jargon.core.pub.IRODSAccessObjectFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;
+import org.springframework.security.web.authentication.logout.SimpleUrlLogoutSuccessHandler;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.File;
+import java.io.IOException;
+
+public class IRODSLogoutSuccessHandler extends SimpleUrlLogoutSuccessHandler implements LogoutSuccessHandler {
+
+ @Autowired
+ IRODSAccessObjectFactory irodsAccessObjectFactory;
+
+ private static final Logger logger = LoggerFactory.getLogger(IRODSLogoutSuccessHandler.class);
+
+ @Override
+ public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication)
+ throws IOException, ServletException {
+
+ logger.info("Logging out...");
+
+ try {
+ IRODSAccount irodsAccount = ((UserTokenDetails) authentication.getDetails()).getIrodsAccount();
+ String username = irodsAccount.getUserName();
+
+ logger.info("Closing session and eating all exceptions");
+ irodsAccessObjectFactory.closeSessionAndEatExceptions(irodsAccount);
+ irodsAccessObjectFactory.closeSessionAndEatExceptions();
+
+ logger.debug("Removing current session temporary directory for file upload");
+ try {
+ File tmpSessionDir = new File(username);
+ if (tmpSessionDir.exists()) {
+ FileUtils.forceDelete(tmpSessionDir);
+ }
+ }
+ catch (Exception e) {
+ logger.error("User {} temporary directory for upload does not exist.", username);
+ }
+
+ response.sendRedirect("/emc-metalnx-web/login/");
+ logger.info("User {} disconnected successfully", username);
+ }
+ catch (Exception e) {
+ logger.info("User session is already expired. There is no need to clear session.");
+ }
+
+ super.onLogoutSuccess(request, response, authentication);
+ }
+
+}
diff --git a/packaging/src/emc-metalnx-services/src/main/java/com/emc/metalnx/services/auth/UserTokenDetails.java b/packaging/src/emc-metalnx-services/src/main/java/com/emc/metalnx/services/auth/UserTokenDetails.java
new file mode 100755
index 000000000..8a7a004ef
--- /dev/null
+++ b/packaging/src/emc-metalnx-services/src/main/java/com/emc/metalnx/services/auth/UserTokenDetails.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.services.auth;
+
+import com.emc.metalnx.core.domain.entity.DataGridUser;
+import org.irods.jargon.core.connection.IRODSAccount;
+import org.irods.jargon.core.exception.JargonException;
+import org.irods.jargon.core.pub.IRODSAccessObjectFactory;
+import org.irods.jargon.core.pub.IRODSFileSystem;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * The object that is encapsulated in the user session
+ *
+ */
+public class UserTokenDetails {
+
+ private DataGridUser user;
+ private IRODSAccount irodsAccount;
+
+ private static final Logger logger = LoggerFactory.getLogger(UserTokenDetails.class);
+
+ /**
+ * @return the irodsAccount
+ */
+ public IRODSAccount getIrodsAccount() {
+ return irodsAccount;
+ }
+ /**
+ * @param irodsAccount the irodsAccount to set
+ */
+ public void setIrodsAccount(IRODSAccount irodsAccount) {
+ this.irodsAccount = irodsAccount;
+ }
+ /**
+ * @return the irodsFileSystem
+ */
+ public IRODSFileSystem getIrodsFileSystem() {
+ try {
+ return IRODSFileSystem.instance();
+ } catch (JargonException e) {
+ logger.error("Could not get instance of IRODSFileSystem: ", e);
+ }
+ return null;
+ }
+
+ /**
+ * @return the irodsAccessObjectFactory
+ */
+ public IRODSAccessObjectFactory getIrodsAccessObjectFactory() {
+ try {
+ return this.getIrodsFileSystem().getIRODSAccessObjectFactory();
+ } catch (JargonException e) {
+ logger.error("Could not get Access Object Factory from IRODS: ", e);
+ }
+ return null;
+ }
+
+ /**
+ * @return the user
+ */
+ public DataGridUser getUser() {
+ return user;
+ }
+ /**
+ * @param user the user to set
+ */
+ public void setUser(DataGridUser user) {
+ this.user = user;
+ }
+
+}
diff --git a/packaging/src/emc-metalnx-services/src/main/java/com/emc/metalnx/services/configuration/ConfigServiceImpl.java b/packaging/src/emc-metalnx-services/src/main/java/com/emc/metalnx/services/configuration/ConfigServiceImpl.java
new file mode 100755
index 000000000..1a4897601
--- /dev/null
+++ b/packaging/src/emc-metalnx-services/src/main/java/com/emc/metalnx/services/configuration/ConfigServiceImpl.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.services.configuration;
+
+import com.emc.metalnx.services.interfaces.ConfigService;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Scope;
+import org.springframework.context.annotation.ScopedProxyMode;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.context.WebApplicationContext;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * Class that will load all all configurable parameters from *.properties files.
+ */
+@Service
+@Transactional
+@Scope(value = WebApplicationContext.SCOPE_SESSION, proxyMode = ScopedProxyMode.INTERFACES)
+public class ConfigServiceImpl implements ConfigService {
+
+ @Value("${msi.api.version}")
+ private String msiAPIVersionSupported;
+
+ @Value("${msi.metalnx.list}")
+ private String mlxMSIsExpected;
+
+ @Value("${msi.irods.list}")
+ private String irods41MSIsExpected;
+
+ @Value("${msi.irods.42.list}")
+ private String irods42MSIsExpected;
+
+ @Value("${msi.other.list}")
+ private String otherMSIsExpected;
+
+ @Value("${irods.host}")
+ private String irodsHost;
+
+ @Value("${irods.port}")
+ private String irodsPort;
+
+ @Value("${irods.zoneName}")
+ private String irodsZone;
+
+ @Value("${jobs.irods.username}")
+ private String irodsJobUser;
+
+ @Value("${jobs.irods.password}")
+ private String irodsJobPassword;
+
+ @Value("${jobs.irods.auth.scheme}")
+ private String irodsAuthScheme;
+
+ @Value("${populate.msi.enabled}")
+ private boolean populateMsiEnabled;
+
+ public String getMsiAPIVersionSupported() {
+ if (msiAPIVersionSupported == null) return "";
+ return msiAPIVersionSupported;
+ }
+
+ public List getMlxMSIsExpected() {
+ if (mlxMSIsExpected == null) return Collections.emptyList();
+ return Arrays.asList(mlxMSIsExpected.split(","));
+ }
+
+ public List getIrods41MSIsExpected() {
+ if (irods41MSIsExpected == null) return Collections.emptyList();
+ return Arrays.asList(irods41MSIsExpected.split(","));
+ }
+
+ public List getIrods42MSIsExpected() {
+ if (irods42MSIsExpected == null) return Collections.emptyList();
+ return Arrays.asList(irods42MSIsExpected.split(","));
+ }
+
+ public List getOtherMSIsExpected() {
+ if (otherMSIsExpected == null) return Collections.emptyList();
+ return Arrays.asList(otherMSIsExpected.split(","));
+ }
+
+ public String getIrodsHost() {
+ return irodsHost;
+ }
+
+ public String getIrodsPort() {
+ return irodsPort;
+ }
+
+ public String getIrodsZone() {
+ return irodsZone;
+ }
+
+ public String getIrodsJobUser() {
+ return irodsJobUser;
+ }
+
+ public String getIrodsJobPassword() {
+ return irodsJobPassword;
+ }
+
+ public String getIrodsAuthScheme() {
+ return irodsAuthScheme;
+ }
+
+ public boolean isPopulateMsiEnabled() { return populateMsiEnabled; }
+}
diff --git a/packaging/src/emc-metalnx-services/src/main/java/com/emc/metalnx/services/interfaces/AdminServices.java b/packaging/src/emc-metalnx-services/src/main/java/com/emc/metalnx/services/interfaces/AdminServices.java
new file mode 100755
index 000000000..dc6397369
--- /dev/null
+++ b/packaging/src/emc-metalnx-services/src/main/java/com/emc/metalnx/services/interfaces/AdminServices.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.services.interfaces;
+
+import com.emc.metalnx.core.domain.exceptions.DataGridConnectionRefusedException;
+import org.irods.jargon.core.pub.CollectionAndDataObjectListAndSearchAO;
+import org.irods.jargon.core.pub.DataObjectAO;
+import org.irods.jargon.core.pub.SpecificQueryAO;
+import org.irods.jargon.core.pub.UserAO;
+
+/**
+ * Service that allows the user to get an instance of each iRODS AO by session.
+ *
+ */
+public interface AdminServices {
+
+ /**
+ * Gets the UserAO from iRODS based on the logged user.
+ *
+ * @return the UserAO object
+ * @throws DataGridConnectionRefusedException
+ */
+ public UserAO getUserAO() throws DataGridConnectionRefusedException;
+
+ /**
+ * Gets SpecificQueryAO from iRODS based on the admin user set only for Metalnx purposes.
+ *
+ * @return instance of SpecificQueryAO
+ * @throws DataGridConnectionRefusedException
+ */
+ public SpecificQueryAO getSpecificQueryAO() throws DataGridConnectionRefusedException;
+
+ /**
+ * Gets the DataObjectAO from iRODS based on the admin user set only for Metalnx purposes.
+ *
+ * @return Data Object access object
+ * @throws DataGridConnectionRefusedException
+ */
+ public DataObjectAO getDataObjectAO() throws DataGridConnectionRefusedException;
+
+ /**
+ * Gets CollectionAndDataObjectListAndSearchAO from iRODS based on an admin user set
+ * only for Metalnx purposes.
+ *
+ * @throws DataGridConnectionRefusedException
+ */
+ public CollectionAndDataObjectListAndSearchAO getCollectionAndDataObjectListAndSearchAO() throws DataGridConnectionRefusedException;
+
+}
diff --git a/packaging/src/emc-metalnx-services/src/main/java/com/emc/metalnx/services/interfaces/AuthenticationProviderService.java b/packaging/src/emc-metalnx-services/src/main/java/com/emc/metalnx/services/interfaces/AuthenticationProviderService.java
new file mode 100755
index 000000000..ef6d94f81
--- /dev/null
+++ b/packaging/src/emc-metalnx-services/src/main/java/com/emc/metalnx/services/interfaces/AuthenticationProviderService.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.services.interfaces;
+
+import org.springframework.security.authentication.AuthenticationProvider;
+
+public interface AuthenticationProviderService extends AuthenticationProvider {
+
+}
diff --git a/packaging/src/emc-metalnx-services/src/main/java/com/emc/metalnx/services/interfaces/CollectionService.java b/packaging/src/emc-metalnx-services/src/main/java/com/emc/metalnx/services/interfaces/CollectionService.java
new file mode 100755
index 000000000..c98803cd5
--- /dev/null
+++ b/packaging/src/emc-metalnx-services/src/main/java/com/emc/metalnx/services/interfaces/CollectionService.java
@@ -0,0 +1,421 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.services.interfaces;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.irods.jargon.core.exception.FileNotFoundException;
+import org.irods.jargon.core.exception.JargonException;
+import org.irods.jargon.core.query.CollectionAndDataObjectListingEntry;
+
+import com.emc.metalnx.core.domain.entity.DataGridCollectionAndDataObject;
+import com.emc.metalnx.core.domain.entity.DataGridPageContext;
+import com.emc.metalnx.core.domain.entity.DataGridResource;
+import com.emc.metalnx.core.domain.exceptions.DataGridConnectionRefusedException;
+import com.emc.metalnx.core.domain.exceptions.DataGridDataNotFoundException;
+import com.emc.metalnx.core.domain.exceptions.DataGridException;
+import com.emc.metalnx.core.domain.exceptions.DataGridQueryException;
+
+public interface CollectionService {
+
+ /**
+ * Verifies whether or not a file already exists in a collection
+ *
+ * @param filename
+ * name of the file to be checked
+ * @param collectionPath
+ * path to the collection where the file may or may not exist
+ * @return True, if a file with the exact same name is found in the collection.
+ * False, otherwise.
+ * @throws DataGridConnectionRefusedException
+ * if Metalnx cannot connect to the data grid.
+ * @throws JargonException
+ */
+ boolean isFileInCollection(String filename, String collectionPath)
+ throws DataGridConnectionRefusedException, JargonException;
+
+ /**
+ * Checks whether a path is valid in the grid or not.
+ *
+ * @param path
+ * file or collection path to be validated
+ * @return True, if the path exists in the grid (path is a file or collection).
+ * False, otherwise.
+ */
+ boolean isPathValid(String path);
+
+ /**
+ * Checks whether or not a given path is a path for a collection.
+ *
+ * @param path
+ * @return True, if the given path is a collection path. False, otherwise.
+ * @throws DataGridException
+ */
+ boolean isCollection(String path) throws DataGridException;
+
+ /**
+ * Checks whether or not a given path is a path for a data object.
+ *
+ * @param path
+ * @return True, if the given path is a data object path. False, otherwise.
+ * @throws DataGridException
+ */
+ boolean isDataObject(String path) throws DataGridException;
+
+ /**
+ * Retrieves all collections and data objects that match a search term. All
+ * results are paginated. Any collection or data object where the term appears
+ * in the beginning, middle, and the end of its name will be retrieved.
+ *
+ * @param path
+ * path that we will be looking for collections and data objects that
+ * match the search term
+ * @param searchText
+ * term to be matched
+ * @param pageNum
+ * the page the user is currently seeing
+ * @param pageSize
+ * number of items shown by page
+ * @param pageContext
+ * object that contains information about the number of items
+ * diplayed and the total number of items found
+ * @return List of collections and data objects where the term appears.
+ * @throws DataGridDataNotFoundException
+ * @throws DataGridQueryException
+ * @throws DataGridException
+ */
+ List getSubCollectionsAndDataObjectsUnderPathThatMatchSearchTextPaginated(
+ String path, String searchText, int pageNum, int pageSize, int orderColumn, String orderDir,
+ DataGridPageContext pageContext)
+ throws DataGridDataNotFoundException, DataGridException, DataGridQueryException;
+
+ /**
+ * Gets what kind of permission(s) the logged user has on a certain path
+ *
+ * @param path
+ * path to collection or data object in the data grid
+ * @return permission type (read, write, own)
+ * @throws DataGridConnectionRefusedException
+ */
+ String getPermissionsForPath(String path) throws DataGridConnectionRefusedException;
+
+ /**
+ * Gets the total number of replicas for a specific data object
+ *
+ * @param path
+ * path to the data object
+ * @return the total number of replicas for the data object given as a parameter
+ * @throws DataGridConnectionRefusedException
+ * @throws DataGridException
+ */
+ int getTotalNumberOfReplsForDataObject(String path) throws DataGridException;
+
+ /**
+ * Lists all replicas of a data object by resource.
+ *
+ * @param path
+ * path to the data object
+ * @return Map, containing the replica of the given path
+ * and the resource where this replica is located
+ * @throws DataGridConnectionRefusedException
+ */
+ Map listReplicasByResource(String path)
+ throws DataGridConnectionRefusedException;
+
+ /**
+ * Gets the current user's home directory
+ *
+ * @return string with the path to the the current user's home directory
+ * @throws DataGridException
+ */
+ String getHomeDirectyForCurrentUser() throws DataGridException;
+
+ /**
+ * Gets all collections and data objects existing under a specific path
+ *
+ * @param path
+ * path to the collection where we will retrieve sub collections and
+ * data objects
+ * @return list of collections and data objects existing under a path
+ * @throws DataGridConnectionRefusedException
+ * @throws FileNotFoundException
+ * @throws JargonException
+ */
+ List getSubCollectionsAndDataObjectsUnderPath(String path)
+ throws DataGridConnectionRefusedException, FileNotFoundException, JargonException;
+
+ /**
+ * Create a collection in iRODS
+ *
+ * @param newCollection
+ * @throws DataGridException
+ */
+ boolean createCollection(DataGridCollectionAndDataObject newCollection) throws DataGridException;
+
+ /**
+ * Find collections that match the parameter name
+ *
+ * @param name
+ * name that will be looked for in the grid
+ * @return CollectionAndDataObjectListingEntry List list of collections that
+ * match a given name
+ * @throws DataGridConnectionRefusedException
+ */
+ List searchCollectionAndDataObjectsByName(String name)
+ throws DataGridConnectionRefusedException;
+
+ /**
+ * Find collections and data objects that match the parameter name
+ *
+ * @param path
+ * path that will be looked for in the grid
+ * @return DataGridCollectionAndDataObject of the given path null if no
+ * collections or data objects were found
+ * @throws DataGridException
+ */
+ DataGridCollectionAndDataObject findByName(String path) throws DataGridException;
+
+ /**
+ * Changes collection's name
+ *
+ * @param previousPath
+ * collection path that will be modified
+ * @param newPath
+ * new collection path where the previous collection path will be
+ * moved to
+ * @param inheritOption
+ * boolean that says if we need to enable inheritance on a collection
+ * or not
+ * @throws DataGridConnectionRefusedException
+ */
+ boolean modifyCollectionAndDataObject(String previousPath, String newPath, boolean inheritOption)
+ throws DataGridConnectionRefusedException;
+
+ /**
+ * Lists all the collection that have read permissions on the specified path for
+ * the given user.
+ *
+ * @param path
+ * @param userName
+ * @return
+ * @throws DataGridConnectionRefusedException
+ */
+ Set listReadPermissionsForPathAndUser(String path, String userName)
+ throws DataGridConnectionRefusedException;
+
+ /**
+ * Lists all the collection that have write permissions on the specified path
+ * for the given user.
+ *
+ * @param path
+ * @param userName
+ * @return
+ * @throws DataGridConnectionRefusedException
+ */
+ Set listWritePermissionsForPathAndUser(String path, String userName)
+ throws DataGridConnectionRefusedException;
+
+ /**
+ * Lists all the collection that have ownership on the specified path for the
+ * given user.
+ *
+ * @param path
+ * @param userName
+ * @return
+ * @throws DataGridConnectionRefusedException
+ */
+ Set listOwnershipForPathAndUser(String path, String userName) throws DataGridConnectionRefusedException;
+
+ /**
+ * Lists all the collection that have read permissions on the specified path for
+ * the given group.
+ *
+ * @param path
+ * @param groupName
+ * @return
+ * @throws DataGridConnectionRefusedException
+ */
+ Set listReadPermissionsForPathAndGroup(String path, String groupName)
+ throws DataGridConnectionRefusedException;
+
+ /**
+ * Lists all the collection that have write permissions on the specified path
+ * for the given group.
+ *
+ * @param path
+ * @param groupName
+ * @return
+ * @throws DataGridConnectionRefusedException
+ */
+ Set listWritePermissionsForPathAndGroup(String path, String groupName)
+ throws DataGridConnectionRefusedException;
+
+ /**
+ * Lists all the collection that have ownership on the specified path for the
+ * given group.
+ *
+ * @param path
+ * @param groupName
+ * @return
+ * @throws DataGridConnectionRefusedException
+ */
+ Set listOwnershipForPathAndGroup(String path, String groupName) throws DataGridConnectionRefusedException;
+
+ /**
+ * List the collections that have inheritance enabled
+ *
+ * @param path
+ * the parent path
+ * @return list of collections that have the inheritance option enabled
+ * @throws DataGridConnectionRefusedException
+ */
+ Set listInheritanceForPath(String path) throws DataGridConnectionRefusedException;
+
+ /**
+ * Update the inheritance options on collections
+ *
+ * @param toAdd
+ * @param toRemove
+ * @return confirmation
+ * @throws DataGridConnectionRefusedException
+ */
+ boolean updateInheritanceOptions(Map toAdd, Map toRemove, String zoneName)
+ throws DataGridConnectionRefusedException;
+
+ /**
+ * Calculates all files existing in the data grid
+ *
+ * @return the number of existing collections
+ * @throws DataGridConnectionRefusedException
+ */
+ int countAll() throws DataGridConnectionRefusedException;
+
+ /**
+ * Lists all the collection that have write permissions on the specified path
+ * recursively for the given group.
+ *
+ * @param path
+ * @param groupName
+ * @return
+ * @throws DataGridConnectionRefusedException
+ * @throws JargonException
+ */
+ Set listWritePermissionsForPathAndGroupRecursive(String path, String groupName)
+ throws DataGridConnectionRefusedException, JargonException;
+
+ /**
+ * Prepares files to be downloaded by compressing them into a single file.
+ *
+ * @param paths
+ * array of strings that represent all paths that will be downloaded
+ * @return Path to the compressed file, if any. Empty string, otherwise.
+ * @throws IOException
+ * @throws DataGridException
+ */
+ String prepareFilesForDownload(String[] paths) throws IOException, DataGridException;
+
+ /**
+ * Prepares files to be downloaded by compressing them into a single file.
+ *
+ * @param sourcePaths
+ * list of files to compress into a single file
+ * @return Path to the compressed file, if any. Empty string, otherwise.
+ * @throws IOException
+ * @throws DataGridException
+ */
+ String prepareFilesForDownload(List sourcePaths) throws IOException, DataGridException;
+
+ /**
+ * Returns the inheritance option value for a given collection
+ *
+ * @param collPath
+ * @return the boolean
+ * @throws DataGridConnectionRefusedException
+ */
+ boolean getInheritanceOptionForCollection(String collPath) throws DataGridConnectionRefusedException;
+
+ /**
+ * Gets the replica number of a collection or data object in the grid.
+ *
+ * @param path
+ * path to the collection/object
+ * @return int with the replica number 0, if path does not exist
+ * @throws DataGridConnectionRefusedException
+ */
+ int getReplicationNumber(String path) throws DataGridConnectionRefusedException;
+
+ /**
+ * Gets the data grid checksum for a given path.
+ *
+ * @param path
+ * path to the collection/object in the grid
+ * @return String with the checksum
+ * @throws DataGridConnectionRefusedException
+ */
+ String getChecksum(String path) throws DataGridConnectionRefusedException;
+
+ /**
+ * Maps a CollectionAndDataObjectListingEntry list into a
+ * DataGridCollectionAndDataObject list
+ *
+ * @param entries
+ * CollectionAndDataObjectListingEntry objects to map
+ * @return list of DataGridCollectionAndDataObject objects
+ */
+ List mapListingEntryToDataGridCollectionAndDataObject(
+ List entries);
+
+ /**
+ * Maps a CollectionAndDataObjectListingEntry object into a
+ * DataGridCollectionAndDataObject object
+ *
+ * @param entry
+ * CollectionAndDataObjectListingEntry objects to map
+ * @return instance of DataGridCollectionAndDataObject
+ */
+ DataGridCollectionAndDataObject mapListingEntryToDataGridCollectionAndDataObject(
+ CollectionAndDataObjectListingEntry entry);
+
+ /**
+ * Gets the public directory
+ *
+ * @return string with the path to the the public directory
+ */
+ String getHomeDirectyForPublic();
+
+ /**
+ * Retrieve only the collections under a parent collection
+ *
+ * @param parent
+ * @return
+ * @throws DataGridConnectionRefusedException
+ */
+ List getSubCollectionsUnderPath(String parent)
+ throws DataGridConnectionRefusedException;
+
+ /**
+ * Get trash path related to the current path
+ *
+ * @param path
+ * @return correspondent trash for given path
+ */
+ String getTrashForPath(String path);
+
+}
diff --git a/packaging/src/emc-metalnx-services/src/main/java/com/emc/metalnx/services/interfaces/ConfigService.java b/packaging/src/emc-metalnx-services/src/main/java/com/emc/metalnx/services/interfaces/ConfigService.java
new file mode 100755
index 000000000..418c464b3
--- /dev/null
+++ b/packaging/src/emc-metalnx-services/src/main/java/com/emc/metalnx/services/interfaces/ConfigService.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.services.interfaces;
+
+import java.util.List;
+
+/**
+ * Service used to retrieve all configurable parameters from *.properties files.
+ */
+public interface ConfigService {
+ /**
+ * Finds the MSI API version supported by the current version of Metalnx.
+ * @return string representing the version
+ */
+ String getMsiAPIVersionSupported();
+
+ /**
+ * Finds the list of all expected Metalnx microservices.
+ * @return list of all Metalnx microservices.
+ */
+ List getMlxMSIsExpected();
+
+ /**
+ * Finds the list of all expected iRODS 4.1.X microservices.
+ * @return list of all iRODS 4.1.X microservices.
+ */
+ List getIrods41MSIsExpected();
+
+ /**
+ * Finds the list of all expected irods 4.2.X microservices.
+ * @return list of all irods 4.2.X microservices.
+ */
+ List getIrods42MSIsExpected();
+
+ /**
+ * Finds the list of all third-party microservices.
+ * @return list of all third-party microservices.
+ */
+ List getOtherMSIsExpected();
+
+ /**
+ * Find the iCAT hostname.
+ * @return String representing the iCAT machine's hostname.
+ */
+ String getIrodsHost();
+
+ /**
+ * Find the irods port number.
+ * @return String representing irods port number.
+ */
+ String getIrodsPort();
+
+ /**
+ * Find the irods default zone.
+ * @return String representing the irods default zone.
+ */
+ String getIrodsZone();
+
+ /**
+ * Find the jobs username.
+ * @return String representing the username used for synchronizing Metalnx and iRODS.
+ */
+ String getIrodsJobUser();
+
+ /**
+ * Find the jobs password.
+ * @return String representing the password used for synchronizing Metalnx and iRODS.
+ */
+ String getIrodsJobPassword();
+
+ /**
+ * Find the authentication scheme used for authenticating against iRODS.
+ * @return String representing the authentication scheme.
+ */
+ String getIrodsAuthScheme();
+
+ /**
+ * Checks whether or not the populate MSI flag is enabled
+ * @return True, if populate is enabled. False, otherwise.
+ */
+ boolean isPopulateMsiEnabled();
+}
diff --git a/packaging/src/emc-metalnx-services/src/main/java/com/emc/metalnx/services/interfaces/FavoritesService.java b/packaging/src/emc-metalnx-services/src/main/java/com/emc/metalnx/services/interfaces/FavoritesService.java
new file mode 100755
index 000000000..8e7178e3b
--- /dev/null
+++ b/packaging/src/emc-metalnx-services/src/main/java/com/emc/metalnx/services/interfaces/FavoritesService.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.services.interfaces;
+
+import com.emc.metalnx.core.domain.entity.DataGridUser;
+import com.emc.metalnx.core.domain.entity.DataGridUserFavorite;
+
+import java.util.List;
+import java.util.Set;
+
+public interface FavoritesService {
+
+ /**
+ * Updates the favorites table for a user, whether be it to remove or add a path
+ *
+ * @param user
+ * @param set
+ * of paths to be added
+ * @param set
+ * of paths to be removed
+ * @return True, if operation is successful. False, otherwise.
+ */
+ boolean updateFavorites(DataGridUser user, Set toAdd, Set toRemove);
+
+ /**
+ * Returns a list of strings with each of them representing a path marked as favorite
+ *
+ * @param user
+ * @return List of paths marked as favorites by the user.
+ */
+ List findFavoritesForUserAsString(DataGridUser user);
+
+ /**
+ * Removes path from database. This operation is used when the corresponding collection or file
+ * is deleted from the grid
+ *
+ * @param path
+ * @return True, if operation is successful. False, otherwise.
+ */
+ boolean removeFavoriteBasedOnPath(String path);
+
+ /**
+ * Removes path from database. This operation is used when the corresponding collection or file
+ * is deleted from the grid
+ *
+ * @param {@link DataGridUser} user
+ * @return True, if operation is successful. False, otherwise.
+ */
+ boolean removeFavoriteBasedOnUser(DataGridUser user);
+
+ /**
+ * Removes path from database. This operation is used when the corresponding collection or file
+ * is deleted from the grid
+ *
+ * @param path
+ * @return True, if operation is successful. False, otherwise.
+ */
+ boolean removeFavoriteBasedOnRelativePath(String path);
+
+ /**
+ * Checks whether the parameter path is a favorite for parameter user
+ *
+ * @param user
+ * @param path
+ * @return True, if path is a favorite for user. False, otherwise.
+ */
+ boolean isPathFavoriteForUser(DataGridUser user, String path);
+
+ /**
+ * Find list of favorites paginated
+ *
+ * @param user
+ * @param offset
+ * represents the starting row in the query
+ * @param limit
+ * how many elements will have the result
+ * @param searchString
+ * is different from null if filter is used
+ * @param orderBy
+ * order by a column
+ * @param orderDir
+ * the direction of the order can be 'desc' or 'asc'
+ * @param onlyCollections
+ * indicates if the results should contain only collections
+ * @return list of {@link DataGridUserFavorite}
+ */
+ List findFavoritesPaginated(DataGridUser user, int offset, int limit, String searchString, String orderBy, String orderDir,
+ boolean onlyCollections);
+
+}
diff --git a/packaging/src/emc-metalnx-services/src/main/java/com/emc/metalnx/services/interfaces/FileOperationService.java b/packaging/src/emc-metalnx-services/src/main/java/com/emc/metalnx/services/interfaces/FileOperationService.java
new file mode 100755
index 000000000..8536b6fae
--- /dev/null
+++ b/packaging/src/emc-metalnx-services/src/main/java/com/emc/metalnx/services/interfaces/FileOperationService.java
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.services.interfaces;
+
+import com.emc.metalnx.core.domain.entity.DataGridUser;
+import com.emc.metalnx.core.domain.exceptions.DataGridChecksumException;
+import com.emc.metalnx.core.domain.exceptions.DataGridConnectionRefusedException;
+import com.emc.metalnx.core.domain.exceptions.DataGridException;
+import com.emc.metalnx.core.domain.exceptions.DataGridReplicateException;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.List;
+
+public interface FileOperationService {
+
+ /**
+ * Copy a file or collection between two locations in the data grid.
+ *
+ * @param sourcePath origin path
+ * @param dstPath destination path
+ * @param copyWithMetadata flag that says whether or not we are copying the file along with its metadata tags
+ * @return True, if file or collection was moved. False, otherwise.
+ * @throws DataGridConnectionRefusedException if Metalnx cannot connect to the data grid
+ */
+ boolean copy(String sourcePath, String dstPath, boolean copyWithMetadata) throws DataGridConnectionRefusedException;
+
+ /**
+ * Copy a set of files or collections between two locations in the data grid.
+ *
+ * @param sourcePaths list of paths to be copied
+ * @param dstPath path where the files/collections will be copied
+ * @param copyWithMetadata flag that says whether or not we are copying the file along with its metadata tags
+ * @return True, if all files or collections were moved. False, otherwise.
+ * @throws DataGridConnectionRefusedException if Metalnx cannot connect to the data grid
+ */
+ boolean copy(List sourcePaths, String dstPath, boolean copyWithMetadata) throws DataGridConnectionRefusedException;
+
+ /**
+ * Delete a file or collection in iRODS
+ *
+ * @param path path to the collection or data object to be deleted
+ * @param force delete collection/data object with force flag set
+ * @throws DataGridConnectionRefusedException if Metalnx cannot connect to the data grid
+ */
+ boolean deleteItem(String path, boolean force) throws DataGridConnectionRefusedException;
+
+ /**
+ * Delete a collection in iRODS
+ *
+ * @param collectionPath path to the collection to be deleted
+ * @param forceFlag when set to true, force delete an object (-f). When set to false, delete object no with force
+ * @throws DataGridException if an error occurred during deletion
+ */
+ boolean deleteCollection(String collectionPath, boolean forceFlag) throws DataGridException;
+
+ /**
+ * Delete a data object in iRODS
+ *
+ * @param dataObjectPath path to the data object that will de removed
+ * @param forceFlag when set to true, force delete an object (-f). When set to false, delete object no with force
+ * @throws DataGridException if an error occurred during deletion
+ */
+ boolean deleteDataObject(String dataObjectPath, boolean forceFlag) throws DataGridException;
+
+ /**
+ * Delete a replica of a data object
+ *
+ * @param path path to the parent of the data object to be deleted
+ * @param replicaNumber number of the replica that is going to be deleted
+ * @param inAdminMode run the command as admin (-M option)
+ * @return true if the operation was successful and false otherwise
+ * @throws DataGridConnectionRefusedException if Metalnx cannot connect to the data grid
+ */
+ boolean deleteReplica(String path, String fileName, int replicaNumber, boolean inAdminMode) throws DataGridConnectionRefusedException;
+
+ /**
+ * Download a file or collection from the data grid.
+ *
+ * @param path file to download
+ * @param httpResponse response to an http request
+ * @param removeTempCollection flag when set to true tells Metalnx to remove temporary collections and tar files
+ * created for downloading. When set to false, just puts the file into the HTTP response
+ * @return True, if file or collection was downloaded. False, otherwise.
+ * @throws DataGridException if an error happen in the data grid
+ * @throws IOException cannot create the tar ball file
+ */
+ boolean download(String path, HttpServletResponse httpResponse, boolean removeTempCollection) throws DataGridException, IOException;
+
+ /**
+ * Removes all items existing in the trash folder of a given user.
+ *
+ * @param user user who will get the trash cleaned
+ * @param currentPath path from which the trash path will be extracted
+ * @return True, if all trash items were removed. False, otherwise.
+ * @throws DataGridConnectionRefusedException if Metalnx cannot connect to the data grid
+ */
+ boolean emptyTrash(DataGridUser user, String currentPath) throws DataGridConnectionRefusedException;
+
+ /**
+ * Move a file or collection between two locations in the data grid.
+ *
+ * @param sourcePath origin path
+ * @param targetPath destination path where the file will be moved to
+ * @return True, if file or collection was moved. False, otherwise.
+ * @throws DataGridException if an error occurred during the move operation
+ */
+ boolean move(String sourcePath, String targetPath) throws DataGridException;
+
+ /**
+ * Replicates a file into another resource.
+ *
+ * @param path path to the file to be replicated
+ * @param targetResource resource where the replica will be stored
+ * @param inAdminMode replicate object in admin mode (-M option)
+ * @throws DataGridReplicateException is thrown if replication fails
+ * @throws DataGridConnectionRefusedException is thrown if Metalnx cannot connect to the data grid
+ */
+ void replicateDataObject(String path, String targetResource, boolean inAdminMode) throws DataGridConnectionRefusedException, DataGridReplicateException;
+
+ /**
+ * Computes checksum for a given path.
+ * @param path path to the file in the grid
+ * @param filename name of the file to compute checksum
+ * @throws DataGridChecksumException is thrown if checksum cannot be calculated
+ * @throws DataGridConnectionRefusedException is thrown when Metalnx cannot connect to the data grid
+ */
+ void computeChecksum(String path, String filename) throws DataGridChecksumException, DataGridConnectionRefusedException;
+}
diff --git a/packaging/src/emc-metalnx-services/src/main/java/com/emc/metalnx/services/interfaces/FilePropertyService.java b/packaging/src/emc-metalnx-services/src/main/java/com/emc/metalnx/services/interfaces/FilePropertyService.java
new file mode 100755
index 000000000..4875118ca
--- /dev/null
+++ b/packaging/src/emc-metalnx-services/src/main/java/com/emc/metalnx/services/interfaces/FilePropertyService.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.services.interfaces;
+
+import java.util.List;
+
+import org.irods.jargon.core.exception.JargonException;
+
+import com.emc.metalnx.core.domain.entity.DataGridCollectionAndDataObject;
+import com.emc.metalnx.core.domain.entity.DataGridFilePropertySearch;
+import com.emc.metalnx.core.domain.entity.DataGridPageContext;
+import com.emc.metalnx.core.domain.exceptions.DataGridConnectionRefusedException;
+
+public interface FilePropertyService {
+
+ /**
+ * Get all collections and data objects that match any metadata search criteria
+ * given as a parameters
+ *
+ * @param searchList
+ * list of metadata search criteria
+ * @param pageContext
+ * pagination context for proper counting display at the front end
+ * @param pageNum
+ * page required
+ * @param pageSize
+ * max number of items to display in a page
+ * @return list of collections and data objects
+ * @throws DataGridConnectionRefusedException
+ * @throws JargonException
+ */
+ public List findByFileProperties(List searchList,
+ DataGridPageContext pageContext, int pageNum, int pageSize)
+ throws DataGridConnectionRefusedException, JargonException;
+
+}
diff --git a/packaging/src/emc-metalnx-services/src/main/java/com/emc/metalnx/services/interfaces/GroupBookmarkService.java b/packaging/src/emc-metalnx-services/src/main/java/com/emc/metalnx/services/interfaces/GroupBookmarkService.java
new file mode 100755
index 000000000..7b0ff859a
--- /dev/null
+++ b/packaging/src/emc-metalnx-services/src/main/java/com/emc/metalnx/services/interfaces/GroupBookmarkService.java
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.services.interfaces;
+
+import com.emc.metalnx.core.domain.entity.DataGridGroup;
+import com.emc.metalnx.core.domain.entity.DataGridGroupBookmark;
+import com.emc.metalnx.core.domain.exceptions.DataGridConnectionRefusedException;
+import org.irods.jargon.core.exception.DataNotFoundException;
+import org.irods.jargon.core.exception.JargonException;
+
+import java.util.List;
+import java.util.Set;
+
+public interface GroupBookmarkService {
+
+ /**
+ * Finds all groups a user belongs to and all bookmarks set for this group to have access to.
+ *
+ * @param user
+ * name of the user
+ * @param additionalInfo
+ * zone name where the user is
+ * @return true if the group was created successfully, false otherwise
+ * @throws DataGridConnectionRefusedException
+ * @throws JargonException
+ * @throws DataNotFoundException
+ */
+ public List getGroupsBookmarks(String user, String additionalInfo) throws DataGridConnectionRefusedException,
+ DataNotFoundException, JargonException;
+
+ /**
+ * Updates the list of bookmarks on a group
+ *
+ * @param group
+ * @param toAdd
+ * @param toRemove
+ * @return a confirmation that the operation has been successful
+ */
+ public boolean updateBookmarks(DataGridGroup group, Set toAdd, Set toRemove);
+
+ /**
+ * Lists all the bookmarks on a given path
+ *
+ * @param path
+ * @return
+ */
+ public List findBookmarksOnPath(String path);
+
+ /**
+ * Lists all the bookmarks on a given path for a given group as Strings
+ *
+ * @param group
+ * @param parentPath
+ * @return
+ */
+ public List findBookmarksForGroupAsString(DataGridGroup group);
+
+ /**
+ * Remove any bookmark associated with the given path.
+ *
+ * @param path
+ * @return True, if there was one or more bookmarks mathching the given path and they were
+ * removed successfully. False,
+ * otherwise.
+ */
+ public boolean removeBookmarkBasedOnPath(String path);
+
+ /**
+ * Remove any bookmark associated with the given user.
+ *
+ * @param {@link DataGridGroup} group
+ * @return True, if there was one or more bookmarks mathching the given path and they were
+ * removed successfully. False,
+ * otherwise.
+ */
+ public boolean removeBookmarkBasedOnGroup(DataGridGroup group);
+
+ /**
+ * Remove all bookmarks based on relative paths.
+ *
+ * @param path
+ * @return True, if there was one or more bookmarks mathching the given path and they were
+ * removed successfully. False,
+ * otherwise.
+ */
+ public boolean removeBookmarkBasedOnRelativePath(String path);
+
+ public List getGroupsBookmarksPaginated(String user, String additionalInfo, int offset, int limit, String searchString,
+ String orderBy, String orderDir, boolean onlyCollections) throws DataGridConnectionRefusedException, DataNotFoundException,
+ JargonException;
+
+ public Integer countTotalGroupBookmarks(String user, String additionalInfo) throws DataGridConnectionRefusedException, DataNotFoundException,
+ JargonException;
+
+
+ /**
+ * Changes an existing bookmark to a new value.
+ *
+ * @param oldPath
+ * existing path that will be updated
+ * @param newPath
+ * new path
+ * @return True, if oldePath was successfully changed to newPath. False, otherwise.
+ */
+ public boolean updateBookmark(String oldPath, String newPath);
+
+}
diff --git a/packaging/src/emc-metalnx-services/src/main/java/com/emc/metalnx/services/interfaces/GroupService.java b/packaging/src/emc-metalnx-services/src/main/java/com/emc/metalnx/services/interfaces/GroupService.java
new file mode 100755
index 000000000..f4de83e3f
--- /dev/null
+++ b/packaging/src/emc-metalnx-services/src/main/java/com/emc/metalnx/services/interfaces/GroupService.java
@@ -0,0 +1,186 @@
+/*
+ * Copyright (c) 2015-2017, Dell EMC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.emc.metalnx.services.interfaces;
+
+import com.emc.metalnx.core.domain.entity.DataGridGroup;
+import com.emc.metalnx.core.domain.entity.DataGridUser;
+import com.emc.metalnx.core.domain.exceptions.DataGridConnectionRefusedException;
+
+import java.util.List;
+import java.util.Map;
+
+public interface GroupService {
+
+ /**
+ * Lists all groups existing on iRODS
+ *
+ * @return all groups existing in iRODS
+ */
+ public List findAll();
+
+ /**
+ * Find an specific group whose name is equal to groupname
+ *
+ * @return all groups existing in iRODS
+ */
+ public List findByGroupname(String groupname);
+
+ /**
+ * Find an specific group whose name is equal to groupname and zone
+ *
+ * @return
+ */
+ public DataGridGroup findByGroupnameAndZone(String groupname, String zone);
+
+ /**
+ * Creates a group in iRODS
+ *
+ * @param newGroup
+ * @return true if the group was created successfully, false otherwise
+ * @throws DataGridConnectionRefusedException
+ */
+ public boolean createGroup(DataGridGroup newGroup, List usersToBeAttached) throws DataGridConnectionRefusedException;
+
+ /**
+ * Removes a group from iRODS
+ *
+ * @param groupname
+ * @return True, if the group was successfully deleted. False, otherwise.
+ * @throws DataGridConnectionRefusedException
+ */
+ public boolean deleteGroupByGroupname(String groupname) throws DataGridConnectionRefusedException;
+
+ /**
+ * Attach the user to the group
+ *
+ * @param user
+ * @param group
+ * @return
+ * @throws DataGridConnectionRefusedException
+ */
+ public boolean attachUserToGroup(DataGridUser user, DataGridGroup group) throws DataGridConnectionRefusedException;
+
+ /**
+ * Remove the user from the group
+ *
+ * @param user
+ * @param group
+ * @return
+ * @throws DataGridConnectionRefusedException
+ */
+ public boolean removeUserFromGroup(DataGridUser user, DataGridGroup group) throws DataGridConnectionRefusedException;
+
+ /**
+ * Updates the list of users belonging to a given group
+ *
+ * @param user
+ * @param group
+ * @return the confirmation
+ * @throws DataGridConnectionRefusedException
+ */
+ public boolean updateMemberList(DataGridGroup group, List users) throws DataGridConnectionRefusedException;
+
+ /**
+ * Updates the list of collections the group has read permission
+ *
+ * @return the confirmation
+ * @throws DataGridConnectionRefusedException
+ */
+ public boolean updateReadPermissions(DataGridGroup group, Map addCollectionsToRead, Map