summaryrefslogtreecommitdiffstats
path: root/src/com.gluster.storage.management.core
diff options
context:
space:
mode:
Diffstat (limited to 'src/com.gluster.storage.management.core')
-rw-r--r--src/com.gluster.storage.management.core/.classpath9
-rw-r--r--src/com.gluster.storage.management.core/.project34
-rw-r--r--src/com.gluster.storage.management.core/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--src/com.gluster.storage.management.core/META-INF/MANIFEST.MF15
-rw-r--r--src/com.gluster.storage.management.core/build.properties7
-rw-r--r--src/com.gluster.storage.management.core/junit/com/gluster/storage/management/core/utils/DateUtilTest.java217
-rw-r--r--src/com.gluster.storage.management.core/junit/com/gluster/storage/management/core/utils/FileUtilTest.java481
-rw-r--r--src/com.gluster.storage.management.core/junit/com/gluster/storage/management/core/utils/StringUtilTest.java309
-rw-r--r--src/com.gluster.storage.management.core/junit/core.junit.launch15
-rw-r--r--src/com.gluster.storage.management.core/junit/test/test.txt1
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/constants/CoreConstants.java40
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/constants/GlusterConstants.java47
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/constants/RESTConstants.java123
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/exceptions/ConnectionException.java37
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/exceptions/GlusterRuntimeException.java31
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/exceptions/GlusterValidationException.java27
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Alert.java75
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Brick.java122
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Cluster.java196
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/ClusterListener.java57
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/ConnectionDetails.java64
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/DefaultClusterListener.java118
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Device.java225
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Disk.java191
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Entity.java88
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/EntityGroup.java47
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Event.java62
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Filterable.java37
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/GlusterDataModel.java46
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/GlusterDummyModel.java251
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/GlusterServer.java81
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/InitDiskStatusResponse.java89
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/NetworkInterface.java112
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Partition.java35
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Response.java37
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Server.java247
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/ServerStats.java73
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/ServerStatsRow.java69
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/StatsMetadata.java84
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Status.java92
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/TaskInfo.java140
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/TaskStatus.java64
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/User.java43
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Version.java65
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Volume.java367
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/VolumeLogMessage.java92
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/VolumeOption.java66
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/VolumeOptionInfo.java66
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/VolumeOptions.java113
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/adapters/VolumeLogDateAdapter.java53
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/AbstractResponse.java35
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/ClusterNameListResponse.java46
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/GlusterServerListResponse.java54
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/GlusterServerResponse.java35
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/LogMessageListResponse.java33
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/ServerListResponse.java48
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/ServerNameListResponse.java46
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/StringListResponse.java48
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/TaskIdResponse.java46
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/TaskInfoListResponse.java51
-rwxr-xr-xsrc/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/TaskResponse.java52
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/VolumeListResponse.java31
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/VolumeOptionInfoListResponse.java44
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/DateUtil.java119
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/FileUtil.java137
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/GlusterCoreUtil.java205
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/JavaUtil.java41
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/LRUCache.java55
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/MD5.java504
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/MD5Crypt.java339
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/NumberUtil.java30
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/ProcessResult.java69
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/ProcessUtil.java108
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/StringUtil.java120
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/ValidationUtil.java95
75 files changed, 0 insertions, 7359 deletions
diff --git a/src/com.gluster.storage.management.core/.classpath b/src/com.gluster.storage.management.core/.classpath
deleted file mode 100644
index b41cbcdb..00000000
--- a/src/com.gluster.storage.management.core/.classpath
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="junit"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
- <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/src/com.gluster.storage.management.core/.project b/src/com.gluster.storage.management.core/.project
deleted file mode 100644
index c016cd3c..00000000
--- a/src/com.gluster.storage.management.core/.project
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>com.gluster.storage.management.core</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>com.instantiations.assist.eclipse.coverage.instrumentationBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>com.instantiations.assist.eclipse.coverage.codeCoverageNature</nature>
- </natures>
-</projectDescription>
diff --git a/src/com.gluster.storage.management.core/.settings/org.eclipse.jdt.core.prefs b/src/com.gluster.storage.management.core/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index f22cedf1..00000000
--- a/src/com.gluster.storage.management.core/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,8 +0,0 @@
-#Wed Dec 22 11:18:01 IST 2010
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.compliance=1.6
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.6
diff --git a/src/com.gluster.storage.management.core/META-INF/MANIFEST.MF b/src/com.gluster.storage.management.core/META-INF/MANIFEST.MF
deleted file mode 100644
index 9ddbca69..00000000
--- a/src/com.gluster.storage.management.core/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,15 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Gluster Storage Platform Core
-Bundle-SymbolicName: com.gluster.storage.management.core
-Bundle-Version: 1.0.0
-Bundle-Vendor: GLUSTER
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Export-Package: com.gluster.storage.management.core.constants,
- com.gluster.storage.management.core.exceptions,
- com.gluster.storage.management.core.model,
- com.gluster.storage.management.core.response,
- com.gluster.storage.management.core.utils
-Require-Bundle: org.eclipse.core.runtime;bundle-version="3.6.0"
-Bundle-ClassPath: .
-Import-Package: com.gluster.storage.management.core.exceptions
diff --git a/src/com.gluster.storage.management.core/build.properties b/src/com.gluster.storage.management.core/build.properties
deleted file mode 100644
index 89d32a46..00000000
--- a/src/com.gluster.storage.management.core/build.properties
+++ /dev/null
@@ -1,7 +0,0 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- lib/
-src.includes = lib/,\
- src/
diff --git a/src/com.gluster.storage.management.core/junit/com/gluster/storage/management/core/utils/DateUtilTest.java b/src/com.gluster.storage.management.core/junit/com/gluster/storage/management/core/utils/DateUtilTest.java
deleted file mode 100644
index c19b75d2..00000000
--- a/src/com.gluster.storage.management.core/junit/com/gluster/storage/management/core/utils/DateUtilTest.java
+++ /dev/null
@@ -1,217 +0,0 @@
-package com.gluster.storage.management.core.utils;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.Date;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.gluster.storage.management.core.constants.CoreConstants;
-import com.gluster.storage.management.core.exceptions.GlusterRuntimeException;
-
-/**
- * The class <code>DateUtilTest</code> contains tests for the class <code>{@link DateUtil}</code>.
- *
- * @generatedBy CodePro at 9/27/11 12:31 PM
- * @author root
- * @version $Revision: 1.0 $
- */
-public class DateUtilTest {
-
- private Date date = DateUtil.getDate(2011, 9, 29, 11, 17, 38, 10);
-
- /**
- * Run the String dateToString(Date) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 9/27/11 12:31 PM
- */
- @Test
- public void testDateToString_1()
- throws Exception {
- String result = DateUtil.dateToString(date);
-
- assertEquals("09/29/2011 11:17:38", result);
- }
-
- /**
- * Run the String dateToString(Date,String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 9/27/11 12:31 PM
- */
- @Test
- public void testDateToString_2()
- throws Exception {
- String dateFormat = "";
-
- String result = DateUtil.dateToString(date, dateFormat);
- assertEquals("", result);
- }
-
- /**
- * Run the String dateToString(Date,String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 9/27/11 12:31 PM
- */
- @Test
- public void testDateToString_3()
- throws Exception {
- String dateFormat = CoreConstants.PURE_DATE_FORMAT;
-
- String result = DateUtil.dateToString(date, dateFormat);
- assertEquals("09/29/2011", result);
- }
-
- /**
- * Run the String formatDate(Date) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 9/27/11 12:31 PM
- */
- @Test
- public void testFormatDate_1()
- throws Exception {
- String result = DateUtil.formatDate(date);
-
- assertEquals("09/29/2011", result);
- }
-
- /**
- * Run the String formatDate(Date) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 9/27/11 12:31 PM
- */
- @Test
- public void testFormatDate_2()
- throws Exception {
- Date date1 = DateUtil.getDate(1965, 1, 12, 0, 0, 0, 0);
- String result = DateUtil.formatDate(date1);
- assertEquals("01/12/1965", result);
- }
-
- /**
- * Run the String formatTime(Date) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 9/27/11 12:31 PM
- */
- @Test
- public void testFormatTime_1()
- throws Exception {
- String result = DateUtil.formatTime(date);
-
- // add additional test code here
- assertEquals("11:17:38.010", result);
- }
-
- /**
- * Run the Date stringToDate(String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 9/27/11 12:31 PM
- */
- @Test(expected=GlusterRuntimeException.class)
- public void testStringToDate_1()
- throws Exception {
- DateUtil.stringToDate("");
- }
-
- /**
- * Run the Date stringToDate(String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 9/27/11 12:31 PM
- */
- @Test(expected=GlusterRuntimeException.class)
- public void testStringToDate_2()
- throws Exception {
- String testDate = "09/29/2011";
- DateUtil.stringToDate(testDate);
- }
-
- /**
- * Run the Date stringToDate(String,String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 9/27/11 12:31 PM
- */
- @Test
- public void testStringToDate_3()
- throws Exception {
- String dateFormat = "MM/dd/yyyy";
- String input = "09/29/2011"; // MM/dd/yyyy HH:mm:ss
- Date expectedDate = DateUtil.getDate(2011, 9, 29, 0, 0, 0, 0);
-
- Date result = DateUtil.stringToDate(input, dateFormat);
- assertEquals(expectedDate, result);
- }
-
- /**
- * Run the Date stringToDate(String,String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 9/27/11 12:31 PM
- */
- @Test(expected = GlusterRuntimeException.class)
- public void testStringToDate_4()
- throws Exception {
- String inputDate = "";
- String dateFormat = "";
-
- DateUtil.stringToDate(inputDate, dateFormat);
- }
-
- /**
- * Perform pre-test initialization.
- *
- * @throws Exception
- * if the initialization fails for some reason
- *
- * @generatedBy CodePro at 9/27/11 12:31 PM
- */
- @Before
- public void setUp()
- throws Exception {
- // add additional set up code here
- }
-
- /**
- * Perform post-test clean-up.
- *
- * @throws Exception
- * if the clean-up fails for some reason
- *
- * @generatedBy CodePro at 9/27/11 12:31 PM
- */
- @After
- public void tearDown()
- throws Exception {
- // Add additional tear down code here
- }
-
- /**
- * Launch the test.
- *
- * @param args the command line arguments
- *
- * @generatedBy CodePro at 9/27/11 12:31 PM
- */
- public static void main(String[] args) {
- new org.junit.runner.JUnitCore().run(DateUtilTest.class);
- }
-} \ No newline at end of file
diff --git a/src/com.gluster.storage.management.core/junit/com/gluster/storage/management/core/utils/FileUtilTest.java b/src/com.gluster.storage.management.core/junit/com/gluster/storage/management/core/utils/FileUtilTest.java
deleted file mode 100644
index 9302619e..00000000
--- a/src/com.gluster.storage.management.core/junit/com/gluster/storage/management/core/utils/FileUtilTest.java
+++ /dev/null
@@ -1,481 +0,0 @@
-package com.gluster.storage.management.core.utils;
-
-import static org.junit.Assert.*;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.Writer;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.gluster.storage.management.core.exceptions.GlusterRuntimeException;
-
-
-/**
- * The class <code>FileUtilTest</code> contains tests for the class <code>{@link FileUtil}</code>.
- *
- * @generatedBy CodePro at 9/29/11 2:39 PM
- * @author root
- * @version $Revision: 1.0 $
- */
-public class FileUtilTest {
-
-
- private static final String TEST_FILE_PATH = FileUtil.getTempDirName() + "/test.txt";
- private static final String TEST_FILE_CONTENT = "Welcome to Gluster Storage Management console.";
-
-
- /**
- * To write the text into given file.
- *
- * @generatedBy
- */
- private boolean writeToFile(String fileName, String text) {
- try {
- Writer output = null;
- File file = new File(fileName);
- output = new BufferedWriter(new FileWriter(file));
- output.write(text);
- output.close();
- return true;
- } catch (Exception e) {
- return false;
- }
- }
-
- private boolean createNestedDir(String path) {
- File file = new File(path);
- return file.mkdirs();
- }
-
- private boolean createEmptyFile(String fileName) {
- File file = new File(fileName);
- if (file.exists()) {
- return true;
- }
-
- try {
- return file.createNewFile();
- } catch (IOException e) {
- return false;
- }
- }
-
- /**
- * Run the File createTempDir() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 9/29/11 2:39 PM
- */
- @Test
- public void testCreateTempDir_1()
- throws Exception {
-
- File result = FileUtil.createTempDir();
-
- assertNotNull(result);
- assertTrue(File.class.equals(result.getClass()));
- }
-
- /**
- * Run the File createTempDir() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 9/29/11 2:39 PM
- */
- @Test
- public void testCreateTempDir_2()
- throws Exception {
-
- File result1 = FileUtil.createTempDir();
- File result2 = FileUtil.createTempDir();
-
- assertNotSame(result1, result2);
- }
-
-
- /**
- * Run the void createTextFile(String,String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 9/29/11 2:39 PM
- */
- @Test(expected=GlusterRuntimeException.class)
- public void testCreateTextFile_1()
- throws Exception {
- String fileName = "";
- String contents = "";
- FileUtil.createTextFile(fileName, contents);
- }
-
- /**
- * Run the String getTempDirName() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 9/29/11 2:39 PM
- */
- @Test
- public void testGetTempDirName_1()
- throws Exception {
- String result = FileUtil.getTempDirName();
-
- // while running on linux
- assertEquals("/tmp", result);
- }
-
- /**
- * Run the byte[] readFileAsByteArray(File) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 9/29/11 2:39 PM
- */
-
- @Test(expected=GlusterRuntimeException.class)
- public void testReadFileAsByteArray_1()
- throws Exception {
- File file = new File("");
-
- byte[] result = FileUtil.readFileAsByteArray(file);
- }
-
- /**
- * Run the byte[] readFileAsByteArray(File) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 9/29/11 2:39 PM
- */
- @Test
- public void testReadFileAsByteArray_2()
- throws Exception {
- File file = new File(TEST_FILE_PATH);
-
- byte[] result = FileUtil.readFileAsByteArray(file);
- assertNotNull(result);
- assertTrue(result instanceof byte[]);
- assertTrue(TEST_FILE_CONTENT.equals(new String(result)));
- }
-
-
- /**
- * Run the String readFileAsString(File) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 9/29/11 2:39 PM
- */
-
- @Test(expected=GlusterRuntimeException.class)
- public void testReadFileAsString_1()
- throws Exception {
- File file = new File("");
-
- FileUtil.readFileAsString(file);
- }
-
-
- /**
- * Run the String readFileAsString(File) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 9/29/11 2:39 PM
- */
- @Test
- public void testReadFileAsString_2()
- throws Exception {
- File file = new File(TEST_FILE_PATH);
- String result = FileUtil.readFileAsString(file);
-
- assertNotNull(result);
- assertTrue(result instanceof String);
- assertTrue(result.equals(TEST_FILE_CONTENT));
- }
-
- /**
- * Run the void recursiveDelete(File) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 9/29/11 2:39 PM
- */
- @Test
- public void testRecursiveDelete_1()
- throws Exception {
-
- //Delete empty directories recursively
- File fileOrDir = new File(FileUtil.getTempDirName() + "/rd");
-
- FileUtil.recursiveDelete(fileOrDir);
- assertTrue(!fileOrDir.exists());
- }
-
- /**
- * Run the void recursiveDelete(File) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 9/29/11 2:39 PM
- */
-
- @Test(expected=GlusterRuntimeException.class)
- public void testRecursiveDelete_2()
- throws Exception {
- //Delete directories recursively (with some files)
- File fileOrDir = new File(FileUtil.getTempDirName() + "/rdx");
-
- FileUtil.recursiveDelete(fileOrDir);
- assertTrue(!fileOrDir.exists());
- }
-
- /**
- * Run the void recursiveDelete(File) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 9/29/11 2:39 PM
- */
- @Test
- public void testRecursiveDelete_3()
- throws Exception {
- File fileOrDir = new File(FileUtil.getTempDirName() + "/rd");
- FileUtil.recursiveDelete(fileOrDir);
- assertTrue(!fileOrDir.exists());
- }
-
- /**
- * Run the void recursiveDelete(File) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 9/29/11 2:39 PM
- */
- @Test
- public void testRecursiveDelete_4()
- throws Exception {
- File file = new File(FileUtil.getTempDirName() + "/rd/b/bc/mydoc.txt");
- assertTrue(!file.exists());
-
- file = new File(FileUtil.getTempDirName() + "/rd//b/bc");
- assertTrue(!file.exists());
- }
-
- /**
- * Run the void recursiveDelete(File) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 9/29/11 2:39 PM
- */
- @Test(expected=GlusterRuntimeException.class)
- public void testRecursiveDelete_5()
- throws Exception {
- File fileOrDir = new File(FileUtil.getTempDirName() + "/rd/*"); //Wild cards
- FileUtil.recursiveDelete(fileOrDir);
- }
-
-
- /**
- * Run the void recursiveDelete(File) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 9/29/11 2:39 PM
- */
- @Test(expected=GlusterRuntimeException.class)
- public void testRecursiveDelete_6()
- throws Exception {
- File fileOrDir = new File(FileUtil.getTempDirName() + "/abcxyz");
- FileUtil.recursiveDelete(fileOrDir);
- }
-
- /**
- * Run the void renameFile(String,String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 9/29/11 2:39 PM
- */
-
- @Test(expected=GlusterRuntimeException.class)
- public void testRenameFile_1()
- throws Exception {
- String fromPath = FileUtil.getTempDirName() + "/test.txt";
- new File(fromPath).createNewFile();
- String toPath = "~/abc.txt"; // Relative path
-
- FileUtil.renameFile(fromPath, toPath);
- assertTrue(!new File(fromPath).exists());
- assertTrue(new File(toPath).exists());
- }
-
- /**
- * Run the void renameFile(String,String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 9/29/11 2:39 PM
- */
- @Test
- public void testRenameFile_2()
- throws Exception {
- String fromPath = FileUtil.getTempDirName() + "/test.txt";
- new File(fromPath).createNewFile();
-
- String toPath = FileUtil.getTempDirName() + "/abc.txt"; // Absolute path example
- FileUtil.renameFile(fromPath, toPath);
- assertTrue(!new File(fromPath).exists());
- assertTrue(new File(toPath).exists());
- }
-
- @Test
- public void testRenameFile_3()
- throws Exception {
- String fromPath = FileUtil.getTempDirName() + "/test.txt";
- new File(fromPath).createNewFile();
-
- String toPath = FileUtil.getTempDirName() + "/renamefile.txt";
- FileUtil.renameFile(fromPath, toPath);
- assertTrue(!new File(fromPath).exists());
- assertTrue(new File(toPath).exists());
- }
-
- /**
- * Perform pre-test initialization.
- *
- * @throws Exception
- * if the initialization fails for some reason
- *
- * @generatedBy CodePro at 9/29/11 2:39 PM
- */
- @Before
- public void setUp()
- throws Exception {
-
- // testReadFileAsByteArray_2()
- if (!writeToFile(TEST_FILE_PATH, TEST_FILE_CONTENT)) {
- fail("Setup: Text file creation error!");
- }
-
- // testRecursiveDelete_1()
- if (!createNestedDir(FileUtil.getTempDirName() + "/rd/b/c/d")) {
- createEmptyFile(FileUtil.getTempDirName() + "/rd/b/mydoc.txt");
- createEmptyFile(FileUtil.getTempDirName() + "/rd/b/songs.mp3");
- createEmptyFile(FileUtil.getTempDirName() + "/rd/b/mysetup.cfg");
-
- createEmptyFile(FileUtil.getTempDirName() + "/rd/b/bc/mydoc.txt");
- createEmptyFile(FileUtil.getTempDirName() + "/rd/songs.mp3");
- createEmptyFile(FileUtil.getTempDirName() + "/rd/b/bc/mysetup.cfg");
-
- createEmptyFile(FileUtil.getTempDirName() + "/rd//b/mydoc.txt");
- createEmptyFile(FileUtil.getTempDirName() + "/rd/b/bc/songs.mp3");
-
- }
-
- if (! createEmptyFile(FileUtil.getTempDirName() + "/renamefile.txt") ) {
- fail("Failed to create file [/renamefile.txt]");
- }
- }
-
- /**
- * Perform post-test clean-up.
- *
- * @throws Exception
- * if the clean-up fails for some reason
- *
- * @generatedBy CodePro at 9/29/11 2:39 PM
- */
- @After
- public void tearDown()
- throws Exception {
- File file = new File(TEST_FILE_PATH);
- file.delete();
- file = new File(FileUtil.getTempDirName() + "/rd/b/c/d");
- if (file.exists()) {
- file.delete();
- }
-
- file = new File(FileUtil.getTempDirName() + "/rd/b/c");
- if (file.exists()) {
- file.delete();
- }
-
- file = new File(FileUtil.getTempDirName() + "/rd/b/mydoc.txt");
- if (file.exists()) {
- file.delete();
- }
- file = new File(FileUtil.getTempDirName() + "/rd/b/songs.mp3");
- if (file.exists()) {
- file.delete();
- }
- file = new File(FileUtil.getTempDirName() + "/rd/b/mysetup.cfg");
- if (file.exists()) {
- file.delete();
- }
-
- file = new File(FileUtil.getTempDirName() + "/rd/b/bc/mydoc.txt");
- if (file.exists()) {
- file.delete();
- }
- file = new File(FileUtil.getTempDirName() + "/rd/b/bc/mysetup.cfg");
- if (file.exists()) {
- file.delete();
- }
- file = new File(FileUtil.getTempDirName() + "/rd/b/bc/songs.mp3");
- if (file.exists()) {
- file.delete();
- }
-
- file = new File(FileUtil.getTempDirName() + "/rd/b/bc");
- if (file.exists()) {
- file.delete();
- }
-
- file = new File(FileUtil.getTempDirName() + "/rd/b");
- if (file.exists()) {
- file.delete();
- }
-
- file = new File(FileUtil.getTempDirName() + "/rd");
- if (file.exists()) {
- file.delete();
- }
-
- file = new File(FileUtil.getTempDirName() + "/abc.txt");
- if (file.exists()) {
- file.delete();
- }
- file = new File("~/abc.txt");
- if (file.exists()) {
- file.delete();
- }
- file = new File(FileUtil.getTempDirName() + "/test.txt");
- if (file.exists()) {
- file.delete();
- }
- file = new File(FileUtil.getTempDirName() + "/renamefile.txt");
- if (file.exists()) {
- file.delete();
- }
- }
-
- /**
- * Launch the test.
- *
- * @param args the command line arguments
- *
- * @generatedBy CodePro at 9/29/11 2:39 PM
- */
- public static void main(String[] args) {
- new org.junit.runner.JUnitCore().run(FileUtilTest.class);
- }
-} \ No newline at end of file
diff --git a/src/com.gluster.storage.management.core/junit/com/gluster/storage/management/core/utils/StringUtilTest.java b/src/com.gluster.storage.management.core/junit/com/gluster/storage/management/core/utils/StringUtilTest.java
deleted file mode 100644
index dc8c6c80..00000000
--- a/src/com.gluster.storage.management.core/junit/com/gluster/storage/management/core/utils/StringUtilTest.java
+++ /dev/null
@@ -1,309 +0,0 @@
-package com.gluster.storage.management.core.utils;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-
-/**
- * The class <code>StringUtilTest</code> contains tests for the class <code>{@link StringUtil}</code>.
- *
- * @generatedBy CodePro at 21/9/11 4:53 PM
- * @author root
- * @version $Revision: 1.0 $
- */
-public class StringUtilTest {
- public enum Season { WINTER, SPRING, SUMMER, FALL };
- /**
- * Run the String collectionToString(Collection<? extends Object>,String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 21/9/11 4:53 PM
- */
- @Test
- public void testCollectionToString_1()
- throws Exception {
- List<String> string = new ArrayList<String>();
- string.add("test string");
- String delimiter = "";
-
- String result = StringUtil.collectionToString(string, delimiter);
- assertEquals("test string", result);
- }
-
- /**
- * Run the String collectionToString(Collection<? extends Object>,String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 21/9/11 4:53 PM
- */
- @Test
- public void testCollectionToString_2()
- throws Exception {
- List<String> string = new ArrayList<String>();
- string.add("test string");
- string.add("welcome to world");
- String delimiter = "::";
-
- String result = StringUtil.collectionToString(string, delimiter);
-
- assertEquals("test string::welcome to world", result);
- }
-
- /**
- * Run the String collectionToString(Collection<? extends Object>,String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 21/9/11 4:53 PM
- */
- @Test
- public void testCollectionToString_3()
- throws Exception {
- List<String> string = new ArrayList<String>();
- string.add("test ## string");
- string.add("java world");
- String delimiter = "##";
-
- String result = StringUtil.collectionToString(string, delimiter);
- assertEquals("test ## string##java world", result);
- }
-
- /**
- * Run the String collectionToString(Collection<? extends Object>,String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 21/9/11 4:53 PM
- */
- @Test
- public void testCollectionToString_4()
- throws Exception {
- List<String> string = new ArrayList<String>();
- String delimiter = "";
-
- String result = StringUtil.collectionToString(string, delimiter);
- assertEquals("", result);
- }
-
- /**
- * Run the List<String> enumToArray(T[]) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 21/9/11 4:53 PM
- */
- @Test
- public void testEnumToArray_1()
- throws Exception {
-
- String[] expected = new String[] {"WINTER", "SPRING", "SUMMER", "FALL"};
- List<String> result = StringUtil.enumToArray(Season.values());
-
- assertNotNull(result);
- assertEquals(4, result.size());
- }
-
- /**
- * Run the List<String> extractList(String,String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 21/9/11 4:53 PM
- */
- @Test
- public void testExtractList_1()
- throws Exception {
- String input = "This is test message";
- String delim = " ";
-
- List<String> result = StringUtil.extractList(input, delim);
-
- assertNotNull(result);
- assertEquals(4, result.size());
- }
-
- /**
- * Run the List<String> extractList(String,String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 21/9/11 4:53 PM
- */
- @Test
- public void testExtractList_2()
- throws Exception {
- String input = "welcome#to#java#world";
- String delim = "#";
-
- List<String> result = StringUtil.extractList(input, delim);
-
- assertNotNull(result);
- assertEquals(4, result.size());
- }
-
- /**
- * Run the List<String> extractList(String,String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 21/9/11 4:53 PM
- */
- @Test
- public void testExtractList_3()
- throws Exception {
- String input = "list$to%string";
- String delim = "%";
-
- List<String> result = StringUtil.extractList(input, delim);
-
- assertNotNull(result);
- assertEquals(2, result.size());
- }
-
- /**
- * Run the Map<String, String> extractMap(String,String,String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 21/9/11 4:53 PM
- */
- @Test
- public void testExtractMap_1()
- throws Exception {
- String input = "k1=v1,k2=v2,k3=v3";
- String majorDelim = ",";
- String minorDelim = "=";
-
- Map<String, String> result = StringUtil.extractMap(input, majorDelim, minorDelim);
-
- // add additional test code here
- assertNotNull(result);
- assertEquals(3, result.size());
- }
-
- /**
- * Run the Map<String, String> extractMap(String,String,String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 21/9/11 4:53 PM
- */
- @Test
- public void testExtractMap_2()
- throws Exception {
- String input = "k1=>v1&k2=>v2&k3=>v3";
- String majorDelim = "&";
- String minorDelim = "=>";
-
- Map<String, String> result = StringUtil.extractMap(input, majorDelim, minorDelim);
-
- // add additional test code here
- assertNotNull(result);
- assertEquals(3, result.size());
- }
-
- /**
- * Run the boolean filterString(String,String,boolean) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 21/9/11 4:53 PM
- */
- @Test
- public void testFilterString_1()
- throws Exception {
- String sourceString = "This is java program";
- String filterString = "Java";
- boolean caseSensitive = true;
-
- boolean result = StringUtil.filterString(sourceString, filterString, caseSensitive);
-
- assertEquals(false, result);
- }
-
- /**
- * Run the boolean filterString(String,String,boolean) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 21/9/11 4:53 PM
- */
- @Test
- public void testFilterString_2()
- throws Exception {
- String sourceString = "This is java program";
- String filterString = "Java";
- boolean caseSensitive = false;
-
- boolean result = StringUtil.filterString(sourceString, filterString, caseSensitive);
-
- assertEquals(true, result);
- }
-
- /**
- * Run the String removeSpaces(String) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 21/9/11 4:53 PM
- */
- @Test
- public void testRemoveSpaces_1()
- throws Exception {
- String str = "this is test string";
-
- String result = StringUtil.removeSpaces(str);
-
- // add additional test code here
- assertEquals("thisisteststring", result);
- }
-
- /**
- * Perform pre-test initialization.
- *
- * @throws Exception
- * if the initialization fails for some reason
- *
- * @generatedBy CodePro at 21/9/11 4:53 PM
- */
- @Before
- public void setUp()
- throws Exception {
- // add additional set up code here
- }
-
- /**
- * Perform post-test clean-up.
- *
- * @throws Exception
- * if the clean-up fails for some reason
- *
- * @generatedBy CodePro at 21/9/11 4:53 PM
- */
- @After
- public void tearDown()
- throws Exception {
- // Add additional tear down code here
- }
-
- /**
- * Launch the test.
- *
- * @param args the command line arguments
- *
- * @generatedBy CodePro at 21/9/11 4:53 PM
- */
- public static void main(String[] args) {
- new org.junit.runner.JUnitCore().run(StringUtilTest.class);
- }
-} \ No newline at end of file
diff --git a/src/com.gluster.storage.management.core/junit/core.junit.launch b/src/com.gluster.storage.management.core/junit/core.junit.launch
deleted file mode 100644
index 0bf6dc30..00000000
--- a/src/com.gluster.storage.management.core/junit/core.junit.launch
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/com.gluster.storage.management.core"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="4"/>
-</listAttribute>
-<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=com.gluster.storage.management.core"/>
-<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
-<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
-<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.gluster.storage.management.core"/>
-</launchConfiguration>
diff --git a/src/com.gluster.storage.management.core/junit/test/test.txt b/src/com.gluster.storage.management.core/junit/test/test.txt
deleted file mode 100644
index 267ce144..00000000
--- a/src/com.gluster.storage.management.core/junit/test/test.txt
+++ /dev/null
@@ -1 +0,0 @@
-Test Resource \ No newline at end of file
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/constants/CoreConstants.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/constants/CoreConstants.java
deleted file mode 100644
index 42f0e7a9..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/constants/CoreConstants.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package com.gluster.storage.management.core.constants;
-
-
-/**
- *
- */
-public class CoreConstants {
- public static final String NEWLINE = System.getProperty("line.separator");
- public static final String FILE_SEPARATOR = System.getProperty("file.separator");
- public static final String USER_HOME = System.getProperty("user.home");
- public static final String ENCODING_UTF8 = "UTF-8";
- public static final String ALL = "ALL";
- public static final String DATE_WITH_TIME_FORMAT = "MM/dd/yyyy HH:mm:ss";
- public static final String PURE_DATE_FORMAT = "MM/dd/yyyy";
- public static final String PURE_TIME_FORMAT = "HH:mm:ss.SSS";
- public static final String NA = "NA";
- public static final String DEFAULT_PASSWORD = "syst3m";
- public static final String OFFLINE = "OFFLINE";
- public static final String ONLINE = "ONLINE";
- public static final String UNKNOWN = "UNKNOWN";
- public static final String RUNNING_TASKS = "Tasks";
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/constants/GlusterConstants.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/constants/GlusterConstants.java
deleted file mode 100644
index cbc51b10..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/constants/GlusterConstants.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package com.gluster.storage.management.core.constants;
-
-import java.util.List;
-
-import com.gluster.storage.management.core.utils.StringUtil;
-
-/**
- *
- */
-public class GlusterConstants {
- public enum VOLUME_LOG_LEVELS {
- EMERGENCY, ALERT, CRITICAL, ERROR, WARNING, NOTICE, INFO, DEBUG, TRACE
- };
-
- public static final List<String> VOLUME_LOG_LEVELS_ARR = StringUtil.enumToArray(VOLUME_LOG_LEVELS.values());
- public static final String FSTYPE_DEFAULT = "default";
- public static final String FSTYPE_EXT_3 = "ext3";
- public static final String FSTYPE_EXT_4 = "ext4";
- public static final String FSTYPE_XFS = "xfs";
-
- public static final String ON = "on";
- public static final String OFF = "off";
- public static final String NONE = "none";
-
- public static final String STATS_PERIOD_1DAY = "1d";
- public static final String STATS_PERIOD_1WEEK = "1w";
- public static final String STATS_PERIOD_1MONTH = "1m";
- public static final String STATS_PERIOD_1YEAR = "1y";
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/constants/RESTConstants.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/constants/RESTConstants.java
deleted file mode 100644
index ea0e723f..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/constants/RESTConstants.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/**
- * RESTConstants.java
- *
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- */
-package com.gluster.storage.management.core.constants;
-
-/**
- * All constants related to the Gluster REST server and client
- */
-public class RESTConstants {
- // REST Resource paths
- public static final String RESOURCE_PATH_USERS = "/users";
- public static final String RESOURCE_PATH_CLUSTERS = "/clusters";
- public static final String RESOURCE_PATH_DISCOVERED_SERVERS = "/discoveredservers";
- public static final String RESOURCE_PATH_KEYS = "/keys";
-
- // REST Resource names
- public static final String RESOURCE_VOLUMES = "volumes";
- public static final String RESOURCE_DEFAULT_OPTIONS = "options";
- public static final String RESOURCE_OPTIONS = "options";
- public static final String RESOURCE_LOGS = "logs";
- public static final String RESOURCE_DOWNLOAD = "download";
- public static final String RESOURCE_BRICKS = "bricks";
- public static final String RESOURCE_DISKS = "disks";
- public static final String RESOURCE_ALERTS = "alerts";
- public static final String RESOURCE_SERVERS = "servers";
- public static final String RESOURCE_TASKS = "tasks";
- public static final String RESOURCE_KEYS = "keys";
- public static final String RESOURCE_STATISTICS = "statistics";
- public static final String RESOURCE_USERS = "users";
-
- public static final String TASK_START = "start";
- public static final String TASK_PAUSE = "pause";
- public static final String TASK_RESUME = "resume";
- public static final String TASK_STOP = "stop";
- public static final String TASK_COMMIT = "commit";
- public static final String TASK_STATUS = "status";
- public static final String TASK_DELETE = "delete";
- public static final String TASK_LOG_ROTATE = "logRotate";
- public static final String TASK_REBALANCE_START = "rebalanceStart";
- public static final String TASK_REBALANCE_STATUS = "rebalanceStatus";
- public static final String TASK_REBALANCE_STOP = "rebalanceStop";
-
- public static final String FORM_PARAM_VOLUME_NAME = "volumeName";
- public static final String FORM_PARAM_VOLUME_TYPE = "volumeType";
- public static final String FORM_PARAM_TRANSPORT_TYPE = "transportType";
- public static final String FORM_PARAM_REPLICA_COUNT = "replicaCount";
- public static final String FORM_PARAM_STRIPE_COUNT = "stripeCount";
- public static final String FORM_PARAM_BRICKS = "bricks";
- public static final String FORM_PARAM_ACCESS_PROTOCOLS = "accessProtocols";
- public static final String FORM_PARAM_VOLUME_OPTIONS = "options";
- public static final String FORM_PARAM_FSTYPE = "fsType";
- public static final String FORM_PARAM_CIFS_ENABLE = "enableCifs";
- public static final String FORM_PARAM_CIFS_USERS = "cifsUsers";
- public static final String FORM_PARAM_CIFS_CONFIG = "cifsConfig";
- public static final String FORM_PARAM_LOG_ROTATE = "logRotate";
-
- public static final String FORM_PARAM_CLUSTER_NAME = "clusterName";
- public static final String FORM_PARAM_SERVER_NAME = "serverName";
- public static final String FORM_PARAM_DISKS = "disks";
- public static final String FORM_PARAM_OPERATION = "operation";
- public static final String FORM_PARAM_VALUE_STATUS = "status";
- public static final String FORM_PARAM_OPTION_KEY = "key";
- public static final String FORM_PARAM_OPTION_VALUE = "value";
- public static final String FORM_PARAM_SOURCE = "source";
- public static final String FORM_PARAM_TARGET = "target";
- public static final String FORM_PARAM_AUTO_COMMIT = "autoCommit";
- public static final String FORM_PARAM_FIX_LAYOUT = "fixLayout";
- public static final String FORM_PARAM_MIGRATE_DATA = "migrateData";
- public static final String FORM_PARAM_FORCED_DATA_MIGRATE = "forcedDataMigrate";
- public static final String FORM_PARAM_OLD_PASSWORD = "oldPassword";
- public static final String FORM_PARAM_NEW_PASSWORD = "newPassword";
- public static final String FORM_PARAM_FORCE = "force";
-
- public static final String PATH_PARAM_FORMAT = "format";
- public static final String PATH_PARAM_VOLUME_NAME = "volumeName";
- public static final String PATH_PARAM_CLUSTER_NAME = "clusterName";
- public static final String PATH_PARAM_SERVER_NAME = "serverName";
- public static final String PATH_PARAM_TASK_ID = "taskId";
- public static final String PATH_PARAM_DISK_NAME = "diskName";
- public static final String PATH_PARAM_USER = "user";
-
- public static final String QUERY_PARAM_BRICK_NAME = "brickName";
- public static final String QUERY_PARAM_DISKS = "disks";
- public static final String QUERY_PARAM_BRICKS = "bricks";
- public static final String QUERY_PARAM_LINE_COUNT = "lineCount";
- public static final String QUERY_PARAM_VOLUME_NAME = "volumeName";
- public static final String QUERY_PARAM_DELETE_OPTION = "deleteData";
- public static final String QUERY_PARAM_LOG_SEVERITY = "severity";
- public static final String QUERY_PARAM_FROM_TIMESTAMP = "fromTimeStamp";
- public static final String QUERY_PARAM_TO_TIMESTAMP = "toTimeStamp";
- public static final String QUERY_PARAM_DOWNLOAD = "download";
- public static final String QUERY_PARAM_SERVER_NAME = "serverName";
- public static final String QUERY_PARAM_DETAILS = "details";
- public static final String QUERY_PARAM_TYPE = "type";
- public static final String QUERY_PARAM_PERIOD = "period";
- public static final String QUERY_PARAM_INTERFACE = "interface";
- public static final String QUERY_PARAM_MAX_COUNT = "maxCount";
- public static final String QUERY_PARAM_NEXT_TO = "nextTo";
-
- public static final String STATISTICS_TYPE_CPU = "cpu";
- public static final String STATISTICS_TYPE_NETWORK = "network";
- public static final String STATISTICS_TYPE_MEMORY = "memory";
-
- public static final String FORMAT_XML = "xml";
- public static final String FORMAT_JSON = "json";
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/exceptions/ConnectionException.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/exceptions/ConnectionException.java
deleted file mode 100644
index ec19ffd8..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/exceptions/ConnectionException.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package com.gluster.storage.management.core.exceptions;
-
-/**
- *
- */
-public class ConnectionException extends GlusterRuntimeException {
-
- private static final long serialVersionUID = 1L;
-
-
- public ConnectionException(String message) {
- super(message);
- }
-
- public ConnectionException(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/exceptions/GlusterRuntimeException.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/exceptions/GlusterRuntimeException.java
deleted file mode 100644
index e7e604fc..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/exceptions/GlusterRuntimeException.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package com.gluster.storage.management.core.exceptions;
-
-public class GlusterRuntimeException extends RuntimeException {
- private static final long serialVersionUID = 1L;
-
- public GlusterRuntimeException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public GlusterRuntimeException(String message) {
- super(message);
- }
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/exceptions/GlusterValidationException.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/exceptions/GlusterValidationException.java
deleted file mode 100644
index ca5e01f8..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/exceptions/GlusterValidationException.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package com.gluster.storage.management.core.exceptions;
-
-public class GlusterValidationException extends GlusterRuntimeException {
- private static final long serialVersionUID = 1L;
-
- public GlusterValidationException(String message) {
- super(message);
- }
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Alert.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Alert.java
deleted file mode 100644
index ceb3e77e..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Alert.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package com.gluster.storage.management.core.model;
-
-import org.eclipse.osgi.internal.signedcontent.Base64;
-
-public class Alert extends Entity {
-
- public enum ALERT_TYPES {
- CPU_USAGE_ALERT, MEMORY_USAGE_ALERT, DISK_USAGE_ALERT, OFFLINE_VOLUME_BRICKS_ALERT, OFFLINE_SERVERS_ALERT, OFFLINE_VOLUME_ALERT
- };
-
- public static final String[] ALERT_TYPE_STR = { "High CPU Usage", "High Memory Usage", "Low Disk Space",
- "Offline Brick", "Offline Server", "Offline Volume" };
-
- // protected String id;
- protected ALERT_TYPES type;
- protected String reference; // [for server- "Server", for Disk- "Server:disk", for volume- "Volume:Server:disk"]
- protected String message;
-
- public String getAlertType() {
- return ALERT_TYPE_STR[type.ordinal()];
- }
-
- public Alert() {
- }
-
- public Alert(ALERT_TYPES type, String reference, String Message) {
- setType(type);
- setReference(reference);
- setMessage(Message);
- setId(buildAlertId());
- }
-
- public String buildAlertId() {
- return Base64.encode((getAlertType() + "-" + getReference()).getBytes()).toString();
- }
-
- public String getId() {
- return getName();
- }
-
- public void setId(String id) {
- setName(id);
- }
-
- public ALERT_TYPES getType() {
- return type;
- }
-
- public void setType(ALERT_TYPES type) {
- this.type = type;
- }
-
- public String getReference() {
- return reference;
- }
-
- public void setReference(String reference) {
- this.reference = reference;
- }
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- public void copyFrom(Alert alert) {
- this.setId(alert.getId());
- this.setReference(alert.getReference());
- this.setType(alert.getType());
- this.setMessage(alert.getMessage());
- }
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Brick.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Brick.java
deleted file mode 100644
index 0b8ad6fd..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Brick.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package com.gluster.storage.management.core.model;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlTransient;
-
-import com.gluster.storage.management.core.utils.StringUtil;
-
-@XmlRootElement
-public class Brick extends Entity {
- public enum BRICK_STATUS {ONLINE, OFFLINE};
- private String[] BRICK_STATUS_STR = {"Online", "Offline"};
-
- private String serverName;
- // private String deviceName;
- private String brickDirectory;
- private BRICK_STATUS status;
-
- public Brick() {
- }
-
- @Override
- @XmlTransient
- public String getName() {
- return getQualifiedName();
- }
-
- public BRICK_STATUS getStatus() {
- return status;
- }
-
- public String getStatusStr() {
- return BRICK_STATUS_STR[getStatus().ordinal()];
- }
-
- public void setStatus(BRICK_STATUS status) {
- this.status = status;
- }
-
- public Brick(String serverName, BRICK_STATUS brickStatus, String brickDirectory) {
- setServerName(serverName);
- setStatus(brickStatus);
- // setDeviceName(deviceName);
- setBrickDirectory(brickDirectory);
- }
-
- public void setServerName(String serverName) {
- this.serverName = serverName;
- }
-
- public String getServerName() {
- return serverName;
- }
-
- public void setBrickDirectory(String brickDirectory) {
- this.brickDirectory = brickDirectory;
- }
-
- public String getBrickDirectory() {
- return brickDirectory;
- }
-
-// public void setDeviceName(String deviceName) {
-// this.deviceName = deviceName;
-// }
-
-// public String getDeviceName() {
-// return deviceName;
-// }
-
- public String getQualifiedName() {
- return serverName + ":" + brickDirectory;
- }
-
- public boolean filter(String filterString, boolean caseSensitive) {
- return StringUtil.filterString(getServerName() + getBrickDirectory() + getStatusStr(), filterString,
- caseSensitive);
- }
-
- @Override
- public String toString() {
- return getQualifiedName();
- }
-
- @Override
- public boolean equals(Object obj) {
- if(!(obj instanceof Brick)) {
- return false;
- }
-
- Brick brick = (Brick)obj;
- if(getQualifiedName().equals(brick.getQualifiedName()) && getStatus() == brick.getStatus()) {
- return true;
- }
-
- return false;
- }
-
- public void copyFrom(Brick newBrick) {
- setServerName(newBrick.getServerName());
- setBrickDirectory(newBrick.getBrickDirectory());
- // setDeviceName(newBrick.getDeviceName());
- setStatus(newBrick.getStatus());
- }
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Cluster.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Cluster.java
deleted file mode 100644
index e11199f6..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Cluster.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package com.gluster.storage.management.core.model;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlRootElement;
-
-@XmlRootElement(name="cluster")
-public class Cluster extends Entity {
- List<GlusterServer> servers = new ArrayList<GlusterServer>();
- List<Server> discoveredServers = new ArrayList<Server>();
- List<Volume> volumes = new ArrayList<Volume>();
- List<TaskInfo> taskInfoList = new ArrayList<TaskInfo>();
- List<Alert> alerts = new ArrayList<Alert>();
- ServerStats aggregatedCpuStats;
- ServerStats aggregatedNetworkStats;
-
- public Cluster() {
- }
-
- public List<GlusterServer> getServers() {
- return servers;
- }
-
- public void addServer(GlusterServer server) {
- servers.add(server);
- }
-
- public void removeServer(GlusterServer server) {
- servers.remove(server);
- }
-
- public void addDiscoveredServer(Server server) {
- discoveredServers.add(server);
- }
-
- public void removeDiscoveredServer(Server server) {
- discoveredServers.remove(server);
- }
-
- public void deleteVolume(Volume volume) {
- volumes.remove(volume);
- }
-
- public void setServers(List<GlusterServer> servers) {
- this.servers = servers;
- children.add(new EntityGroup<GlusterServer>("Servers", GlusterServer.class, this, servers));
- }
-
- public List<Server> getAutoDiscoveredServers() {
- return discoveredServers;
- }
-
- public void setAutoDiscoveredServers(List<Server> autoDiscoveredServers) {
- this.discoveredServers = autoDiscoveredServers;
- children.add(new EntityGroup<Server>("Discovered Servers", Server.class, this, autoDiscoveredServers));
- }
-
- @SuppressWarnings({ "unchecked", "rawtypes" })
- public <T extends Entity> EntityGroup<T> getEntityGroup(Class<T> type) {
- for(Entity entity : getChildren()) {
- if(entity instanceof EntityGroup && ((EntityGroup)entity).getEntityType() == type) {
- return (EntityGroup<T>)entity;
- }
- }
- return null;
- }
-
- public List<Volume> getVolumes() {
- return volumes;
- }
-
- public void setVolumes(List<Volume> volumes) {
- this.volumes = volumes;
- children.add(new EntityGroup<Volume>("Volumes", Volume.class, this, volumes));
- }
-
- public void addVolume(Volume volume) {
- this.volumes.add(volume);
- }
-
- public void updateVolume(String volumeName, List<Brick> bricks) {
- Volume volume = getVolume(volumeName);
- volume.setBricks(bricks);
- }
-
- public Cluster(String name, Entity parent) {
- super(name, parent);
- }
-
- public Cluster(String name, Entity parent, List<GlusterServer> servers, List<Volume> volumes) {
- super(name, parent);
- setServers(servers);
- setVolumes(volumes);
- }
-
- public List<TaskInfo> getTaskInfoList() {
- return taskInfoList;
- }
-
- public void setTaskInfoList(List<TaskInfo> taskInfoList) {
- this.taskInfoList = taskInfoList;
- }
-
- public void addTaskInfo(TaskInfo taskInfo) {
- this.taskInfoList.add(taskInfo);
- }
-
- public void removeTaskInfo(TaskInfo taskInfo) {
- this.taskInfoList.remove(taskInfo);
- }
-
- public List<Alert> getAlerts() {
- return alerts;
- }
-
- public void setAlerts(List<Alert> alerts) {
- this.alerts = alerts;
- }
-
- public void addAlert(Alert alert) {
- this.alerts.add(alert);
- }
-
- public void removeAlert(Alert alert) {
- this.alerts.remove(alert);
- }
-
- public double getTotalDiskSpace() {
- double totalDiskSpace = 0;
- for(GlusterServer server : getServers()) {
- totalDiskSpace += server.getTotalDiskSpace();
- }
- return totalDiskSpace;
- }
-
- public double getDiskSpaceInUse() {
- double diskSpaceInUse = 0;
- for(GlusterServer server : getServers()) {
- diskSpaceInUse += server.getDiskSpaceInUse();
- }
- return diskSpaceInUse;
- }
-
- public GlusterServer getServer(String serverName) {
- for(GlusterServer server : servers) {
- if (server.getName().equalsIgnoreCase(serverName) || server.getIpAddressesAsString().contains(serverName)) {
- return server;
- }
- }
- return null;
- }
-
- public Volume getVolume(String volumeName) {
- for (Volume volume : getVolumes() ) {
- if (volume.getName().equals(volumeName)) {
- return volume;
- }
- }
- return null;
- }
-
- public ServerStats getAggregatedCpuStats() {
- return aggregatedCpuStats;
- }
-
- public void setAggregatedCpuStats(ServerStats aggregatedCpuStats) {
- this.aggregatedCpuStats = aggregatedCpuStats;
- }
-
- public ServerStats getAggregatedNetworkStats() {
- return aggregatedNetworkStats;
- }
-
- public void setAggregatedNetworkStats(ServerStats aggregatedNetworkStats) {
- this.aggregatedNetworkStats = aggregatedNetworkStats;
- }
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/ClusterListener.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/ClusterListener.java
deleted file mode 100644
index eb8c191e..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/ClusterListener.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package com.gluster.storage.management.core.model;
-
-/**
- * Interface for a cluster listener. Every registered listener will be notified
- * on various events happening on the cluster.
- */
-public interface ClusterListener {
- public void discoveredServerAdded(Server server);
-
- public void discoveredServerRemoved(Server server);
-
- public void discoveredServerChanged(Server server, Event event);
-
- public void serverAdded(GlusterServer server);
-
- public void serverRemoved(GlusterServer server);
-
- public void serverChanged(GlusterServer server, Event event);
-
- public void volumeChanged(Volume volume, Event event);
-
- public void volumeCreated(Volume volume);
-
- public void volumeDeleted(Volume volume);
-
- public void taskAdded(TaskInfo taskInfo);
-
- public void taskRemoved(TaskInfo taskInfo);
-
- public void taskUpdated(TaskInfo taskInfo);
-
- public void alertsGenerated();
-
- public void aggregatedStatsChanged();
-
- public void alertRemoved(Alert alert);
-
- public void alertCreated(Alert alert);
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/ConnectionDetails.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/ConnectionDetails.java
deleted file mode 100644
index 9f66ba5b..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/ConnectionDetails.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package com.gluster.storage.management.core.model;
-
-/**
- * Class used for binding UI fields on login / password-change dialog boxes
- */
-public class ConnectionDetails {
- private String userId, password, newPassword, confirmNewPassword;
-
- public ConnectionDetails() {
-
- }
-
- public ConnectionDetails(String userId, String password) {
- this.userId = userId;
- this.password = password;
- this.confirmNewPassword = "";
- }
-
- public String getUserId() {
- return userId;
- }
-
- public String getPassword() {
- return password;
- }
-
- public void setPassword(String password) {
- this.password = password;
- }
-
- public void setNewPassword(String newPassword) {
- this.newPassword = newPassword;
- }
-
- public String getNewPassword() {
- return newPassword;
- }
-
- public void setConfirmNewPassword(String confirmNewPassword) {
- this.confirmNewPassword = confirmNewPassword;
- }
-
- public String getConfirmNewPassword() {
- return confirmNewPassword;
- }
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/DefaultClusterListener.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/DefaultClusterListener.java
deleted file mode 100644
index eb98090f..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/DefaultClusterListener.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package com.gluster.storage.management.core.model;
-
-/**
- * Default listener - doesn't do anything. Sub-class and override the method for
- * the event you want to handle.
- */
-public class DefaultClusterListener implements ClusterListener {
-
- @Override
- public void serverAdded(GlusterServer server) {
- modelChanged();
- }
-
- @Override
- public void serverRemoved(GlusterServer server) {
- modelChanged();
- }
-
- @Override
- public void serverChanged(GlusterServer server, Event event) {
- modelChanged();
- }
-
- @Override
- public void volumeChanged(Volume volume, Event event) {
- modelChanged();
- }
-
- @Override
- public void discoveredServerAdded(Server server) {
- modelChanged();
- }
-
- @Override
- public void discoveredServerRemoved(Server server) {
- modelChanged();
- }
-
- @Override
- public void volumeCreated(Volume volume) {
- modelChanged();
- }
-
- @Override
- public void volumeDeleted(Volume volume) {
- modelChanged();
- }
-
-
- @Override
- public void taskAdded(TaskInfo taskInfo) {
- modelChanged();
- }
-
-
- @Override
- public void taskRemoved(TaskInfo taskInfo) {
- modelChanged();
- }
-
-
- @Override
- public void taskUpdated(TaskInfo taskInfo) {
- modelChanged();
- }
-
- /**
- * This method is called by every other event method. Thus, if a view/listener is interested in performing the same
- * task on any change happening in the data model, it can simply override this method and implement the
- * logic. e.g. A view may simply refresh its tree/table viewer whenever the data model changes.
- */
- public void modelChanged() {
-
- }
-
- @Override
- public void discoveredServerChanged(Server server, Event event) {
- modelChanged();
- }
-
- @Override
- public void alertsGenerated() {
- modelChanged();
- }
-
- @Override
- public void aggregatedStatsChanged() {
- modelChanged();
- }
-
- @Override
- public void alertRemoved(Alert alert) {
- modelChanged();
- }
-
- @Override
- public void alertCreated(Alert alert) {
- modelChanged();
- }
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Device.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Device.java
deleted file mode 100644
index b0121213..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Device.java
+++ /dev/null
@@ -1,225 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package com.gluster.storage.management.core.model;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlTransient;
-
-import com.gluster.storage.management.core.utils.StringUtil;
-
-
-/**
- *
- */
-public class Device extends Entity {
- public enum DEVICE_STATUS {
- //TODO: Status "READY" to be removed after python script is changed accordingly
- INITIALIZED, UNINITIALIZED, INITIALIZING, IO_ERROR, UNKNOWN
- };
-
- public enum DEVICE_TYPE {
- DATA, BOOT, SWAP, UNKNOWN
- };
-
- private static final String[] DEVICE_STATUS_STR = { "Initialized", "Uninitialized", "Initializing", "I/O Error", "Unknown" };
- private static final String[] DEVICE_TYPE_STR = { "Data", "Boot", "Swap", "Unknown" };
-
- // type = data, boot, other
- private DEVICE_TYPE type;
-
- private String fsType;
- private String fsVersion;
-
- private String serverName;
- private String mountPoint;
-
- private Double space = 0.0;
- private Double spaceInUse = 0.0;
- private DEVICE_STATUS status;
-
- public Device() {
- }
-
- public Device(Server server, String name, String mountPoint, Double space, Double spaceInUse, DEVICE_STATUS status) {
- super(name, server);
- setServerName(server != null ? server.getName() : "");
- setMountPoint(mountPoint);
- setSpace(space);
- setSpaceInUse(spaceInUse);
- setStatus(status);
- }
-
- @XmlElement(name="size")
- public Double getSpace() {
- return space;
- }
-
- public Double getFreeSpace() {
- return (getSpace() - getSpaceInUse());
- }
-
- public void setSpace(Double space) {
- this.space = space;
- }
-
- public boolean isUninitialized() {
- return getStatus() == DEVICE_STATUS.UNINITIALIZED;
- }
-
- public boolean hasErrors() {
- return getStatus() == DEVICE_STATUS.IO_ERROR;
- }
-
- public boolean isInitialized() {
- return getStatus() == DEVICE_STATUS.INITIALIZED;
- }
-
- public boolean isReady() {
- return (getStatus() == DEVICE_STATUS.INITIALIZED && getType() == DEVICE_TYPE.DATA);
- }
-
- public DEVICE_STATUS getStatus() {
- return status;
- }
-
- public String getStatusStr() {
- if (getStatus() == null) {
- // Return as Unknown
- return DEVICE_STATUS_STR[DEVICE_STATUS.UNKNOWN.ordinal()];
- }
-
- if(isReady()) {
- return "Available";
- }
- return DEVICE_STATUS_STR[getStatus().ordinal()];
- }
-
- public void setStatus(DEVICE_STATUS status) {
- this.status = status;
- }
-
- public Double getSpaceInUse() {
- return spaceInUse;
- }
-
- public void setSpaceInUse(Double spaceInUse) {
- this.spaceInUse = spaceInUse;
- }
-
- @XmlTransient
- public String getServerName() {
- return serverName;
- }
-
- public void setServerName(String serverName) {
- this.serverName = serverName;
- }
-
- public void setMountPoint(String mountPoint) {
- this.mountPoint = mountPoint;
- }
-
- public String getMountPoint() {
- return mountPoint;
- }
-
- public DEVICE_TYPE getType() {
- return type;
- }
-
- public String getTypeStr() {
- return DEVICE_TYPE_STR[type.ordinal()];
- }
-
- public void setType(DEVICE_TYPE diskType) {
- this.type = diskType;
- }
-
- public String getFsType() {
- return fsType;
- }
-
- public void setFsType(String fsType) {
- this.fsType = fsType;
- }
-
- public String getFsVersion() {
- return fsVersion;
- }
-
- public void setFsVersion(String fsVersion) {
- this.fsVersion = fsVersion;
- }
-
- @Override
- public boolean filter(String filterString, boolean caseSensitive) {
- return StringUtil.filterString(getServerName() + getName() + getStatusStr() + getSpace() + getFreeSpace()
- + getType(), filterString, caseSensitive);
- }
-
- public String getQualifiedName() {
- return getServerName() + ":" + getName();
- }
-
- public String getQualifiedBrickName(String volumeName) {
- return getServerName() + ":" + getMountPoint() + "/" + volumeName;
- }
-
- @Override
- public boolean equals(Object obj) {
- if(this == obj) {
- return true;
- }
-
- if(!(obj instanceof Device)) {
- return false;
- }
-
- Device device = (Device)obj;
-
- String oldMountPoint = (getMountPoint() == null ? "" : getMountPoint());
- String oldFsType = (getFsType() == null ? "" : getFsType());
- String oldFsVersion = (getFsVersion() == null ? "" : getFsVersion());
-
- String newMountPoint = (device.getMountPoint() == null ? "" : getMountPoint());
- String newFsType = (device.getFsType() == null ? "" : getFsType());
- String newFsVersion = (device.getFsVersion() == null ? "" : getFsVersion());
-
- if (getName().equals(device.getName()) && getServerName().equals(device.getServerName())
- && oldMountPoint.equals(newMountPoint) && getStatus() == device.getStatus()
- && getSpace().equals(device.getSpace()) && getSpaceInUse().equals(device.getSpaceInUse())
- && oldFsType.equals(newFsType) && oldFsVersion.equals(newFsVersion)
- && getType() == device.getType()) {
- return true;
- }
-
- return false;
- }
-
- public void copyFrom(Device newDevice) {
- setName(newDevice.getName());
- setMountPoint(newDevice.getMountPoint());
- setServerName(newDevice.getServerName());
- setStatus(newDevice.getStatus());
- setFsType(newDevice.getFsType());
- setType(newDevice.getType());
- setSpace(newDevice.getSpace());
- setSpaceInUse(newDevice.getSpaceInUse());
- }
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Disk.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Disk.java
deleted file mode 100644
index 4b159f37..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Disk.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package com.gluster.storage.management.core.model;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import com.gluster.storage.management.core.utils.GlusterCoreUtil;
-import com.gluster.storage.management.core.utils.StringUtil;
-
-@XmlRootElement(name="disk")
-public class Disk extends Device {
- private String description;
-
- // interface = pci, raid0, raid3, etc
- private String diskInterface;
-
- private Collection<Partition> partitions = new ArrayList<Partition>();
-
- // In case of a software raid, the disk will contain an array of other disks
- private Collection<Disk> raidDisks;
-
- public Disk() {
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getDescription() {
- return description;
- }
-
- @XmlElement(name="interface")
- public String getDiskInterface() {
- return diskInterface;
- }
-
- public void setDiskInterface(String diskInterface) {
- this.diskInterface = diskInterface;
- }
-
- @XmlElementWrapper(name="raidDisks")
- @XmlElement(name="disk", type=Disk.class)
- public Collection<Disk> getRaidDisks() {
- return raidDisks;
- }
-
- public void setRaidDisks(Collection<Disk> raidDisks) {
- this.raidDisks = raidDisks;
- }
-
- public void setPartitions(Collection<Partition> partitions) {
- this.partitions = partitions;
- }
-
- @XmlElementWrapper(name="partitions")
- @XmlElement(name="partition", type=Partition.class)
- public Collection<Partition> getPartitions() {
- return partitions;
- }
-
- public boolean hasPartitions() {
- return (partitions != null && partitions.size() > 0);
- }
-
- public Disk(Server server, String name, String mountPoint, Double space, Double spaceInUse, DEVICE_STATUS status) {
- super(server, name, mountPoint, space, spaceInUse, status);
- }
-
- @Override
- public boolean filter(String filterString, boolean caseSensitive) {
- if (StringUtil.filterString(getServerName() + getName() + getStatusStr() + getSpace() + getFreeSpace()
- + getType() + getDescription(), filterString, caseSensitive)) {
- return true;
- }
-
- // disk doesn't match. check if any of the partitions of this disk match the filter
- for(Partition partition : getPartitions()) {
- if(partition.filter(filterString, caseSensitive)) {
- return true;
- }
- }
-
- return false;
- }
-
- @Override
- public boolean equals(Object obj) {
- if(this == obj) {
- return true;
- }
-
- if(!(obj instanceof Disk)) {
- return false;
- }
-
- Disk disk = (Disk)obj;
-
- if (!(super.equals(obj) && getDescription().equals(disk.getDescription()) && getDiskInterface().equals(
- disk.getDiskInterface()))) {
- return false;
- }
-
- if (raidDisks != null) {
- for (Disk raidDisk : raidDisks) {
- // check if the disk contains same raid disks
- if (!(raidDisk.equals(GlusterCoreUtil.getEntity(disk.getRaidDisks(), raidDisk.getName(), false)))) {
- return false;
- }
- }
- }
-
-// // check if the disk contains same partitions
-// if (partitions != null) {
-// for (Partition partition : partitions) {
-// if (!(partition.equals(GlusterCoreUtil.getEntity(disk.getPartitions(), partition.getName(), false)))) {
-// return false;
-// }
-// }
-// }
- return true;
- }
-
- public void copyFrom(Disk newDisk) {
- super.copyFrom(newDisk);
- setDescription(newDisk.getDescription());
- }
-
- @Override
- public boolean isReady() {
- if (hasPartitions()) {
- for (Partition partition : getPartitions()) {
- if (partition.isReady()) {
- return true;
- }
- }
- return false;
- } else {
- return super.isReady();
- }
- }
-
- @Override
- public Double getSpace() {
- Double space = 0d;
- if (hasPartitions()) {
- for (Partition partition : getPartitions()) {
- space += partition.getSpace();
- }
- return space;
- } else {
- return super.getSpace();
- }
- }
-
- @Override
- public Double getSpaceInUse() {
- Double spaceInUse = 0d;
- if (hasPartitions()) {
- for (Partition partition : getPartitions()) {
- if (partition.isInitialized()) {
- spaceInUse += partition.getSpaceInUse();
- }
- }
- return spaceInUse;
- } else {
- return super.getSpaceInUse();
- }
- }
-} \ No newline at end of file
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Entity.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Entity.java
deleted file mode 100644
index b905afc3..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Entity.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package com.gluster.storage.management.core.model;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlTransient;
-
-import org.eclipse.core.runtime.PlatformObject;
-
-import com.gluster.storage.management.core.utils.StringUtil;
-
-@XmlRootElement
-public class Entity extends PlatformObject implements Filterable {
- private static final long serialVersionUID = 1L;
-
- protected String name;
- protected List<Entity> children = new ArrayList<Entity>();
- private Entity parent;
-
- public Entity() {
-
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- @XmlTransient
- public Entity getParent() {
- return parent;
- }
-
- public void setParent(Entity parent) {
- this.parent = parent;
- }
-
- public List<? extends Entity> getChildren() {
- return children;
- }
-
- public void setChildren(List<Entity> children) {
- this.children = children;
- }
-
- public Entity(String name, Entity parent) {
- this.name = name;
- this.parent = parent;
- }
-
- public Entity(String name, Entity parent, List<Entity> children) {
- this.name = name;
- this.parent = parent;
- this.children = children;
- }
-
- @Override
- public boolean filter(String filterString, boolean caseSensitive) {
- return StringUtil.filterString(getName(), filterString, caseSensitive);
- }
-
- @Override
- public String toString() {
- return name;
- }
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/EntityGroup.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/EntityGroup.java
deleted file mode 100644
index 8e0311f5..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/EntityGroup.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package com.gluster.storage.management.core.model;
-
-import java.util.List;
-
-public class EntityGroup<T extends Entity> extends Entity {
- private Class<T> type;
-
- public EntityGroup(String name, Class<T> type, Cluster cluster) {
- this(name, type, cluster, null);
- }
-
- @SuppressWarnings("unchecked")
- public EntityGroup(String name, Class<T> type, Cluster cluster, List<T> entities) {
- super(name, cluster, (List<Entity>)entities);
- this.type = type;
- }
-
- public List<T> getEntities() {
- return (List<T>)children;
- }
-
- public void setEntities(List<T> entities) {
- children = (List<Entity>)entities;
- }
-
- public Class<? extends Entity> getEntityType() {
- return type;
- }
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Event.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Event.java
deleted file mode 100644
index fe7b8495..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Event.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package com.gluster.storage.management.core.model;
-
-public class Event {
- public enum EVENT_TYPE {
- BRICKS_ADDED,
- BRICKS_REMOVED,
- BRICKS_CHANGED,
- VOLUME_STATUS_CHANGED,
- ALERT_CREATED,
- ALERT_REMOVED,
- VOLUME_OPTIONS_RESET,
- VOLUME_OPTION_SET,
- VOLUME_CHANGED,
- GLUSTER_SERVER_CHANGED,
- DEVICES_ADDED,
- DEVICES_REMOVED,
- DEVICES_CHANGED,
- DISCOVERED_SERVER_CHANGED
- }
-
- private EVENT_TYPE eventType;
- private Object eventData;
-
- public Event(EVENT_TYPE eventType, Object eventData) {
- this.eventType = eventType;
- this.eventData = eventData;
- }
-
- public EVENT_TYPE getEventType() {
- return eventType;
- }
-
- public void setEventType(EVENT_TYPE eventType) {
- this.eventType = eventType;
- }
-
- public Object getEventData() {
- return eventData;
- }
-
- public void setEventData(Object eventData) {
- this.eventData = eventData;
- }
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Filterable.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Filterable.java
deleted file mode 100644
index 9a2ed405..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Filterable.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package com.gluster.storage.management.core.model;
-
-/**
- * By default, the {@link EntityViewerFilter} filters the objects by parsing the
- * output of {@link Object#toString()} with the filter string. Classes that need
- * specific filtering logic can implement this interface. The default logic will
- * then be overridden by the method {@link Filterable#filter(String)}.
- */
-public interface Filterable {
- /**
- * @param filterString
- * String to be used for filtering
- * @param caseSensitive
- * Flag indicating whether the filtering should be case sensitive
- * @return true if the object can be selected using the filter string, else
- * false
- */
- public boolean filter(String filterString, boolean caseSensitive);
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/GlusterDataModel.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/GlusterDataModel.java
deleted file mode 100644
index 733527c3..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/GlusterDataModel.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package com.gluster.storage.management.core.model;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class GlusterDataModel extends Entity {
- public GlusterDataModel(String name, List<Cluster> clusters) {
- super(name, null);
- children.addAll(clusters);
- }
-
- public GlusterDataModel(String name) {
- this(name, new ArrayList<Cluster>());
- }
-
- public void setClusters(List<Cluster> clusters) {
- children.clear();
- children.addAll(clusters);
- }
-
- public void addCluster(Cluster cluster) {
- children.add(cluster);
- }
-
- public Cluster getCluster() {
- return (Cluster) children.get(0);
- }
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/GlusterDummyModel.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/GlusterDummyModel.java
deleted file mode 100644
index 2139bbd7..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/GlusterDummyModel.java
+++ /dev/null
@@ -1,251 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package com.gluster.storage.management.core.model;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
-
-import com.gluster.storage.management.core.model.Device.DEVICE_STATUS;
-import com.gluster.storage.management.core.model.Server.SERVER_STATUS;
-import com.gluster.storage.management.core.model.Volume.TRANSPORT_TYPE;
-import com.gluster.storage.management.core.model.Volume.VOLUME_STATUS;
-import com.gluster.storage.management.core.model.Volume.VOLUME_TYPE;
-
-public class GlusterDummyModel {
- // private Server discoveredServer1, discoveredServer2, discoveredServer3, discoveredServer4, discoveredServer5;
- private GlusterServer server1, server2, server3, server4, server5;
- private Volume volume1, volume2, volume3, volume4, volume5;
- private Disk s1da, s1db, s2da, s2db, s2dc, s2dd, s3da, s4da, s5da, s5db;
- private static List<VolumeLogMessage> logMessages = new ArrayList<VolumeLogMessage>();
- private static GlusterDummyModel instance = new GlusterDummyModel();
- private GlusterDataModel model;
-
- private GlusterDummyModel() {
- model = initializeModel();
- }
-
- public GlusterDataModel getModel() {
- return model;
- }
-
- public static GlusterDummyModel getInstance() {
- return instance;
- }
-
- // Renamed preferredInterfaceName to interfaceName
- private GlusterServer addGlusterServer(List<GlusterServer> servers, Entity parent, String name,
- SERVER_STATUS status, String interfaceName, int numOfCPUs, double cpuUsage, double totalMemory,
- double memoryInUse) {
- GlusterServer glusterServer = new GlusterServer(name, parent, status, numOfCPUs, cpuUsage, totalMemory,
- memoryInUse);
- NetworkInterface networkInterface = addNetworkInterface(glusterServer, interfaceName);
-
- servers.add(glusterServer);
- return glusterServer;
- }
-
- private NetworkInterface addNetworkInterface(Server server, String interfaceName) {
- NetworkInterface networkInterface = new NetworkInterface(interfaceName, server, "00:00:00:00", "IPV6-IN-IPV4",
- "1000MB/S", "192.168.1." + Math.round(Math.random() * 255), "255.255.255.0", "192.168.1.1");
- server.setNetworkInterfaces(Arrays.asList(new NetworkInterface[] { networkInterface }));
- return networkInterface;
- }
-
- private void addDiscoveredServer(List<Server> servers, Entity parent, String name, int numOfCPUs, double cpuUsage,
- double totalMemory, double memoryInUse, double totalDiskSpace, double diskSpaceInUse) {
- Server server = new Server(name, parent, numOfCPUs, cpuUsage, totalMemory, memoryInUse);
- server.addDisk(new Disk(server, "sda", "/export/md0", totalDiskSpace, diskSpaceInUse, DEVICE_STATUS.INITIALIZED));
- addNetworkInterface(server, "eth0");
-
- servers.add(server);
- }
-
- private GlusterDataModel initializeModel() {
- // Create the dummy data model for demo
- GlusterDataModel model = new GlusterDataModel("Clusters");
- Cluster cluster = new Cluster("Home", model);
-
- initializeGlusterServers(cluster);
- initializeVolumes(cluster);
- initializeAutoDiscoveredServers(cluster);
- initializeDisks();
- addDisksToServers();
- addVolumeOptions();
-
- createDummyLogMessages();
-
- model.addCluster(cluster);
- return model;
- }
-
- private void addVolumeOptions() {
- for (Volume vol : new Volume[] { volume1, volume2, volume3, volume4, volume5 }) {
- for (int i = 1; i <= 5; i++) {
- String key = vol.getName() + "key" + i;
- String value = vol.getName() + "value" + i;
- vol.setOption(key, value);
- }
- }
- }
-
- private Volume addVolume(List<Volume> volumes, String name, Cluster cluster, VOLUME_TYPE volumeType,
- TRANSPORT_TYPE transportType, VOLUME_STATUS status) {
- Volume volume = new Volume(name, cluster, volumeType, transportType, status);
- volumes.add(volume);
-
- return volume;
- }
-
- private void initializeVolumes(Cluster cluster) {
- List<Volume> volumes = new ArrayList<Volume>();
-
- volume1 = addVolume(volumes, "Volume1", cluster, VOLUME_TYPE.DISTRIBUTE, TRANSPORT_TYPE.ETHERNET,
- VOLUME_STATUS.ONLINE);
-
- volume2 = addVolume(volumes, "Volume2", cluster, VOLUME_TYPE.DISTRIBUTE, TRANSPORT_TYPE.ETHERNET,
- VOLUME_STATUS.ONLINE);
-
- volume3 = addVolume(volumes, "Volume3", cluster, VOLUME_TYPE.DISTRIBUTED_REPLICATE, TRANSPORT_TYPE.ETHERNET,
- VOLUME_STATUS.OFFLINE);
- volume3.setReplicaCount(2);
-
- volume4 = addVolume(volumes, "Volume4", cluster, VOLUME_TYPE.DISTRIBUTE, TRANSPORT_TYPE.ETHERNET,
- VOLUME_STATUS.ONLINE);
-
- volume5 = addVolume(volumes, "Volume5", cluster, VOLUME_TYPE.DISTRIBUTED_STRIPE, TRANSPORT_TYPE.INFINIBAND,
- VOLUME_STATUS.OFFLINE);
- volume5.setStripeCount(3);
-
- cluster.setVolumes(volumes);
- }
-
- private void initializeDisks() {
- s1da = new Disk(server1, "sda", "/export/md0", 100d, 80d, DEVICE_STATUS.INITIALIZED);
- s1db = new Disk(server1, "sdb", "/export/md1", 100d, 67.83, DEVICE_STATUS.INITIALIZED);
-
- s2da = new Disk(server2, "sda", "/export/md0", 200d, 157.12, DEVICE_STATUS.INITIALIZED);
- s2db = new Disk(server2, "sdb", "/export/md1", 200d, 182.27, DEVICE_STATUS.INITIALIZED);
- s2dc = new Disk(server2, "sdc", "/export/md0", 200d, -1d, DEVICE_STATUS.UNINITIALIZED);
- s2dd = new Disk(server2, "sdd", "/export/md1", 200d, 124.89, DEVICE_STATUS.INITIALIZED);
-
- s4da = new Disk(server4, "sda", "/export/md0", 100d, 85.39, DEVICE_STATUS.INITIALIZED);
-
- s5da = new Disk(server5, "sda", "/export/md1", 100d, 92.83, DEVICE_STATUS.INITIALIZED);
- s5db = new Disk(server5, "sdb", "/export/md1", 200d, 185.69, DEVICE_STATUS.INITIALIZED);
- }
-
- private void addDisksToServers() {
- server1.addDisk(s1da);
- server1.addDisk(s1db);
-
- server2.addDisk(s2da);
- server2.addDisk(s2db);
- server2.addDisk(s2dc);
- server2.addDisk(s2dd);
-
- // server3.addDisk(s3da);
-
- server4.addDisk(s4da);
-
- server5.addDisk(s5da);
- server5.addDisk(s5db);
- }
-
- private void initializeGlusterServers(Cluster cluster) {
- List<GlusterServer> servers = new ArrayList<GlusterServer>();
- server1 = addGlusterServer(servers, cluster, "Server1", SERVER_STATUS.ONLINE, "eth0", 4, 56.3, 16, 8.4);
- server2 = addGlusterServer(servers, cluster, "Server2", SERVER_STATUS.ONLINE, "eth1", 8, 41.92, 32, 18.76);
- server3 = addGlusterServer(servers, cluster, "Server3", SERVER_STATUS.OFFLINE, "eth0", -1, -1, -1, -1);
- server4 = addGlusterServer(servers, cluster, "Server4", SERVER_STATUS.ONLINE, "eth0", 1, 92.83, 4, 3.18);
- server5 = addGlusterServer(servers, cluster, "Server5", SERVER_STATUS.ONLINE, "inf0", 2, 87.24, 8, 7.23);
-
- cluster.setServers(servers);
- }
-
- private void initializeAutoDiscoveredServers(Cluster cluster) {
- List<Server> servers = new ArrayList<Server>();
- addDiscoveredServer(servers, cluster, "ADServer1", 4, 56.3, 16, 8.4, 200, 147.83);
- addDiscoveredServer(servers, cluster, "ADServer2", 8, 41.92, 32, 18.76, 800, 464.28);
- addDiscoveredServer(servers, cluster, "ADServer3", 2, 84.28, 2, 1.41, 120, 69.93);
- addDiscoveredServer(servers, cluster, "ADServer4", 1, 92.83, 4, 3.18, 100, 85.39);
- addDiscoveredServer(servers, cluster, "ADServer5", 2, 87.24, 8, 7.23, 250, 238.52);
- cluster.setAutoDiscoveredServers(servers);
- }
-
- private void addMessages(List<VolumeLogMessage> messages, Disk disk, String severity, int count) {
- for (int i = 1; i <= count; i++) {
- String message = severity + "message" + i;
- messages.add(new VolumeLogMessage(new Date(), disk.getMountPoint(), severity, message));
- }
- }
-
- private void addMessagesForDisk(List<VolumeLogMessage> logMessages, Disk disk) {
- addMessages(logMessages, disk, "SEVERE", 5);
- addMessages(logMessages, disk, "WARNING", 5);
- addMessages(logMessages, disk, "DEBUG", 5);
- addMessages(logMessages, disk, "INFO", 5);
- }
-
- public List<VolumeLogMessage> createDummyLogMessages() {
- addMessagesForDisk(logMessages, s1da);
- addMessagesForDisk(logMessages, s1db);
- addMessagesForDisk(logMessages, s2da);
- addMessagesForDisk(logMessages, s2db);
- addMessagesForDisk(logMessages, s2dc);
- addMessagesForDisk(logMessages, s2dd);
- addMessagesForDisk(logMessages, s4da);
- addMessagesForDisk(logMessages, s5da);
- addMessagesForDisk(logMessages, s5db);
- return logMessages;
- }
-
- public static List<VolumeLogMessage> getDummyLogMessages() {
- return logMessages;
- }
-
- public Disk getVolumeDisk(String volumeDisk) {
- List<Disk> allDisks = getReadyDisksOfAllServers();
- String brickInfo[] = volumeDisk.split(":");
- for (Disk disk : allDisks) {
- if (disk.getServerName() == brickInfo[0] && disk.getName() == brickInfo[1]) {
- return disk;
- }
- }
- return null;
- }
-
- public List<Disk> getReadyDisksOfAllServers() {
- return getReadyDisksOfAllServersExcluding(new ArrayList<Disk>());
- }
-
- public List<Disk> getReadyDisksOfAllServersExcluding(List<Disk> excludeDisks) {
- List<Disk> disks = new ArrayList<Disk>();
-
- for (Server server : ((Cluster) model.getChildren().get(0)).getServers()) {
- for (Disk disk : server.getDisks()) {
- if (disk.isReady() && !excludeDisks.contains(disk)) {
- disks.add(disk);
- }
- }
- }
- return disks;
- }
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/GlusterServer.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/GlusterServer.java
deleted file mode 100644
index 9c7ac80b..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/GlusterServer.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package com.gluster.storage.management.core.model;
-
-import javax.xml.bind.annotation.XmlRootElement;
-
-import com.gluster.storage.management.core.utils.StringUtil;
-
-@XmlRootElement(name = "glusterServer")
-public class GlusterServer extends Server {
- private String uuid;
-
- public GlusterServer() {
- }
-
- public GlusterServer(String name) {
- super(name);
- }
-
- public GlusterServer(String name, Entity parent, SERVER_STATUS status, int numOfCPUs, double cpuUsage,
- double totalMemory, double memoryInUse) {
- super(name, parent, numOfCPUs, cpuUsage, totalMemory, memoryInUse);
- setStatus(status);
- }
-
- public String getUuid() {
- return uuid;
- }
-
- public void setUuid(String uuid) {
- this.uuid = uuid;
- }
-
- /**
- * Filter matches if any of the properties name and status contains the filter string
- */
- @Override
- public boolean filter(String filterString, boolean caseSensitive) {
- return StringUtil.filterString(getName() + getStatusStr(), filterString, caseSensitive);
- }
-
- @Override
- public boolean equals(Object obj) {
- if(this == obj) {
- return true;
- }
-
- if(!(obj instanceof GlusterServer)) {
- return false;
- }
- GlusterServer server = (GlusterServer)obj;
-
- if (super.equals(server) && getUuid().equals(server.getUuid()) && getStatus() == server.getStatus()) {
- return true;
- }
-
- return false;
- }
-
- public void copyFrom(GlusterServer server) {
- super.copyFrom(server);
- setUuid(server.getUuid());
- setStatus(server.getStatus());
- }
-} \ No newline at end of file
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/InitDiskStatusResponse.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/InitDiskStatusResponse.java
deleted file mode 100644
index f09dfc88..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/InitDiskStatusResponse.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * InitDiskStatusResponse.java
- *
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package com.gluster.storage.management.core.model;
-
-import javax.xml.bind.annotation.XmlRootElement;
-
-@XmlRootElement(name="response")
-public class InitDiskStatusResponse {
-
- public enum FORMAT_STATUS {
- IN_PROGRESS, COMPLETED, NOT_RUNNING
- };
-
- private String[] FORMAT_STATUS_STR = { "In Progress", "Completed", "Not Running" };
-
- private String device;
- private String message;
- private float totalBlocks;
- private float completedBlocks;
- private FORMAT_STATUS formatStatus;
-
- public InitDiskStatusResponse() {
-
- }
-
- public void setDevice(String device) {
- this.device = device;
- }
-
- public String getDevice() {
- return device;
- }
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
-
- public void setTotalBlocks(float totalBlocks) {
- this.totalBlocks = totalBlocks;
- }
-
- public float getTotalBlocks() {
- return totalBlocks;
- }
-
- public void setCompletedBlocks(float completedBlocks) {
- this.completedBlocks = completedBlocks;
- }
-
- public float getCompletedBlocks() {
- return completedBlocks;
- }
-
- public String getFormatStatusStr() {
- return FORMAT_STATUS_STR[getFormatStatus().ordinal()];
- }
-
- public FORMAT_STATUS getFormatStatus() {
- return formatStatus;
- }
-
- public void setFormatStatus(FORMAT_STATUS status) {
- this.formatStatus = status;
- }
-
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/NetworkInterface.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/NetworkInterface.java
deleted file mode 100644
index 181b8e66..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/NetworkInterface.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package com.gluster.storage.management.core.model;
-
-import javax.xml.bind.annotation.XmlRootElement;
-
-@XmlRootElement(name = "networkInterface")
-public class NetworkInterface extends Entity {
- private String hwAddr;
- private String model;
- private String speed;
- private String ipAddress;
- private String netMask;
- private String defaultGateway;
-
- public NetworkInterface() {
-
- }
-
- public NetworkInterface(String name, Entity parent, String hwAddr, String model, String speed, String ipAddress,
- String netMask, String defaultGateway) {
- super(name, parent);
- setHwAddr(hwAddr);
- setModel(model);
- setSpeed(speed);
- setIpAddress(ipAddress);
- setNetMask(netMask);
- setDefaultGateway(defaultGateway);
- }
-
- public String getIpAddress() {
- return ipAddress;
- }
-
- public void setIpAddress(String ipAddress) {
- this.ipAddress = ipAddress;
- }
-
- public String getNetMask() {
- return netMask;
- }
-
- public void setNetMask(String netMask) {
- this.netMask = netMask;
- }
-
- public String getDefaultGateway() {
- return defaultGateway;
- }
-
- public void setDefaultGateway(String defaultGateway) {
- this.defaultGateway = defaultGateway;
- }
-
- public String getHwAddr() {
- return hwAddr;
- }
-
- public void setHwAddr(String hwAddr) {
- this.hwAddr = hwAddr;
- }
-
- public String getModel() {
- return model;
- }
-
- public void setModel(String model) {
- this.model = model;
- }
-
- public String getSpeed() {
- return speed;
- }
-
- public void setSpeed(String speed) {
- this.speed = speed;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof NetworkInterface)) {
- return false;
- }
-
- NetworkInterface networkInterface = (NetworkInterface) obj;
- if (getName().equals(networkInterface.getName()) && getHwAddr().equals(networkInterface.getHwAddr())
- && getIpAddress().equals(networkInterface.getIpAddress())
- && getDefaultGateway().equals(networkInterface.getDefaultGateway())
- && getNetMask().equals(networkInterface.getNetMask()) && getSpeed().equals(networkInterface.getSpeed())
- && getModel().equals(networkInterface.getModel())) {
- return true;
- }
-
- return false;
- }
-} \ No newline at end of file
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Partition.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Partition.java
deleted file mode 100644
index ecf4035b..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Partition.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package com.gluster.storage.management.core.model;
-
-import javax.xml.bind.annotation.XmlRootElement;
-
-@XmlRootElement(name="partition")
-public class Partition extends Device {
-
- public Partition() {
- super();
- }
-
- public Partition(Server server, String name, String mountPoint, Double space, Double spaceInUse,
- DEVICE_STATUS status) {
- super(server, name, mountPoint, space, spaceInUse, status);
- }
-
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Response.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Response.java
deleted file mode 100644
index 96ea8497..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Response.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package com.gluster.storage.management.core.model;
-
-/**
- * Interface for server response. Any request handled by the Gluster Management
- * Server will result in a response that must be an instance of a class
- * implementing this interface.
- */
-public interface Response<T> {
- /**
- * @return Status of request processing
- */
- public Status getStatus();
-
- /**
- * @return Data associated with the response. e.g. A "discover servers"
- * request will return the list of discovered servers.
- */
- public T getData();
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Server.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Server.java
deleted file mode 100644
index 3662188c..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Server.java
+++ /dev/null
@@ -1,247 +0,0 @@
-/*******************************************************************************
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package com.gluster.storage.management.core.model;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import com.gluster.storage.management.core.utils.GlusterCoreUtil;
-import com.gluster.storage.management.core.utils.StringUtil;
-
-@XmlRootElement(name = "server")
-public class Server extends Entity {
- public enum SERVER_STATUS {
- ONLINE, OFFLINE
- };
-
- protected static final String[] STATUS_STR = new String[] { "Online", "Offline" };
-
- private int numOfCPUs;
- private double cpuUsage;
- private double totalMemory;
- private double memoryInUse;
- private List<Disk> disks = new ArrayList<Disk>();
- private List<NetworkInterface> networkInterfaces = new ArrayList<NetworkInterface>();
- private SERVER_STATUS status;
-
- public Server() {
-
- }
-
- public Server(String name) {
- super(name, null);
- }
-
- public Server(String name, Entity parent, int numOfCPUs, double cpuUsage, double totalMemory, double memoryInUse) {
- super(name, parent);
- setNumOfCPUs(numOfCPUs);
- setCpuUsage(cpuUsage);
- setTotalMemory(totalMemory);
- setMemoryInUse(memoryInUse);
- }
-
- public int getNumOfCPUs() {
- return numOfCPUs;
- }
-
- public void setNumOfCPUs(int numOfCPUs) {
- this.numOfCPUs = numOfCPUs;
- }
-
- public double getCpuUsage() {
- return cpuUsage;
- }
-
- public void setCpuUsage(double cpuUsage) {
- this.cpuUsage = cpuUsage;
- }
-
- public double getTotalMemory() {
- return totalMemory;
- }
-
- public void setTotalMemory(double totalMemory) {
- this.totalMemory = totalMemory;
- }
-
- public double getMemoryInUse() {
- return memoryInUse;
- }
-
- public void setMemoryInUse(double memoryInUse) {
- this.memoryInUse = memoryInUse;
- }
-
- public double getTotalDiskSpace() {
- double totalDiskSpace = 0;
- for (Disk disk : getDisks()) {
- totalDiskSpace += disk.getSpace();
- }
- return totalDiskSpace;
- }
-
- public double getDiskSpaceInUse() {
- double diskSpaceInUse = 0;
- for(Disk disk : getDisks()) {
- if(disk.isReady()) {
- diskSpaceInUse += disk.getSpaceInUse();
- }
- }
- return diskSpaceInUse;
- }
-
- public double getFreeDiskSpace() {
- return getTotalDiskSpace() - getDiskSpaceInUse();
- }
-
- @XmlElementWrapper(name = "networkInterfaces")
- @XmlElement(name = "networkInterface", type = NetworkInterface.class)
- public List<NetworkInterface> getNetworkInterfaces() {
- return networkInterfaces;
- }
-
- public void setNetworkInterfaces(List<NetworkInterface> networkInterfaces) {
- this.networkInterfaces = networkInterfaces;
- }
-
- @XmlElementWrapper(name = "disks")
- @XmlElement(name = "disk", type = Disk.class)
- public List<Disk> getDisks() {
- return disks;
- }
-
- public void addNetworkInterface(NetworkInterface networkInterface) {
- networkInterfaces.add(networkInterface);
- }
-
- public void addDisk(Disk disk) {
- disks.add(disk);
- }
-
- public void addDisks(Collection<Disk> disks) {
- for (Disk disk : disks) {
- addDisk(disk);
- }
- }
-
- public void removeDisk(Disk disk) {
- disks.remove(disk);
- }
-
- public void removeAllDisks() {
- disks.clear();
- }
-
- public void setDisks(List<Disk> disks) {
- removeAllDisks();
- addDisks(disks);
- }
-
- public int getNumOfDisks() {
- return disks.size();
- }
-
- public String getIpAddressesAsString() {
- String ipAddresses = "";
- for (NetworkInterface networkInterface : getNetworkInterfaces()) {
- String ipAddr = networkInterface.getIpAddress();
- if(!ipAddr.equals("127.0.0.1")) {
- ipAddresses += (ipAddresses.isEmpty() ? ipAddr : ", " + ipAddr);
- }
- }
- return ipAddresses;
- }
-
- public String getStatusStr() {
- return STATUS_STR[getStatus().ordinal()];
- }
-
- public SERVER_STATUS getStatus() {
- return status;
- }
-
- public void setStatus(SERVER_STATUS status) {
- this.status = status;
- }
-
- public Boolean isOnline() {
- return getStatus() == SERVER_STATUS.ONLINE;
- }
-
- @Override
- public boolean filter(String filterString, boolean caseSensitive) {
- return StringUtil.filterString(getName() + getIpAddressesAsString(), filterString, caseSensitive);
- }
-
- /**
- * Note: this method doesn't copy the disks. Clients should write separate code to identify added/removed/modified
- * disks and update the server disks appropriately.
- *
- * @param server
- */
- public void copyFrom(Server server) {
- setName(server.getName());
- setParent(server.getParent());
- setChildren((List<Entity>) server.getChildren());
- setNetworkInterfaces(server.getNetworkInterfaces());
- setNumOfCPUs(server.getNumOfCPUs());
- setCpuUsage(server.getCpuUsage());
- setTotalMemory(server.getTotalMemory());
- setMemoryInUse(server.getMemoryInUse());
- setStatus(server.getStatus());
- }
-
- @Override
- public boolean equals(Object obj) {
- if(this == obj) {
- return true;
- }
-
- if(!(obj instanceof Server)) {
- return false;
- }
- Server server = (Server)obj;
-
- if (!(getName().equals(server.getName()) && getNumOfCPUs() == server.getNumOfCPUs()
- && getCpuUsage() == server.getCpuUsage() && getTotalMemory() == server.getTotalMemory()
- && getMemoryInUse() == server.getMemoryInUse() && getDisks().size() == server.getDisks().size() && getNetworkInterfaces()
- .size() == server.getNetworkInterfaces().size())) {
- return false;
- }
-
- for(Disk disk : getDisks()) {
- if (!disk.equals(GlusterCoreUtil.getEntity(server.getDisks(), disk.getName(), false))) {
- return false;
- }
- }
-
- for (NetworkInterface networkInterface : getNetworkInterfaces()) {
- if (!networkInterface.equals(GlusterCoreUtil.getEntity(server.getNetworkInterfaces(),
- networkInterface.getName(), false))) {
- return false;
- }
- }
-
- return true;
- }
-} \ No newline at end of file
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/ServerStats.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/ServerStats.java
deleted file mode 100644
index 042af256..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/ServerStats.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package com.gluster.storage.management.core.model;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
-import javax.xml.bind.annotation.XmlRootElement;
-
-/**
- *
- */
-@XmlRootElement(name="xport")
-public class ServerStats {
- private StatsMetadata metadata;
- private List<ServerStatsRow> rows;
-
- public ServerStats() {
- }
-
- public ServerStats(ServerStats newStats) {
- copyFrom(newStats);
- }
-
- public void setRows(List<ServerStatsRow> rows) {
- this.rows = rows;
- }
-
- @XmlElementWrapper(name="data")
- @XmlElement(name="row", type=ServerStatsRow.class)
- public List<ServerStatsRow> getRows() {
- return rows;
- }
-
- public void setMetadata(StatsMetadata metadata) {
- this.metadata = metadata;
- }
-
- @XmlElement(name="meta")
- public StatsMetadata getMetadata() {
- return metadata;
- }
-
- public void copyFrom(ServerStats newStats) {
- setMetadata(newStats.getMetadata());
-
- List<ServerStatsRow> newRows = newStats.getRows();
- int rowCount = newRows.size();
-
- rows = new ArrayList<ServerStatsRow>(rowCount);
- for(ServerStatsRow newRow : newRows) {
- rows.add(new ServerStatsRow(newRow));
- }
- }
-} \ No newline at end of file
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/ServerStatsRow.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/ServerStatsRow.java
deleted file mode 100644
index 0088cef6..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/ServerStatsRow.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package com.gluster.storage.management.core.model;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-
-/**
- *
- */
-@XmlRootElement(name="row")
-public class ServerStatsRow {
- private Long timestamp;
- private List<Double> usageData;
-
- public ServerStatsRow() {
- }
-
- public ServerStatsRow(ServerStatsRow newRow) {
- copyFrom(newRow);
- }
-
- private void copyFrom(ServerStatsRow newRow) {
- setTimestamp(newRow.getTimestamp());
-
- List<Double> myData = new ArrayList<Double>(newRow.getUsageData().size());
- for(Double dataElement : newRow.getUsageData()) {
- myData.add(dataElement);
- }
- setUsageData(myData);
- }
-
- @XmlElement(name="t")
- public Long getTimestamp() {
- return timestamp;
- }
-
- public void setTimestamp(Long timestamp) {
- this.timestamp = timestamp;
- }
-
- public void setUsageData(List<Double> usageData) {
- this.usageData = usageData;
- }
-
- @XmlElement(name="v")
- public List<Double> getUsageData() {
- return usageData;
- }
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/StatsMetadata.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/StatsMetadata.java
deleted file mode 100644
index 22b42671..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/StatsMetadata.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package com.gluster.storage.management.core.model;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
-import javax.xml.bind.annotation.XmlRootElement;
-
-/**
- *
- */
-@XmlRootElement(name="meta")
-public class StatsMetadata {
- private Long startTimestamp;
- private Long endTimestamp;
- private Integer step;
- private Integer rowCount;
- private List<String> legend = new ArrayList<String>();
-
- @XmlElement(name="start")
- public Long getStartTimestamp() {
- return startTimestamp;
- }
-
- public void setStartTimestamp(Long startTimestamp) {
- this.startTimestamp = startTimestamp;
- }
-
- @XmlElement(name="end")
- public Long getEndTimestamp() {
- return endTimestamp;
- }
-
- public void setEndTimestamp(Long endTimestamp) {
- this.endTimestamp = endTimestamp;
- }
-
- @XmlElement(name="step")
- public Integer getStep() {
- return step;
- }
-
- public void setStep(Integer step) {
- this.step = step;
- }
-
- @XmlElement(name="rows")
- public Integer getRowCount() {
- return rowCount;
- }
-
- public void setRowCount(Integer rowCount) {
- this.rowCount = rowCount;
- }
-
- @XmlElementWrapper(name="legend")
- @XmlElement(name="entry", type=String.class)
- public List<String> getLegend() {
- return legend;
- }
-
- public void setLegend(List<String> legend) {
- this.legend = legend;
- }
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Status.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Status.java
deleted file mode 100644
index fc824db2..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Status.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package com.gluster.storage.management.core.model;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import com.gluster.storage.management.core.utils.ProcessResult;
-
-@XmlRootElement(name = "status")
-public class Status {
- // TODO: Convert the status codes to an enumeration
- public static final int STATUS_CODE_SUCCESS = 0;
- public static final int STATUS_CODE_FAILURE = 1;
- public static final int STATUS_CODE_PART_SUCCESS = 2;
- public static final int STATUS_CODE_RUNNING = 3;
- public static final int STATUS_CODE_PAUSE = 4;
- public static final int STATUS_CODE_WARNING = 5;
- public static final int STATUS_CODE_COMMIT_PENDING = 6;
- public static final Status STATUS_SUCCESS = new Status(STATUS_CODE_SUCCESS, "Success");
- public static final Status STATUS_FAILURE = new Status(STATUS_CODE_FAILURE, "Failure");
-
- // public static final Status
-
- private Integer code;
- private String message;
-
- public Status() {
- }
-
- public boolean isSuccess() {
- return code == STATUS_CODE_SUCCESS;
- }
-
- public boolean isPartSuccess() {
- return code == STATUS_CODE_PART_SUCCESS;
- }
-
- public Status(Integer code, String message) {
- this.code = code;
- this.message = message;
- }
-
- public Status(ProcessResult result) {
- this.code = result.getExitValue();
- this.message = result.getOutput();
- }
-
- public Status(Exception e) {
- this.code = STATUS_CODE_FAILURE;
- this.message = e.getMessage();
- }
-
- @XmlElement(name = "code", type = Integer.class)
- public Integer getCode() {
- return code;
- }
-
- public void setCode(Integer executionStatus) {
- this.code = executionStatus;
- }
-
- @XmlElement
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- @Override
- public String toString() {
- return isSuccess() ? "Success" : "[" + getCode() + "][" + getMessage() + "]";
- }
-} \ No newline at end of file
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/TaskInfo.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/TaskInfo.java
deleted file mode 100644
index 43299863..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/TaskInfo.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/**
- * TaskInfo.java
- *
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- */
-package com.gluster.storage.management.core.model;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import com.gluster.storage.management.core.utils.StringUtil;
-
-@XmlRootElement
-public class TaskInfo extends Entity {
- public enum TASK_TYPE {
- DISK_FORMAT, BRICK_MIGRATE, VOLUME_REBALANCE
- }
-
- private TASK_TYPE type;
- private String reference;
- private String description;
- private Boolean pauseSupported;
- private Boolean stopSupported;
- private Boolean commitSupported;
- private TaskStatus status;
-
- public TaskInfo() {
- }
-
- @XmlElement(name="id")
- public String getName() {
- return super.getName();
- }
-
- public TASK_TYPE getType() {
- return type;
- }
-
- public void setType(TASK_TYPE type) {
- this.type = type;
- }
-
- public String getReference() {
- return reference;
- }
-
- public void setReference(String reference) {
- this.reference = reference;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public TaskStatus getStatus() {
- return status;
- }
-
- public void setStatus(TaskStatus status) {
- this.status = status;
- }
-
- public Boolean getPauseSupported() {
- return pauseSupported;
- }
-
- public void setPauseSupported(Boolean canPause) {
- this.pauseSupported = canPause;
- }
-
- public Boolean getStopSupported() {
- return stopSupported;
- }
-
- public void setStopSupported(Boolean canStop) {
- this.stopSupported = canStop;
- }
-
- public Boolean getCommitSupported() {
- return this.commitSupported;
- }
-
- public void setCommitSupported(Boolean canCommit) {
- this.commitSupported = canCommit;
- }
-
- /* (non-Javadoc)
- * @see com.gluster.storage.management.core.model.Entity#filter(java.lang.String, boolean)
- */
- @Override
- public boolean filter(String filterString, boolean caseSensitive) {
- return StringUtil.filterString(getDescription() + getStatus().getMessage(), filterString, caseSensitive);
- }
-
- public void copyFrom(TaskInfo newTask) {
- setName(newTask.getName());
- setDescription(newTask.getDescription());
- setReference(newTask.getReference());
- setStatus(newTask.getStatus());
- setType(newTask.getType());
- setPauseSupported(newTask.getPauseSupported());
- setStopSupported(newTask.getStopSupported());
- }
-
- @Override
- public boolean equals(Object obj) {
- if(!(obj instanceof TaskInfo)) {
- return false;
- }
-
- TaskInfo newTask = (TaskInfo)obj;
- if (newTask.getName().equals(getName()) && newTask.getDescription().equals(getDescription())
- && newTask.getReference().equals(getReference()) && newTask.getStatus().equals(getStatus())
- && newTask.getType() == getType() && newTask.getPauseSupported() == getPauseSupported()
- && newTask.getStopSupported() == getStopSupported()) {
- return true;
- }
-
- return false;
- }
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/TaskStatus.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/TaskStatus.java
deleted file mode 100644
index 579cc9da..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/TaskStatus.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- * TaskStatus.java
- *
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- */
-package com.gluster.storage.management.core.model;
-
-public class TaskStatus extends Status {
-
- private boolean isPercentageSupported = false;
- private float percentCompleted;
- private String description;
-
- public TaskStatus() {
-
- }
-
- public TaskStatus(Status status) {
- super(status.getCode(), status.getMessage());
- }
-
- public boolean isCommitPending() {
- return getCode() == STATUS_CODE_COMMIT_PENDING;
- }
-
- public boolean isPercentageSupported() {
- return isPercentageSupported;
- }
-
- public void setPercentageSupported(boolean isPercentageSupported) {
- this.isPercentageSupported = isPercentageSupported;
- }
-
- public float getPercentCompleted() {
- return percentCompleted;
- }
-
- public void setPercentCompleted(float percentCompleted) {
- this.percentCompleted = percentCompleted;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/User.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/User.java
deleted file mode 100644
index ed5d12f7..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/User.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package com.gluster.storage.management.core.model;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlTransient;
-
-@XmlRootElement
-public class User {
- private String userId;
- private String password;
-
- public String getUserId() {
- return userId;
- }
- public void setUserId(String userId) {
- this.userId = userId;
- }
-
- @XmlTransient
- public String getPassword() {
- return password;
- }
- public void setPassword(String password) {
- this.password = password;
- }
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Version.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Version.java
deleted file mode 100644
index 887506a9..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Version.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package com.gluster.storage.management.core.model;
-
-/**
- *
- */
-public class Version implements Comparable<Version> {
- public int major = 0;
- public int minor = 0;
- public int maintenance = 0;
-
- public Version(String version) {
- String[] versionParts = version.split(".", -1);
- major = Integer.valueOf(versionParts[0]);
- if(versionParts.length > 1) {
- minor = Integer.valueOf(versionParts[1]);
- }
- if(versionParts.length > 2) {
- maintenance = Integer.valueOf(versionParts[2]);
- }
- }
-
- @Override
- public int compareTo(Version newVer) {
- if(this.major < newVer.major) {
- return -1;
- } else if(this.major > newVer.major) {
- return 1;
- }
-
- // major version is same
- if(this.minor < newVer.minor) {
- return -1;
- } else if(this.minor > newVer.minor) {
- return 1;
- }
-
- // major.minor is same
- if(this.maintenance < newVer.maintenance) {
- return -1;
- } else if(this.maintenance > newVer.maintenance) {
- return 1;
- }
-
- // major.minor.maintenance is same
- return 0;
- }
-} \ No newline at end of file
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Volume.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Volume.java
deleted file mode 100644
index 9356f14a..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Volume.java
+++ /dev/null
@@ -1,367 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package com.gluster.storage.management.core.model;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlTransient;
-
-import com.gluster.storage.management.core.constants.GlusterConstants;
-import com.gluster.storage.management.core.utils.GlusterCoreUtil;
-import com.gluster.storage.management.core.utils.StringUtil;
-
-@XmlRootElement
-public class Volume extends Entity {
- public enum VOLUME_STATUS {
- ONLINE, OFFLINE
- };
-
- public enum VOLUME_TYPE {
- DISTRIBUTE, REPLICATE, DISTRIBUTED_REPLICATE, STRIPE, DISTRIBUTED_STRIPE
- };
-
- public enum TRANSPORT_TYPE {
- ETHERNET, INFINIBAND
- };
-
- public enum NAS_PROTOCOL {
- GLUSTERFS, NFS, CIFS
- };
-
-
- public static final int DEFAULT_REPLICA_COUNT = 2;
- public static final int DEFAULT_STRIPE_COUNT = 4;
-
- public static final String OPTION_AUTH_ALLOW = "auth.allow";
- public static final String OPTION_NFS_DISABLE = "nfs.disable";
-
- private static final String[] VOLUME_TYPE_STR = new String[] { "Distribute", "Replicate", "Distributed Replicate",
- "Stripe", "Distributed Stripe" };
-
- private static final String[] TRANSPORT_TYPE_STR = new String[] { "Ethernet", "Infiniband" };
- private static final String[] STATUS_STR = new String[] { "Online", "Offline" };
- private static final String[] NAS_PROTOCOL_STR = new String[] { "Gluster", "NFS", "CIFS" };
-
- private VOLUME_TYPE volumeType;
- private TRANSPORT_TYPE transportType;
- private VOLUME_STATUS status;
- private int replicaCount;
- private int stripeCount;
- private VolumeOptions options = new VolumeOptions();
- private List<Brick> bricks = new ArrayList<Brick>();
- private List<String> cifsUsers;
-
- public Volume() {
- }
-
- // Only GlusterFS is enabled
- private Set<NAS_PROTOCOL> nasProtocols = new LinkedHashSet<NAS_PROTOCOL>(Arrays.asList(new NAS_PROTOCOL[] {
- NAS_PROTOCOL.GLUSTERFS }));
-
- public String getVolumeTypeStr() {
- return getVolumeTypeStr(getVolumeType());
- }
-
- public static String getVolumeTypeStr(VOLUME_TYPE volumeType) {
- return VOLUME_TYPE_STR[volumeType.ordinal()];
- }
-
- public static VOLUME_TYPE getVolumeTypeByStr(String volumeTypeStr) {
- return VOLUME_TYPE.valueOf(volumeTypeStr);
- }
-
- public static TRANSPORT_TYPE getTransportTypeByStr(String transportTypeStr) {
- return TRANSPORT_TYPE.valueOf(transportTypeStr);
- }
-
- public String getTransportTypeStr() {
- return TRANSPORT_TYPE_STR[getTransportType().ordinal()];
- }
-
- public String getStatusStr() {
- return STATUS_STR[getStatus().ordinal()];
- }
-
- public int getNumOfBricks() {
- return bricks.size();
- }
-
- public VOLUME_TYPE getVolumeType() {
- return volumeType;
- }
-
- public void setVolumeType(VOLUME_TYPE volumeType) {
- this.volumeType = volumeType;
- // TODO find a way to get the replica / strip count
- if (volumeType == VOLUME_TYPE.DISTRIBUTED_STRIPE) {
- setReplicaCount(0);
- setStripeCount(DEFAULT_STRIPE_COUNT);
- } else if (volumeType == VOLUME_TYPE.DISTRIBUTED_REPLICATE) {
- setReplicaCount(DEFAULT_REPLICA_COUNT);
- setStripeCount(0);
- } else {
- setReplicaCount(0);
- setStripeCount(0);
- }
- }
-
- public TRANSPORT_TYPE getTransportType() {
- return transportType;
- }
-
- public void setTransportType(TRANSPORT_TYPE transportType) {
- this.transportType = transportType;
- }
-
- public VOLUME_STATUS getStatus() {
- return status;
- }
-
- public int getReplicaCount() {
- return replicaCount;
- }
-
- public void setReplicaCount(int replicaCount) {
- this.replicaCount = replicaCount;
- }
-
- public int getStripeCount() {
- return stripeCount;
- }
-
- public void setStripeCount(int stripeCount) {
- this.stripeCount = stripeCount;
- }
-
- public void setStatus(VOLUME_STATUS status) {
- this.status = status;
- }
-
- @XmlElementWrapper(name = "nasProtocols")
- @XmlElement(name = "nasProtocol", type=NAS_PROTOCOL.class)
- public Set<NAS_PROTOCOL> getNASProtocols() {
- return nasProtocols;
- }
-
- public void setNASProtocols(Set<NAS_PROTOCOL> nasProtocols) {
- this.nasProtocols = nasProtocols;
- }
-
- public String getNASProtocolsStr() {
- String protocolsStr = "";
- for (NAS_PROTOCOL protocol : nasProtocols) {
- String protocolStr = NAS_PROTOCOL_STR[protocol.ordinal()];
- protocolsStr += (protocolsStr.isEmpty() ? protocolStr : ", " + protocolStr);
- }
- return protocolsStr;
- }
-
- @XmlTransient
- public String getAccessControlList() {
- return options.get(OPTION_AUTH_ALLOW);
- }
-
- public void setAccessControlList(String accessControlList) {
- setOption(OPTION_AUTH_ALLOW, accessControlList);
- }
-
- @XmlTransient
- public boolean isNfsEnabled() {
- String nfsDisabled = options.get(OPTION_NFS_DISABLE);
- if(nfsDisabled == null || nfsDisabled.equalsIgnoreCase(GlusterConstants.OFF)) {
- return true;
- } else {
- return false;
- }
- }
-
- @XmlElement(name="options")
- public VolumeOptions getOptions() {
- return options;
- }
-
- public void setOption(String key, String value) {
- options.put(key, value);
- }
-
- public void setOptions(VolumeOptions options) {
- this.options = options;
- }
-
- public void setOptions(LinkedHashMap<String, String> options) {
- List<VolumeOption> volumeOptions = new ArrayList<VolumeOption>();
- for(Entry<String, String> entry : options.entrySet()) {
- volumeOptions.add(new VolumeOption(entry.getKey(), entry.getValue()));
- }
- this.options.setOptions(volumeOptions);
- }
-
- public void addBrick(Brick brick) {
- bricks.add(brick);
- }
-
- public void addBricks(Collection<Brick> bricks) {
- this.bricks.addAll(bricks);
- }
-
-
- public void setBricks(List<Brick> bricks) {
- this.bricks = bricks;
- }
-
- public void removeBrick(Brick brick) {
- bricks.remove(brick);
- }
-
- @XmlElementWrapper(name = "bricks")
- @XmlElement(name = "brick", type=Brick.class)
- public List<Brick> getBricks() {
- return bricks;
- }
-
- public void enableNFS() {
- nasProtocols.add(NAS_PROTOCOL.NFS);
- setOption(OPTION_NFS_DISABLE, GlusterConstants.OFF);
- }
-
- public void disableNFS() {
- nasProtocols.remove(NAS_PROTOCOL.NFS);
- setOption(OPTION_NFS_DISABLE, GlusterConstants.ON);
- }
-
- public void enableCifs() {
- if (!nasProtocols.contains(NAS_PROTOCOL.CIFS)) {
- nasProtocols.add(NAS_PROTOCOL.CIFS);
- }
- }
-
- public void disableCifs() {
- nasProtocols.remove(NAS_PROTOCOL.CIFS);
- }
-
- public boolean isCifsEnable() {
- return nasProtocols.contains(NAS_PROTOCOL.CIFS);
- }
-
- public void setCifsUsers(List<String> cifsUsers) {
- this.cifsUsers = cifsUsers;
- }
-
- public List<String> getCifsUsers() {
- return cifsUsers;
- }
-
-
- public Volume(String name, Entity parent, VOLUME_TYPE volumeType, TRANSPORT_TYPE transportType, VOLUME_STATUS status) {
- super(name, parent);
- setVolumeType(volumeType);
- setTransportType(transportType);
- setStatus(status);
- }
-
- /**
- * Filter matches if any of the properties name, volume type, transport type, status and number of disks contains
- * the filter string
- */
- @Override
- public boolean filter(String filterString, boolean caseSensitive) {
- return StringUtil.filterString(getName() + getVolumeTypeStr() + getTransportTypeStr() + getStatusStr()
- + getNumOfBricks(), filterString, caseSensitive);
- }
-
- public List<String> getBrickDirectories() {
- List<String> brickDirectories = new ArrayList<String>();
- for(Brick brick : getBricks()) {
- brickDirectories.add(brick.getQualifiedName());
- }
- return brickDirectories;
- }
-
- @Override
- public boolean equals(Object obj) {
- if(!(obj instanceof Volume)) {
- return false;
- }
-
- Volume volume = (Volume)obj;
-
- if (!(getName().equals(volume.getName()) && getVolumeType() == volume.getVolumeType()
- && getTransportType() == volume.getTransportType() && getStatus() == volume.getStatus()
- && getReplicaCount() == volume.getReplicaCount() && getStripeCount() == volume.getStripeCount()
- && getOptions().equals(volume.getOptions()))) {
- return false;
- }
-
- for(NAS_PROTOCOL nasProtocol : getNASProtocols()) {
- if(!(volume.getNASProtocols().contains(nasProtocol))) {
- return false;
- }
- }
-
- List<Brick> oldBricks = getBricks();
- List<Brick> newBricks = volume.getBricks();
- if(oldBricks.size() != newBricks.size()) {
- return false;
- }
-
- if(!GlusterCoreUtil.getAddedEntities(oldBricks, newBricks, false).isEmpty()) {
- return false;
- }
-
- if(!GlusterCoreUtil.getAddedEntities(newBricks, oldBricks, false).isEmpty()) {
- return false;
- }
-
- Map<Brick, Brick> modifiedBricks = GlusterCoreUtil.getModifiedEntities(oldBricks, newBricks);
- if(modifiedBricks.size() > 0) {
- return false;
- }
-
- return true;
- }
-
- /**
- * Note: this method doesn't copy the bricks. Clients should write separate code to identify added/removed/modified
- * bricks and update the volume bricks appropriately.
- *
- * @param newVolume
- */
- public void copyFrom(Volume newVolume) {
- setName(newVolume.getName());
- setVolumeType(newVolume.getVolumeType());
- setTransportType(newVolume.getTransportType());
- setStatus(newVolume.getStatus());
- setReplicaCount(newVolume.getReplicaCount());
- setStripeCount(newVolume.getStripeCount());
- setNASProtocols(newVolume.getNASProtocols());
- setCifsUsers(newVolume.getCifsUsers());
- getOptions().copyFrom(newVolume.getOptions());
- }
-} \ No newline at end of file
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/VolumeLogMessage.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/VolumeLogMessage.java
deleted file mode 100644
index 7b7b77c8..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/VolumeLogMessage.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package com.gluster.storage.management.core.model;
-
-import java.util.Date;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-
-import com.gluster.storage.management.core.model.adapters.VolumeLogDateAdapter;
-import com.gluster.storage.management.core.utils.StringUtil;
-
-@XmlRootElement
-public class VolumeLogMessage implements Filterable {
- private Date timestamp;
- private String brick;
- private String severity;
- private String message;
-
- public VolumeLogMessage() {
- }
-
- public VolumeLogMessage(String logMessage) {
- // TODO: Parse the log message and extract fields
- }
-
- @XmlElement(name = "timestamp", required = true)
- @XmlJavaTypeAdapter(VolumeLogDateAdapter.class)
- public Date getTimestamp() {
- return timestamp;
- }
-
- public void setTimestamp(Date timestamp) {
- this.timestamp = timestamp;
- }
-
- public String getSeverity() {
- return severity;
- }
-
- public void setSeverity(String severity) {
- this.severity = severity;
- }
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- public void setBrick(String brick) {
- this.brick = brick;
- }
-
- @XmlElement(name = "brick")
- public String getBrick() {
- return brick;
- }
-
- public VolumeLogMessage(Date timestamp, String brickDirectory, String severity, String message) {
- setTimestamp(timestamp);
- setBrick(brickDirectory);
- setSeverity(severity);
- setMessage(message);
- }
-
- @Override
- public boolean filter(String filterString, boolean caseSensitive) {
- return StringUtil.filterString(getSeverity() + getTimestamp() + getBrick() + getMessage(), filterString,
- caseSensitive);
- }
-
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/VolumeOption.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/VolumeOption.java
deleted file mode 100644
index 6eb0c1bf..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/VolumeOption.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package com.gluster.storage.management.core.model;
-
-import javax.xml.bind.annotation.XmlRootElement;
-
-import com.gluster.storage.management.core.utils.StringUtil;
-
-/**
- *
- */
-@XmlRootElement(name="option")
-public class VolumeOption implements Filterable {
- private String key;
- private String value;
-
- public VolumeOption() {
- }
-
- public VolumeOption(String key, String value) {
- this.key = key;
- this.value = value;
- }
-
- public String getKey() {
- return key;
- }
-
- public void setKey(String key) {
- this.key = key;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
- @Override
- public String toString() {
- return key + "=" + value;
- }
-
- @Override
- public boolean filter(String filterString, boolean caseSensitive) {
- return StringUtil.filterString(getKey() + getValue(), filterString, caseSensitive);
- }
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/VolumeOptionInfo.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/VolumeOptionInfo.java
deleted file mode 100644
index 2cafc4b5..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/VolumeOptionInfo.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/**
- * VolumeOptionInfo.java
- *
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- */
-package com.gluster.storage.management.core.model;
-
-import javax.xml.bind.annotation.XmlRootElement;
-
-/**
- * Class to hold information about a volume option
- */
-@XmlRootElement(name = "option")
-public class VolumeOptionInfo {
- private String name;
- private String description;
- private String defaultValue;
-
- public VolumeOptionInfo() {
- }
-
- public VolumeOptionInfo(String name, String description, String defaultValue) {
- setName(name);
- setDescription(description);
- setDefaultValue(defaultValue);
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getDefaultValue() {
- return defaultValue;
- }
-
- public void setDefaultValue(String defaultValue) {
- this.defaultValue = defaultValue;
- }
-} \ No newline at end of file
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/VolumeOptions.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/VolumeOptions.java
deleted file mode 100644
index edeec768..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/VolumeOptions.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package com.gluster.storage.management.core.model;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-
-/**
- *
- */
-@XmlRootElement(name="options")
-public class VolumeOptions {
- private List<VolumeOption> options = new ArrayList<VolumeOption>();
-
- public VolumeOptions() {
- }
-
- public String get(String key) {
- for(VolumeOption option : options) {
- if(option.getKey().equals(key)) {
- return option.getValue();
- }
- }
- return null;
- }
-
- public void put(String key, String value) {
- VolumeOption option = getOption(key);
- if(option != null) {
- option.setValue(value);
- } else {
- options.add(new VolumeOption(key, value));
- }
- }
-
- @XmlElement(name="option", type=VolumeOption.class)
- public List<VolumeOption> getOptions() {
- return options;
- }
-
- public void setOptions(List<VolumeOption> options) {
- this.options = options;
- }
-
- public void clear() {
- options.clear();
- }
-
- public boolean remove(String key) {
- return options.remove(getOption(key));
- }
-
- public VolumeOption getOption(String key) {
- for(VolumeOption option : options) {
- if(option.getKey().equals(key)) {
- return option;
- }
- }
- return null;
- }
-
- public int size() {
- return options.size();
- }
-
- public boolean containsKey(String key) {
- return get(key) != null;
- }
-
- @Override
- public boolean equals(Object obj) {
- if(!(obj instanceof VolumeOptions)) {
- return false;
- }
-
- VolumeOptions options = (VolumeOptions)obj;
- if(getOptions().size() != options.size()) {
- return false;
- }
-
- for(VolumeOption option : getOptions()) {
- if(!(option.getValue().equals(options.get(option.getKey())))) {
- return false;
- }
- }
-
- return true;
- }
-
- public void copyFrom(VolumeOptions options) {
- this.options.clear();
- this.options.addAll(options.getOptions());
- }
-} \ No newline at end of file
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/adapters/VolumeLogDateAdapter.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/adapters/VolumeLogDateAdapter.java
deleted file mode 100644
index fac208ad..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/adapters/VolumeLogDateAdapter.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-
-package com.gluster.storage.management.core.model.adapters;
-
-import java.util.Date;
-
-import javax.xml.bind.annotation.adapters.XmlAdapter;
-
-import com.gluster.storage.management.core.utils.DateUtil;
-
-/**
- * Adapter class used for converting timestamp from Gluster volume log files to Date object.
- */
-public class VolumeLogDateAdapter extends XmlAdapter<String, Date> {
- private static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss.SSS";
-
- /* (non-Javadoc)
- * @see javax.xml.bind.annotation.adapters.XmlAdapter#unmarshal(java.lang.Object)
- */
- @Override
- public Date unmarshal(String input) {
- input = input.trim();
- if(input.length() > DATE_FORMAT.length()) {
- input = input.substring(0, DATE_FORMAT.length());
- }
- return DateUtil.stringToDate(input, DATE_FORMAT);
- }
-
- /* (non-Javadoc)
- * @see javax.xml.bind.annotation.adapters.XmlAdapter#marshal(java.lang.Object)
- */
- @Override
- public String marshal(Date input) {
- return DateUtil.dateToString(input, DATE_FORMAT);
- }
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/AbstractResponse.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/AbstractResponse.java
deleted file mode 100644
index 9a6a48f5..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/AbstractResponse.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package com.gluster.storage.management.core.response;
-
-import com.gluster.storage.management.core.model.Response;
-import com.gluster.storage.management.core.model.Status;
-
-public abstract class AbstractResponse implements Response {
- private Status status;
-
- @Override
- public Status getStatus() {
- return status;
- }
-
- public void setStatus(Status status) {
- this.status = status;
- }
-} \ No newline at end of file
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/ClusterNameListResponse.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/ClusterNameListResponse.java
deleted file mode 100644
index 3b10ac86..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/ClusterNameListResponse.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package com.gluster.storage.management.core.response;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-
-/**
- * Response object for transferring cluster names during REST communication. This is just a wrapper over a list of
- * Strings, and is required because the jersey rest framework can't transfer lists directly.
- */
-@XmlRootElement(name="clusters")
-public class ClusterNameListResponse {
-private List<String> clusterNames = new ArrayList<String>();
-
- public ClusterNameListResponse() {
- }
-
- public ClusterNameListResponse(List<String> clusterNames) {
- this.clusterNames = clusterNames;
- }
-
- @XmlElement(name = "cluster", type = String.class)
- public List<String> getClusterNames() {
- return clusterNames;
- }
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/GlusterServerListResponse.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/GlusterServerListResponse.java
deleted file mode 100644
index 868e2fc2..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/GlusterServerListResponse.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * GlusterServerListResponse.java
- *
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- */
-package com.gluster.storage.management.core.response;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import com.gluster.storage.management.core.model.GlusterServer;
-
-/**
- *
- */
-@XmlRootElement(name = "servers")
-public class GlusterServerListResponse {
- private List<GlusterServer> servers = new ArrayList<GlusterServer>();
-
- public GlusterServerListResponse() {
- }
-
- public GlusterServerListResponse(List<GlusterServer> servers) {
- setServers(servers);
- }
-
- @XmlElement(name = "server", type=GlusterServer.class)
- public List<GlusterServer> getServers() {
- return servers;
- }
-
- public void setServers(List<GlusterServer> servers) {
- this.servers = servers;
- }
-}
-
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/GlusterServerResponse.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/GlusterServerResponse.java
deleted file mode 100644
index 7af9b240..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/GlusterServerResponse.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.gluster.storage.management.core.response;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlTransient;
-
-import com.gluster.storage.management.core.model.GlusterServer;
-import com.gluster.storage.management.core.model.Status;
-
-@XmlRootElement(name = "response")
-public class GlusterServerResponse extends AbstractResponse {
- private GlusterServer glusterServer;
-
- public GlusterServerResponse() {
- }
-
- public GlusterServerResponse(Status status, GlusterServer server) {
- setStatus(status);
- setGlusterServer(server);
- }
-
- public GlusterServer getGlusterServer() {
- return glusterServer;
- }
-
- public void setGlusterServer(GlusterServer glusterServer) {
- this.glusterServer = glusterServer;
- }
-
- @XmlTransient
- @Override
- public GlusterServer getData() {
- return getGlusterServer();
- }
-
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/LogMessageListResponse.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/LogMessageListResponse.java
deleted file mode 100644
index 8c362fa9..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/LogMessageListResponse.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- *
- */
-package com.gluster.storage.management.core.response;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import com.gluster.storage.management.core.model.VolumeLogMessage;
-
-@XmlRootElement(name = "logMessages")
-public class LogMessageListResponse {
- private List<VolumeLogMessage> logMessages = new ArrayList<VolumeLogMessage>();
-
- public LogMessageListResponse() {
- }
-
- public LogMessageListResponse(List<VolumeLogMessage> logMessages) {
- setLogMessages(logMessages);
- }
-
- @XmlElement(name = "logMessage", type = VolumeLogMessage.class)
- public List<VolumeLogMessage> getLogMessages() {
- return logMessages;
- }
-
- public void setLogMessages(List<VolumeLogMessage> logMessages) {
- this.logMessages = logMessages;
- }
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/ServerListResponse.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/ServerListResponse.java
deleted file mode 100644
index 05627ab1..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/ServerListResponse.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package com.gluster.storage.management.core.response;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import com.gluster.storage.management.core.model.Server;
-
-@XmlRootElement(name = "servers")
-public class ServerListResponse {
- private List<Server> servers = new ArrayList<Server>();
-
- public ServerListResponse() {
- }
-
- public ServerListResponse(List<Server> servers) {
- setServers(servers);
- }
-
- @XmlElement(name = "server", type=Server.class)
- public List<Server> getServers() {
- return servers;
- }
-
- public void setServers(List<Server> servers) {
- this.servers = servers;
- }
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/ServerNameListResponse.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/ServerNameListResponse.java
deleted file mode 100644
index 2211f29f..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/ServerNameListResponse.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package com.gluster.storage.management.core.response;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-
-/**
- * Response object for transferring cluster names during REST communication. This is just a wrapper over a list of
- * Strings, and is required because the jersey rest framework can't transfer lists directly.
- */
-@XmlRootElement(name="servers")
-public class ServerNameListResponse {
-private List<String> serverNames = new ArrayList<String>();
-
- public ServerNameListResponse() {
- }
-
- public ServerNameListResponse(List<String> serverNames) {
- this.serverNames = serverNames;
- }
-
- @XmlElement(name = "server", type = String.class)
- public List<String> getServerNames() {
- return serverNames;
- }
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/StringListResponse.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/StringListResponse.java
deleted file mode 100644
index 785c6efb..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/StringListResponse.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package com.gluster.storage.management.core.response;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import com.gluster.storage.management.core.model.Status;
-
-@XmlRootElement(name = "response")
-public class StringListResponse extends AbstractResponse {
- private List<String> data = new ArrayList<String>();
-
- public StringListResponse() {
- }
-
- public StringListResponse(List<String> data) {
- this.data = data;
- setStatus(Status.STATUS_SUCCESS);
- }
-
- @Override
- @XmlElementWrapper(name = "list")
- @XmlElement(name = "value", type = String.class)
- public List<String> getData() {
- return data;
- }
-} \ No newline at end of file
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/TaskIdResponse.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/TaskIdResponse.java
deleted file mode 100644
index f2610104..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/TaskIdResponse.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package com.gluster.storage.management.core.response;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-
-/**
- *
- */
-@XmlRootElement(name="task")
-public class TaskIdResponse {
- private String id;
-
- public TaskIdResponse() {
- }
-
- public TaskIdResponse(String id) {
- setId(id);
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- @XmlElement(name="id")
- public String getId() {
- return id;
- }
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/TaskInfoListResponse.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/TaskInfoListResponse.java
deleted file mode 100644
index ba1c4f9f..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/TaskInfoListResponse.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * TaskListResponse.java
- *
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- */
-package com.gluster.storage.management.core.response;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import com.gluster.storage.management.core.model.TaskInfo;
-
-@XmlRootElement(name = "tasks")
-public class TaskInfoListResponse {
- private List<TaskInfo> taskInfoList = new ArrayList<TaskInfo>();
-
- public TaskInfoListResponse() {
-
- }
-
- public TaskInfoListResponse(List<TaskInfo> taskInfoList) {
- this.taskInfoList = taskInfoList;
- }
-
- @XmlElement(name="task", type=TaskInfo.class)
- public List<TaskInfo> getTaskList() {
- return taskInfoList;
- }
-
- public void setTaskList(List<TaskInfo> taskInfoList) {
- this.taskInfoList = taskInfoList;
- }
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/TaskResponse.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/TaskResponse.java
deleted file mode 100755
index a11c9903..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/TaskResponse.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * TaskInfoResponse.java
- *
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- */
-package com.gluster.storage.management.core.response;
-
-import javax.xml.bind.annotation.XmlRootElement;
-
-import com.gluster.storage.management.core.model.Status;
-import com.gluster.storage.management.core.model.TaskInfo;
-
-@XmlRootElement(name = "response")
-public class TaskResponse extends AbstractResponse {
- private TaskInfo taskInfo;
- private Status status;
-
- public TaskResponse() {
- }
-
- public Status getStatus() {
- return status;
- }
-
- public void setStatus(Status status) {
- this.status = status;
- }
-
- public void setData(TaskInfo taskInfo) {
- this.taskInfo = taskInfo;
- }
-
- @Override
- public TaskInfo getData() {
- return taskInfo;
- }
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/VolumeListResponse.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/VolumeListResponse.java
deleted file mode 100644
index 6518f0d5..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/VolumeListResponse.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.gluster.storage.management.core.response;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import com.gluster.storage.management.core.model.Volume;
-
-@XmlRootElement(name = "volumes")
-public class VolumeListResponse {
- private List<Volume> volumes = new ArrayList<Volume>();
-
- public VolumeListResponse() {
-
- }
-
- public VolumeListResponse(List<Volume> volumes) {
- setVolumes(volumes);
- }
-
- @XmlElement(name = "volume", type = Volume.class)
- public List<Volume> getVolumes() {
- return this.volumes;
- }
-
- public void setVolumes(List<Volume> volumes) {
- this.volumes = volumes;
- }
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/VolumeOptionInfoListResponse.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/VolumeOptionInfoListResponse.java
deleted file mode 100644
index dfacf19f..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/response/VolumeOptionInfoListResponse.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package com.gluster.storage.management.core.response;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import com.gluster.storage.management.core.model.VolumeOptionInfo;
-
-@XmlRootElement(name = "options")
-public class VolumeOptionInfoListResponse {
- private List<VolumeOptionInfo> options = new ArrayList<VolumeOptionInfo>();
-
- public VolumeOptionInfoListResponse() {
- }
-
- @XmlElement(name = "option", type=VolumeOptionInfo.class)
- public List<VolumeOptionInfo> getOptions() {
- return options;
- }
-
- public void setOptions(List<VolumeOptionInfo> options) {
- this.options = options;
- }
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/DateUtil.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/DateUtil.java
deleted file mode 100644
index 5fd9ae8b..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/DateUtil.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package com.gluster.storage.management.core.utils;
-
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
-
-import com.gluster.storage.management.core.constants.CoreConstants;
-import com.gluster.storage.management.core.exceptions.GlusterRuntimeException;
-
-public class DateUtil {
-
- /**
- * Formats given date in pure date format (without time component) using default format
- * {@link CoreConstants#PURE_DATE_FORMAT}
- *
- * @param inputDate
- * Date to be formatted
- * @return Formatted String representation of the given date
- */
- public static final String formatDate(Date inputDate) {
- return dateToString(inputDate, CoreConstants.PURE_DATE_FORMAT);
- }
-
- /**
- * Formats given date in pure time format (without date component) using default format
- * {@link CoreConstants#PURE_TIME_FORMAT}
- *
- * @param inputDate
- * Date to be formatted
- * @return Formatted String representation of the given date
- */
- public static final String formatTime(Date inputDate) {
- return dateToString(inputDate, CoreConstants.PURE_TIME_FORMAT);
- }
-
- /**
- * Converts given date object to string by formatting it in given format
- *
- * @param date
- * Date to be formatted
- * @param dateFormat
- * Date format
- * @return String representation of the given Date
- */
- public static final String dateToString(Date date, String dateFormat) {
- SimpleDateFormat dateFormatter = new SimpleDateFormat(dateFormat);
- return dateFormatter.format(date);
- }
-
- /**
- * Converts given date object to string by formatting it using default date format
- * {@link CoreConstants#DATE_WITH_TIME_FORMAT}
- *
- * @param date
- * Date to be formatted
- * @param dateFormat
- * Date format
- * @return String representation of the given Date
- */
- public static final String dateToString(Date date) {
- return dateToString(date, CoreConstants.DATE_WITH_TIME_FORMAT);
- }
-
- /**
- * Converts given string to date using the given date format
- *
- * @param input
- * Input string
- * @param dateFormat
- * The date format to be used
- * @return Date object
- */
- public static final Date stringToDate(String input, String dateFormat) {
- try {
- SimpleDateFormat dateFormatter = new SimpleDateFormat(dateFormat);
- return dateFormatter.parse(input);
- } catch (ParseException e) {
- throw new GlusterRuntimeException("Error trying to parse string [" + input + "] in to date using format ["
- + dateFormat + "]", e);
- }
- }
-
- /**
- * Converts given string to date using the default date format {@link CoreConstants#DATE_WITH_TIME_FORMAT}
- *
- * @param input
- * Input string
- * @return Date object
- */
- public static final Date stringToDate(String input) {
- return stringToDate(input, CoreConstants.DATE_WITH_TIME_FORMAT);
- }
-
- public static final Date getDate(int year, int month, int day, int hour, int min, int sec, int msec) {
- Calendar calendar = Calendar.getInstance();
- calendar.set(year, month-1, day, hour, min, sec);
- calendar.set(Calendar.MILLISECOND, msec);
- return calendar.getTime();
- }
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/FileUtil.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/FileUtil.java
deleted file mode 100644
index 601a3790..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/FileUtil.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package com.gluster.storage.management.core.utils;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.UUID;
-
-import com.gluster.storage.management.core.constants.CoreConstants;
-import com.gluster.storage.management.core.exceptions.GlusterRuntimeException;
-
-public class FileUtil {
- public static String readFileAsString(File file) {
- try {
- return new String(readFileAsByteArray(file), CoreConstants.ENCODING_UTF8);
- } catch (Exception e) {
- e.printStackTrace();
- throw new GlusterRuntimeException("Could not read file [" + file + "]", e);
- }
- }
-
- public static byte[] readFileAsByteArray(File file) {
- try {
- FileInputStream fileInputStream = new FileInputStream(file);
- byte[] data = new byte[fileInputStream.available()];
- fileInputStream.read(data);
- fileInputStream.close();
- return data;
- } catch (Exception e) {
- throw new GlusterRuntimeException("Exception while reading file [" + file.getName() + "]: "
- + e.getMessage(), e);
- }
- }
-
- public static void createTextFile(String fileName, String contents) {
- try {
- FileWriter writer = new FileWriter(fileName);
- writer.write(contents);
- writer.close();
- } catch (Exception e) {
- throw new GlusterRuntimeException("Exception while trying to create text file [" + fileName + "]", e);
- }
- }
-
- public static String getTempDirName() {
- return System.getProperty("java.io.tmpdir");
- }
-
- /**
- * Create a new temporary directory. Use something like
- * {@link #recursiveDelete(File)} to clean this directory up since it isn't
- * deleted automatically
- * @return the new directory
- * @throws IOException if there is an error creating the temporary directory
- */
- public static File createTempDir()
- {
- final File sysTempDir = new File(getTempDirName());
- File newTempDir;
- final int maxAttempts = 9;
- int attemptCount = 0;
- do
- {
- attemptCount++;
- if(attemptCount > maxAttempts)
- {
- throw new GlusterRuntimeException(
- "The highly improbable has occurred! Failed to " +
- "create a unique temporary directory after " +
- maxAttempts + " attempts.");
- }
- String dirName = UUID.randomUUID().toString();
- newTempDir = new File(sysTempDir, dirName);
- } while(newTempDir.exists());
-
- if(newTempDir.mkdirs())
- {
- return newTempDir;
- }
- else
- {
- throw new GlusterRuntimeException(
- "Failed to create temp dir named " +
- newTempDir.getAbsolutePath());
- }
- }
-
- /**
- * Recursively delete file or directory
- *
- * @param fileOrDir
- * the file or dir to delete
- * @return true if all files are successfully deleted
- */
- public static void recursiveDelete(File fileOrDir)
- {
- if(fileOrDir.isDirectory())
- {
- // recursively delete contents
- for(File innerFile: fileOrDir.listFiles())
- {
- recursiveDelete(innerFile);
- }
- }
-
- if(!fileOrDir.delete()) {
- throw new GlusterRuntimeException("Couldn't delete file/directory [" + fileOrDir + "]");
- }
- }
-
- public static void renameFile(String fromPath, String toPath) {
- File fromFile = new File(fromPath);
- File toFile = new File(toPath);
-
- if(!fromFile.renameTo(toFile)) {
- throw new GlusterRuntimeException("Couldn't rename [" + fromFile + "] to [" + toFile + "]");
- }
- }
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/GlusterCoreUtil.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/GlusterCoreUtil.java
deleted file mode 100644
index 39794b79..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/GlusterCoreUtil.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/**
- * GlusterCoreUtil.java
- *
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- */
-package com.gluster.storage.management.core.utils;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import com.gluster.storage.management.core.model.Brick;
-import com.gluster.storage.management.core.model.Disk;
-import com.gluster.storage.management.core.model.Entity;
-import com.gluster.storage.management.core.model.Partition;
-import com.gluster.storage.management.core.model.Server;
-
-
-public class GlusterCoreUtil {
- // Convert from Disk list to Qualified disk name list
- public static final List<String> getQualifiedDiskNames(List<Disk> diskList) {
- List<String> qualifiedDiskNames = new ArrayList<String>();
- for (Disk disk : diskList) {
- qualifiedDiskNames.add(disk.getQualifiedName());
- }
- return qualifiedDiskNames;
- }
-
- public static final List<String> getQualifiedBrickList(Set<Brick> bricks) {
- List<String> qualifiedBricks = new ArrayList<String>();
- for (Brick brick : bricks) {
- qualifiedBricks.add(brick.getQualifiedName());
- }
- return qualifiedBricks;
- }
-
- /**
- * Compares the two entity lists and returns the list of entities from first list that have been modified in the second
- *
- * @param oldEntities
- * @param newEntities
- * @return List of entities that have been modified
- */
- public static <T extends Entity> Map<T, T> getModifiedEntities(List<T> oldEntities, List<T> newEntities) {
- Map<T, T> modifiedEntities = new HashMap<T, T>();
- for (T oldEntity : oldEntities) {
- T newEntity = getEntity(newEntities, oldEntity.getName(), false);
- if(newEntity != null && !oldEntity.equals(newEntity)) {
- // old and new entities differ. mark it as modified.
- modifiedEntities.put(oldEntity, newEntity);
- }
- }
- return modifiedEntities;
- }
-
- /**
- * Compares the two entity lists and returns the list of entities present only in the second argument
- * <code>newEntities</code>
- *
- * @param oldEntities
- * @param newEntities
- * @param caseInsensitive If true, the entity name comparison will be done in case insensitive manner
- * @return List of entities that are present only in the second argument <code>newEntities</code>
- */
- public static <T extends Entity> Set<T> getAddedEntities(List<T> oldEntities, List<T> newEntities,
- boolean caseInsensitive) {
- Set<T> addedEntities = new HashSet<T>();
- for (T newEntity : newEntities) {
- if (!containsEntity(oldEntities, newEntity, caseInsensitive)) {
- // old entity list doesn't contain this entity. mark it as new.
- addedEntities.add(newEntity);
- }
- }
- return addedEntities;
- }
-
- public static <T extends Entity> boolean containsEntity(List<T> entityList, Entity searchEntity,
- boolean caseInsensitive) {
- return getEntity(entityList, searchEntity.getName(), caseInsensitive) != null;
- }
-
- public static <T extends Entity> boolean containsEntityWithName(List<T> entityList, String searchName,
- boolean caseInsensitive) {
- return getEntity(entityList, searchName, caseInsensitive) != null;
- }
-
- public static <T extends Entity> T getEntity(Collection<T> entityList, String searchEntityName, boolean caseInsensitive) {
- for (T entity : entityList) {
- String nextEntityName = entity.getName();
- if (nextEntityName.equals(searchEntityName)
- || (caseInsensitive && nextEntityName.equalsIgnoreCase(searchEntityName))) {
- return entity;
- }
- }
-
- return null;
- }
-
- public static void updateServerNameOnDevices(Server server) {
- String serverName = server.getName();
- for(Disk disk : server.getDisks()) {
- disk.setServerName(serverName);
-
- if (disk.getRaidDisks() != null) {
- for (Disk raidDisk : disk.getRaidDisks()) {
- raidDisk.setServerName(serverName);
- }
- }
-
- if (disk.getPartitions() != null) {
- for (Partition partition : disk.getPartitions()) {
- partition.setServerName(serverName);
- }
- }
- }
- }
-
- /**
- * Skips (removes) the entities from given list till (including) the given {@code tillServer}, upto a maximum of
- * {@code maxCount} entities<br>
- *
- * @param entities
- * List of entities to be pruned
- * @param maxCount
- * Maximum number of entities to be returned
- * @param tillEntity
- * A list of entities after skipping the ones appearing before, and including {@code tillEntity}. If the
- * resulting list is bigger than {@code maxCount}, then the first {@code maxCount} number of entities
- * will be returned.
- */
- public static <T extends Entity> List<T> skipEntities(List<T> entities, Integer maxCount, String tillEntity) {
- List<T> servers = skipEntitiesTill(entities, tillEntity);
- return skipEntitiesByMaxCount(servers, maxCount);
- }
-
- /**
- * Removes extra entities from given list to return the first (or maximum of) {@code maxCount} entities<br>
- *
- * @param entities
- * List of entities to be pruned
- * @param maxCount
- * Maximum number of entities to be returned
- * @param tillEntity
- * the first (or a maximum of) {@code maxCount} entities from the given list
- */
- public static <T extends Entity> List<T> skipEntitiesByMaxCount(List<T> entities, Integer maxCount) {
- if(maxCount == null || maxCount <= 0 || maxCount > entities.size()) {
- return entities;
- }
-
- return entities.subList(0, maxCount);
- }
-
- /**
- * Skips (removes) the entities from given list till (including) the given entity. <br>
- *
- * @param entities
- * List of entities to be pruned
- * @param tillEntity
- * A list of entities after skipping the ones appearing before, and including {@code tillEntity}
- */
- public static <T extends Entity> List<T> skipEntitiesTill(List<T> entities, String tillEntity) {
- if(tillEntity == null) {
- return entities;
- }
-
- int index = indexOfEntity(entities, tillEntity);
- if(index == -1) {
- // given entity not found. return an empty list.
- return new ArrayList<T>();
- } else {
- return entities.subList(index + 1, entities.size());
- }
- }
-
- public static <T extends Entity> int indexOfEntity(List<T> entities, String entityName) {
- int index = -1;
- for(int i = 0; i < entities.size(); i++) {
- if(entities.get(i).getName().equalsIgnoreCase(entityName)) {
- index = i;
- break;
- }
- }
- return index;
- }
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/JavaUtil.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/JavaUtil.java
deleted file mode 100644
index fe2fc860..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/JavaUtil.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package com.gluster.storage.management.core.utils;
-
-import java.util.List;
-
-/**
- *
- */
-public class JavaUtil {
- @SuppressWarnings("rawtypes")
- public static boolean listsDiffer(List list1, List list2) {
- if(list1.size() != list2.size()) {
- return true;
- }
-
- for(Object obj : list1) {
- if(!list2.contains(obj)) {
- return true;
- }
- }
-
- return false;
- }
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/LRUCache.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/LRUCache.java
deleted file mode 100644
index f3c9c72d..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/LRUCache.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * LRUCache.java
- *
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- */
-package com.gluster.storage.management.core.utils;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-/**
- * An LRU cache, based on <code>LinkedHashMap</code>.
- * <p>
- * This cache has a fixed maximum number of elements (<code>cacheSize</code>). If the cache is full and another entry is
- * added, the LRU (least recently used) entry is dropped.
- *
- */
-public class LRUCache<K, V> extends LinkedHashMap<K, V> {
-
- private static final long serialVersionUID = 1L;
- private static final float loadFactor = 0.75f;
- private int cacheSize;
-
- /**
- * Creates a new LRU cache.
- *
- * @param cacheSize
- * the maximum number of entries that will be kept in this cache.
- */
- public LRUCache(int cacheSize) {
- super((int) Math.ceil(cacheSize / loadFactor) + 1, loadFactor, true);
- this.cacheSize = cacheSize;
- }
-
- @Override
- protected boolean removeEldestEntry(Map.Entry<K, V> eldest) {
- return size() > cacheSize;
- }
-
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/MD5.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/MD5.java
deleted file mode 100644
index e0daaf81..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/MD5.java
+++ /dev/null
@@ -1,504 +0,0 @@
-/*
- * MD5 in Java JDK Beta-2
- * written Santeri Paavolainen, Helsinki Finland 1996
- * (c) Santeri Paavolainen, Helsinki Finland 1996
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *
- * See http://www.cs.hut.fi/~santtu/java/ for more information on this
- * class.
- *
- * This is rather straight re-implementation of the reference implementation
- * given in RFC1321 by RSA.
- *
- * Passes MD5 test suite as defined in RFC1321.
- *
- *
- * This Java class has been derivedfrom the RSA Data Security, Inc. MD5
- * Message-Digest Algorithm and its reference implementation.
- *
- *
- * $Log: MD5.java,v $
- * Revision 1.1 2004/07/12 13:35:20 aubryp
- * initial commit
- *
- * Revision 1.3 2002/03/16 01:46:39 broccol
- * Moved the MD5 classes into the md5 package to make 1.4 javac happy
- *
- * Revision 1.2 1999/11/04 21:38:00 broccol
- * Got MD5Crypt calculating the same hash as the OpenBSD md5crypt.c routine.
- *
- * Revision 1.1 1999/08/05 22:07:03 broccol
- * Added support for the MD5 classes.
- *
- * Revision 1.3 1996/04/15 07:28:09 santtu
- * Added GPL statements, and RSA derivate statements.
- *
- * Revision 1.2 1996/03/04 08:05:48 santtu
- * Added offsets to Update method
- *
- * Revision 1.1 1996/01/07 20:51:59 santtu
- * Initial revision
- *
- */
-package com.gluster.storage.management.core.utils;
-
-/**
- * Contains internal state of the MD5 class
- *
- * @author Santeri Paavolainen <sjpaavol@cc.helsinki.fi>
- */
-
-class MD5State {
- /**
- * 128-byte state
- */
- int state[];
-
- /**
- * 64-bit character count (could be true Java long?)
- */
- int count[];
-
- /**
- * 64-byte buffer (512 bits) for storing to-be-hashed characters
- */
- byte buffer[];
-
- public MD5State() {
- buffer = new byte[64];
- count = new int[2];
- state = new int[4];
-
- state[0] = 0x67452301;
- state[1] = 0xefcdab89;
- state[2] = 0x98badcfe;
- state[3] = 0x10325476;
-
- count[0] = count[1] = 0;
- }
-
- /** Create this State as a copy of another state */
- public MD5State(MD5State from) {
- this ();
-
- int i;
-
- for (i = 0; i < buffer.length; i++)
- this .buffer[i] = from.buffer[i];
-
- for (i = 0; i < state.length; i++)
- this .state[i] = from.state[i];
-
- for (i = 0; i < count.length; i++)
- this .count[i] = from.count[i];
- }
-};
-
-/**
- * Implementation of RSA's MD5 hash generator
- *
- * @version $Revision: 1.1 $
- * @author Santeri Paavolainen <sjpaavol@cc.helsinki.fi>
- */
-
-public class MD5 {
- /**
- * MD5 state
- */
- MD5State state;
-
- /**
- * If Final() has been called, finals is set to the current finals
- * state. Any Update() causes this to be set to null.
- */
- MD5State finals;
-
- /**
- * Padding for Final()
- */
- static byte padding[] = { (byte) 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
-
- /**
- * Initialize MD5 internal state (object can be reused just by
- * calling Init() after every Final()
- */
- public synchronized void Init() {
- state = new MD5State();
- finals = null;
- }
-
- /**
- * Class constructor
- */
- public MD5() {
- this .Init();
- }
-
- /**
- * Initialize class, and update hash with ob.toString()
- *
- * @param ob Object, ob.toString() is used to update hash
- * after initialization
- */
- public MD5(Object ob) {
- this ();
- Update(ob.toString());
- }
-
- public String debugDump() {
- return asHex();
- }
-
- private int rotate_left(int x, int n) {
- return (x << n) | (x >>> (32 - n));
- }
-
- /* I wonder how many loops and hoops you'll have to go through to
- get unsigned add for longs in java */
-
- private int uadd(int a, int b) {
- long aa, bb;
- aa = ((long) a) & 0xffffffffL;
- bb = ((long) b) & 0xffffffffL;
-
- aa += bb;
-
- return (int) (aa & 0xffffffffL);
- }
-
- private int uadd(int a, int b, int c) {
- return uadd(uadd(a, b), c);
- }
-
- private int uadd(int a, int b, int c, int d) {
- return uadd(uadd(a, b, c), d);
- }
-
- private int FF(int a, int b, int c, int d, int x, int s, int ac) {
- a = uadd(a, ((b & c) | (~b & d)), x, ac);
- return uadd(rotate_left(a, s), b);
- }
-
- private int GG(int a, int b, int c, int d, int x, int s, int ac) {
- a = uadd(a, ((b & d) | (c & ~d)), x, ac);
- return uadd(rotate_left(a, s), b);
- }
-
- private int HH(int a, int b, int c, int d, int x, int s, int ac) {
- a = uadd(a, (b ^ c ^ d), x, ac);
- return uadd(rotate_left(a, s), b);
- }
-
- private int II(int a, int b, int c, int d, int x, int s, int ac) {
- a = uadd(a, (c ^ (b | ~d)), x, ac);
- return uadd(rotate_left(a, s), b);
- }
-
- private int[] Decode(byte buffer[], int len, int shift) {
- int out[];
- int i, j;
-
- out = new int[16];
-
- for (i = j = 0; j < len; i++, j += 4) {
- out[i] = ((int) (buffer[j + shift] & 0xff))
- | (((int) (buffer[j + 1 + shift] & 0xff)) << 8)
- | (((int) (buffer[j + 2 + shift] & 0xff)) << 16)
- | (((int) (buffer[j + 3 + shift] & 0xff)) << 24);
- }
-
- return out;
- }
-
- private void Transform(MD5State state, byte buffer[], int shift) {
- int a = state.state[0], b = state.state[1], c = state.state[2], d = state.state[3], x[];
-
- x = Decode(buffer, 64, shift);
-
- /* Round 1 */
- a = FF(a, b, c, d, x[0], 7, 0xd76aa478); /* 1 */
- d = FF(d, a, b, c, x[1], 12, 0xe8c7b756); /* 2 */
- c = FF(c, d, a, b, x[2], 17, 0x242070db); /* 3 */
- b = FF(b, c, d, a, x[3], 22, 0xc1bdceee); /* 4 */
- a = FF(a, b, c, d, x[4], 7, 0xf57c0faf); /* 5 */
- d = FF(d, a, b, c, x[5], 12, 0x4787c62a); /* 6 */
- c = FF(c, d, a, b, x[6], 17, 0xa8304613); /* 7 */
- b = FF(b, c, d, a, x[7], 22, 0xfd469501); /* 8 */
- a = FF(a, b, c, d, x[8], 7, 0x698098d8); /* 9 */
- d = FF(d, a, b, c, x[9], 12, 0x8b44f7af); /* 10 */
- c = FF(c, d, a, b, x[10], 17, 0xffff5bb1); /* 11 */
- b = FF(b, c, d, a, x[11], 22, 0x895cd7be); /* 12 */
- a = FF(a, b, c, d, x[12], 7, 0x6b901122); /* 13 */
- d = FF(d, a, b, c, x[13], 12, 0xfd987193); /* 14 */
- c = FF(c, d, a, b, x[14], 17, 0xa679438e); /* 15 */
- b = FF(b, c, d, a, x[15], 22, 0x49b40821); /* 16 */
-
- /* Round 2 */
- a = GG(a, b, c, d, x[1], 5, 0xf61e2562); /* 17 */
- d = GG(d, a, b, c, x[6], 9, 0xc040b340); /* 18 */
- c = GG(c, d, a, b, x[11], 14, 0x265e5a51); /* 19 */
- b = GG(b, c, d, a, x[0], 20, 0xe9b6c7aa); /* 20 */
- a = GG(a, b, c, d, x[5], 5, 0xd62f105d); /* 21 */
- d = GG(d, a, b, c, x[10], 9, 0x2441453); /* 22 */
- c = GG(c, d, a, b, x[15], 14, 0xd8a1e681); /* 23 */
- b = GG(b, c, d, a, x[4], 20, 0xe7d3fbc8); /* 24 */
- a = GG(a, b, c, d, x[9], 5, 0x21e1cde6); /* 25 */
- d = GG(d, a, b, c, x[14], 9, 0xc33707d6); /* 26 */
- c = GG(c, d, a, b, x[3], 14, 0xf4d50d87); /* 27 */
- b = GG(b, c, d, a, x[8], 20, 0x455a14ed); /* 28 */
- a = GG(a, b, c, d, x[13], 5, 0xa9e3e905); /* 29 */
- d = GG(d, a, b, c, x[2], 9, 0xfcefa3f8); /* 30 */
- c = GG(c, d, a, b, x[7], 14, 0x676f02d9); /* 31 */
- b = GG(b, c, d, a, x[12], 20, 0x8d2a4c8a); /* 32 */
-
- /* Round 3 */
- a = HH(a, b, c, d, x[5], 4, 0xfffa3942); /* 33 */
- d = HH(d, a, b, c, x[8], 11, 0x8771f681); /* 34 */
- c = HH(c, d, a, b, x[11], 16, 0x6d9d6122); /* 35 */
- b = HH(b, c, d, a, x[14], 23, 0xfde5380c); /* 36 */
- a = HH(a, b, c, d, x[1], 4, 0xa4beea44); /* 37 */
- d = HH(d, a, b, c, x[4], 11, 0x4bdecfa9); /* 38 */
- c = HH(c, d, a, b, x[7], 16, 0xf6bb4b60); /* 39 */
- b = HH(b, c, d, a, x[10], 23, 0xbebfbc70); /* 40 */
- a = HH(a, b, c, d, x[13], 4, 0x289b7ec6); /* 41 */
- d = HH(d, a, b, c, x[0], 11, 0xeaa127fa); /* 42 */
- c = HH(c, d, a, b, x[3], 16, 0xd4ef3085); /* 43 */
- b = HH(b, c, d, a, x[6], 23, 0x4881d05); /* 44 */
- a = HH(a, b, c, d, x[9], 4, 0xd9d4d039); /* 45 */
- d = HH(d, a, b, c, x[12], 11, 0xe6db99e5); /* 46 */
- c = HH(c, d, a, b, x[15], 16, 0x1fa27cf8); /* 47 */
- b = HH(b, c, d, a, x[2], 23, 0xc4ac5665); /* 48 */
-
- /* Round 4 */
- a = II(a, b, c, d, x[0], 6, 0xf4292244); /* 49 */
- d = II(d, a, b, c, x[7], 10, 0x432aff97); /* 50 */
- c = II(c, d, a, b, x[14], 15, 0xab9423a7); /* 51 */
- b = II(b, c, d, a, x[5], 21, 0xfc93a039); /* 52 */
- a = II(a, b, c, d, x[12], 6, 0x655b59c3); /* 53 */
- d = II(d, a, b, c, x[3], 10, 0x8f0ccc92); /* 54 */
- c = II(c, d, a, b, x[10], 15, 0xffeff47d); /* 55 */
- b = II(b, c, d, a, x[1], 21, 0x85845dd1); /* 56 */
- a = II(a, b, c, d, x[8], 6, 0x6fa87e4f); /* 57 */
- d = II(d, a, b, c, x[15], 10, 0xfe2ce6e0); /* 58 */
- c = II(c, d, a, b, x[6], 15, 0xa3014314); /* 59 */
- b = II(b, c, d, a, x[13], 21, 0x4e0811a1); /* 60 */
- a = II(a, b, c, d, x[4], 6, 0xf7537e82); /* 61 */
- d = II(d, a, b, c, x[11], 10, 0xbd3af235); /* 62 */
- c = II(c, d, a, b, x[2], 15, 0x2ad7d2bb); /* 63 */
- b = II(b, c, d, a, x[9], 21, 0xeb86d391); /* 64 */
-
- state.state[0] += a;
- state.state[1] += b;
- state.state[2] += c;
- state.state[3] += d;
- }
-
- /**
- * Updates hash with the bytebuffer given (using at maximum length bytes from
- * that buffer)
- *
- * @param stat Which state is updated
- * @param buffer Array of bytes to be hashed
- * @param offset Offset to buffer array
- * @param length Use at maximum `length' bytes (absolute
- * maximum is buffer.length)
- */
- public void Update(MD5State stat, byte buffer[], int offset,
- int length) {
- int index, partlen, i, start;
-
- finals = null;
-
- /* Length can be told to be shorter, but not inter */
- if ((length - offset) > buffer.length)
- length = buffer.length - offset;
-
- /* compute number of bytes mod 64 */
- index = (int) (stat.count[0] >>> 3) & 0x3f;
-
- if ((stat.count[0] += (length << 3)) < (length << 3))
- stat.count[1]++;
-
- stat.count[1] += length >>> 29;
-
- partlen = 64 - index;
-
- if (length >= partlen) {
- for (i = 0; i < partlen; i++)
- stat.buffer[i + index] = buffer[i + offset];
-
- Transform(stat, stat.buffer, 0);
-
- for (i = partlen; (i + 63) < length; i += 64)
- Transform(stat, buffer, i);
-
- index = 0;
- } else
- i = 0;
-
- /* buffer remaining input */
- if (i < length) {
- start = i;
- for (; i < length; i++)
- stat.buffer[index + i - start] = buffer[i + offset];
- }
- }
-
- /*
- * Update()s for other datatypes than byte[] also. Update(byte[], int)
- * is only the main driver.
- */
-
- /**
- * Plain update, updates this object
- */
-
- public void Update(byte buffer[], int offset, int length) {
- Update(this .state, buffer, offset, length);
- }
-
- public void Update(byte buffer[], int length) {
- Update(this .state, buffer, 0, length);
- }
-
- /**
- * Updates hash with given array of bytes
- *
- * @param buffer Array of bytes to use for updating the hash
- */
- public void Update(byte buffer[]) {
- Update(buffer, 0, buffer.length);
- }
-
- /**
- * Updates hash with a single byte
- *
- * @param b Single byte to update the hash
- */
- public void Update(byte b) {
- byte buffer[] = new byte[1];
- buffer[0] = b;
-
- Update(buffer, 1);
- }
-
- /**
- * Update buffer with given string.
- *
- * @param s String to be update to hash (is used as
- * s.getBytes())
- */
- public void Update(String s) {
- byte chars[];
-
- chars = s.getBytes();
-
- Update(chars, chars.length);
- }
-
- private byte[] Encode(int input[], int len) {
- int i, j;
- byte out[];
-
- out = new byte[len];
-
- for (i = j = 0; j < len; i++, j += 4) {
- out[j] = (byte) (input[i] & 0xff);
- out[j + 1] = (byte) ((input[i] >>> 8) & 0xff);
- out[j + 2] = (byte) ((input[i] >>> 16) & 0xff);
- out[j + 3] = (byte) ((input[i] >>> 24) & 0xff);
- }
-
- return out;
- }
-
- /**
- * Returns array of bytes (16 bytes) representing hash as of the
- * current state of this object. Note: getting a hash does not
- * invalidate the hash object, it only creates a copy of the real
- * state which is finalized.
- *
- * @return Array of 16 bytes, the hash of all updated bytes
- */
- public synchronized byte[] Final() {
- byte bits[];
- int index, padlen;
- MD5State fin;
-
- if (finals == null) {
- fin = new MD5State(state);
-
- bits = Encode(fin.count, 8);
-
- index = (int) ((fin.count[0] >>> 3) & 0x3f);
- padlen = (index < 56) ? (56 - index) : (120 - index);
-
- Update(fin, padding, 0, padlen);
- /**/
- Update(fin, bits, 0, 8);
-
- /* Update() sets finalds to null */
- finals = fin;
- }
-
- return Encode(finals.state, 16);
- }
-
- /**
- * Turns array of bytes into string representing each byte as
- * unsigned hex number.
- *
- * @param hash Array of bytes to convert to hex-string
- * @return Generated hex string
- */
- public static String asHex(byte hash[]) {
- StringBuffer buf = new StringBuffer(hash.length * 2);
- int i;
-
- for (i = 0; i < hash.length; i++) {
- if (((int) hash[i] & 0xff) < 0x10)
- buf.append("0");
-
- buf.append(Long.toString((int) hash[i] & 0xff, 16));
- }
-
- return buf.toString();
- }
-
- /**
- * Returns 32-character hex representation of this objects hash
- *
- * @return String of this object's hash
- */
- public String asHex() {
- return asHex(this .Final());
- }
-
- /**
- * One-stop md5 string encrypting.
- */
-
- public static String md5crypt(String input) {
- MD5 md5 = new MD5();
- md5.Init();
- md5.Update(input);
- return md5.asHex();
- }
-} \ No newline at end of file
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/MD5Crypt.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/MD5Crypt.java
deleted file mode 100644
index 25c757a2..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/MD5Crypt.java
+++ /dev/null
@@ -1,339 +0,0 @@
-/*------------------------------------------------------------------------------
- class
- MD5Crypt
- ------------------------------------------------------------------------------*/
-
-package com.gluster.storage.management.core.utils;
-
-
-/**
- * <p>This class defines a method,
- * {@link MD5Crypt#crypt(java.lang.String, java.lang.String) crypt()}, which
- * takes a password and a salt string and generates an OpenBSD/FreeBSD/Linux-compatible
- * md5-encoded password entry.</p>
- *
- * <p>Created: 3 November 1999</p>
- * <p>Release: $Name: $</p>
- * <p>Version: $Revision: 1.1 $</p>
- * <p>Last Mod Date: $Date: 2004/07/12 13:35:20 $</p>
- * <p>Java Code By: Jonathan Abbey, jonabbey@arlut.utexas.edu</p>
- * <p>Original C Version:<pre>
- * ----------------------------------------------------------------------------
- * "THE BEER-WARE LICENSE" (Revision 42):
- * <phk@login.dknet.dk> wrote this file. As long as you retain this notice you
- * can do whatever you want with this stuff. If we meet some day, and you think
- * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
- * ----------------------------------------------------------------------------
- * </pre></p>
- *
- * @author Jonathan Abbey <jonabbey at arlut.utexas.edu>
- */
-public final class MD5Crypt {
-
- /**
- *
- * Command line test rig.
- *
- */
-
- static public void main(String argv[]) {
- if ((argv.length < 1) || (argv.length > 3)) {
- System.err
- .println("Usage: MD5Crypt [-apache] password salt");
- System.exit(1);
- }
-
- if (argv.length == 3) {
- System.err.println(MD5Crypt.apacheCrypt(argv[1], argv[2]));
- } else if (argv.length == 2) {
- System.err.println(MD5Crypt.crypt(argv[0], argv[1]));
- } else {
- System.err.println(MD5Crypt.crypt(argv[0]));
- }
-
- System.exit(0);
- }
-
- static private final String SALTCHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
-
- static private final String itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
-
- static private final String to64(long v, int size) {
- StringBuffer result = new StringBuffer();
-
- while (--size >= 0) {
- result.append(itoa64.charAt((int) (v & 0x3f)));
- v >>>= 6;
- }
-
- return result.toString();
- }
-
- static private final void clearbits(byte bits[]) {
- for (int i = 0; i < bits.length; i++) {
- bits[i] = 0;
- }
- }
-
- /**
- * convert an encoded unsigned byte value into a int
- * with the unsigned value.
- */
-
- static private final int bytes2u(byte inp) {
- return (int) inp & 0xff;
- }
-
- /**
- * <p>This method actually generates a OpenBSD/FreeBSD/Linux PAM compatible
- * md5-encoded password hash from a plaintext password and a
- * salt.</p>
- *
- * <p>The resulting string will be in the form '$1$&lt;salt&gt;$&lt;hashed mess&gt;</p>
- *
- * @param password Plaintext password
- *
- * @return An OpenBSD/FreeBSD/Linux-compatible md5-hashed password field.
- */
-
- static public final String crypt(String password) {
- StringBuffer salt = new StringBuffer();
- java.util.Random randgen = new java.util.Random();
-
- /* -- */
-
- while (salt.length() < 8) {
- int index = (int) (randgen.nextFloat() * SALTCHARS.length());
- salt.append(SALTCHARS.substring(index, index + 1));
- }
-
- return MD5Crypt.crypt(password, salt.toString());
- }
-
- /**
- * <p>This method actually generates a OpenBSD/FreeBSD/Linux PAM compatible
- * md5-encoded password hash from a plaintext password and a
- * salt.</p>
- *
- * <p>The resulting string will be in the form '$1$&lt;salt&gt;$&lt;hashed mess&gt;</p>
- *
- * @param password Plaintext password
- * @param salt A short string to use to randomize md5. May start with $1$, which
- * will be ignored. It is explicitly permitted to pass a pre-existing
- * MD5Crypt'ed password entry as the salt. crypt() will strip the salt
- * chars out properly.
- *
- * @return An OpenBSD/FreeBSD/Linux-compatible md5-hashed password field.
- */
-
- static public final String crypt(String password, String salt) {
- return MD5Crypt.crypt(password, salt, "$1$");
- }
-
- /**
- * <p>This method generates an Apache MD5 compatible
- * md5-encoded password hash from a plaintext password and a
- * salt.</p>
- *
- * <p>The resulting string will be in the form '$apr1$&lt;salt&gt;$&lt;hashed mess&gt;</p>
- *
- * @param password Plaintext password
- *
- * @return An Apache-compatible md5-hashed password string.
- */
-
- static public final String apacheCrypt(String password) {
- StringBuffer salt = new StringBuffer();
- java.util.Random randgen = new java.util.Random();
-
- /* -- */
-
- while (salt.length() < 8) {
- int index = (int) (randgen.nextFloat() * SALTCHARS.length());
- salt.append(SALTCHARS.substring(index, index + 1));
- }
-
- return MD5Crypt.apacheCrypt(password, salt.toString());
- }
-
- /**
- * <p>This method actually generates an Apache MD5 compatible
- * md5-encoded password hash from a plaintext password and a
- * salt.</p>
- *
- * <p>The resulting string will be in the form '$apr1$&lt;salt&gt;$&lt;hashed mess&gt;</p>
- *
- * @param password Plaintext password
- * @param salt A short string to use to randomize md5. May start with $apr1$, which
- * will be ignored. It is explicitly permitted to pass a pre-existing
- * MD5Crypt'ed password entry as the salt. crypt() will strip the salt
- * chars out properly.
- *
- * @return An Apache-compatible md5-hashed password string.
- */
-
- static public final String apacheCrypt(String password, String salt) {
- return MD5Crypt.crypt(password, salt, "$apr1$");
- }
-
- /**
- * <p>This method actually generates md5-encoded password hash from
- * a plaintext password, a salt, and a magic string.</p>
- *
- * <p>There are two magic strings that make sense to use here.. '$1$' is the
- * magic string used by the FreeBSD/Linux/OpenBSD MD5Crypt algorithm, and
- * '$apr1$' is the magic string used by the Apache MD5Crypt algorithm.</p>
- *
- * <p>The resulting string will be in the form '&lt;magic&gt;&lt;salt&gt;$&lt;hashed mess&gt;</p>
- *
- * @param password Plaintext password @param salt A short string to
- * use to randomize md5. May start with the magic string, which
- * will be ignored. It is explicitly permitted to pass a
- * pre-existing MD5Crypt'ed password entry as the salt. crypt()
- * will strip the salt chars out properly.
- *
- * @return An md5-hashed password string.
- */
-
- static public final String crypt(String password, String salt,
- String magic) {
- /* This string is magic for this algorithm. Having it this way,
- * we can get get better later on */
-
- byte finalState[];
- MD5 ctx, ctx1;
- long l;
-
- /* -- */
-
- /* Refine the Salt first */
-
- /* If it starts with the magic string, then skip that */
-
- if (salt.startsWith(magic)) {
- salt = salt.substring(magic.length());
- }
-
- /* It stops at the first '$', max 8 chars */
-
- if (salt.indexOf('$') != -1) {
- salt = salt.substring(0, salt.indexOf('$'));
- }
-
- if (salt.length() > 8) {
- salt = salt.substring(0, 8);
- }
-
- ctx = new MD5();
-
- ctx.Update(password); // The password first, since that is what is most unknown
- ctx.Update(magic); // Then our magic string
- ctx.Update(salt); // Then the raw salt
-
- /* Then just as many characters of the MD5(pw,salt,pw) */
-
- ctx1 = new MD5();
- ctx1.Update(password);
- ctx1.Update(salt);
- ctx1.Update(password);
- finalState = ctx1.Final();
-
- for (int pl = password.length(); pl > 0; pl -= 16) {
- ctx.Update(finalState, pl > 16 ? 16 : pl);
- }
-
- /* the original code claimed that finalState was being cleared
- to keep dangerous bits out of memory, but doing this is also
- required in order to get the right output. */
-
- clearbits(finalState);
-
- /* Then something really weird... */
-
- for (int i = password.length(); i != 0; i >>>= 1) {
- if ((i & 1) != 0) {
- ctx.Update(finalState, 1);
- } else {
- ctx.Update(password.getBytes(), 1);
- }
- }
-
- finalState = ctx.Final();
-
- /*
- * and now, just to make sure things don't run too fast
- * On a 60 Mhz Pentium this takes 34 msec, so you would
- * need 30 seconds to build a 1000 entry dictionary...
- *
- * (The above timings from the C version)
- */
-
- for (int i = 0; i < 1000; i++) {
- ctx1 = new MD5();
-
- if ((i & 1) != 0) {
- ctx1.Update(password);
- } else {
- ctx1.Update(finalState, 16);
- }
-
- if ((i % 3) != 0) {
- ctx1.Update(salt);
- }
-
- if ((i % 7) != 0) {
- ctx1.Update(password);
- }
-
- if ((i & 1) != 0) {
- ctx1.Update(finalState, 16);
- } else {
- ctx1.Update(password);
- }
-
- finalState = ctx1.Final();
- }
-
- /* Now make the output string */
-
- StringBuffer result = new StringBuffer();
-
- result.append(magic);
- result.append(salt);
- result.append("$");
-
- l = (bytes2u(finalState[0]) << 16)
- | (bytes2u(finalState[6]) << 8)
- | bytes2u(finalState[12]);
- result.append(to64(l, 4));
-
- l = (bytes2u(finalState[1]) << 16)
- | (bytes2u(finalState[7]) << 8)
- | bytes2u(finalState[13]);
- result.append(to64(l, 4));
-
- l = (bytes2u(finalState[2]) << 16)
- | (bytes2u(finalState[8]) << 8)
- | bytes2u(finalState[14]);
- result.append(to64(l, 4));
-
- l = (bytes2u(finalState[3]) << 16)
- | (bytes2u(finalState[9]) << 8)
- | bytes2u(finalState[15]);
- result.append(to64(l, 4));
-
- l = (bytes2u(finalState[4]) << 16)
- | (bytes2u(finalState[10]) << 8)
- | bytes2u(finalState[5]);
- result.append(to64(l, 4));
-
- l = bytes2u(finalState[11]);
- result.append(to64(l, 2));
-
- /* Don't leave anything around in vm they could use. */
- clearbits(finalState);
-
- return result.toString();
- }
-}
-
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/NumberUtil.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/NumberUtil.java
deleted file mode 100644
index 9b1cd5e2..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/NumberUtil.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package com.gluster.storage.management.core.utils;
-
-import java.text.NumberFormat;
-
-public class NumberUtil {
- public static final String formatNumber(double num) {
- NumberFormat formatter = NumberFormat.getNumberInstance();
- formatter.setMinimumFractionDigits(2);
- formatter.setMaximumFractionDigits(2);
- return formatter.format(num);
- }
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/ProcessResult.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/ProcessResult.java
deleted file mode 100644
index c297a9c4..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/ProcessResult.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package com.gluster.storage.management.core.utils;
-
-import javax.xml.bind.annotation.XmlRootElement;
-
-/**
- * Represents the result of a command execution in a separate process. Consists of the "exit status" of the process and
- * output from the process. The output includes stdout as well as stderr streams
- */
-@XmlRootElement
-public class ProcessResult {
-
- public static final int SUCCESS = 0;
- public static final int FAILURE = 1;
- private int exitValue;
- private String output;
-
- // Required for JAXB de-serialization
- public ProcessResult() {
-
- }
-
- public ProcessResult(int exitValue, String output) {
- this.exitValue = exitValue;
- this.output = output;
- }
-
- public int getExitValue() {
- return exitValue;
- }
-
- public void setExitValue(int exitValue) {
- this.exitValue = exitValue;
- }
-
- public String getOutput() {
- return output;
- }
-
- public void setOutput(String output) {
- this.output = output;
- }
-
- public boolean isSuccess() {
- return exitValue == SUCCESS;
- }
-
- @Override
- public String toString() {
- return "["+ getExitValue() + "][" + getOutput() + "]";
- }
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/ProcessUtil.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/ProcessUtil.java
deleted file mode 100644
index 87c74cf0..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/ProcessUtil.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package com.gluster.storage.management.core.utils;
-
-import static com.gluster.storage.management.core.constants.CoreConstants.NEWLINE;
-
-import java.io.BufferedReader;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.List;
-
-import com.gluster.storage.management.core.exceptions.GlusterRuntimeException;
-
-/**
- * Utility class for creating processes (foreground/background) with given
- * command and checking the output/exit status
- */
-public class ProcessUtil {
-
- public static ProcessResult executeCommand(List<String> command) {
- return executeCommand(true, command);
- }
-
- /**
- * Waits till all the threads in given list are dead
- * @param threads Threads to watch
- * @throws InterruptedException
- */
- public static void waitForThreads(List<Thread> threads) throws InterruptedException {
- // Wait till all servers have been processed
- for (int i = threads.size() - 1; i >= 0; i--) {
- if (threads.get(i).isAlive()) {
- // thread alive. sleep for half a second and check again.
- Thread.sleep(500);
- i++; // check the same thread in next iteration
- }
- }
- }
-
- /**
- * Executes given command in a separate process in FOREGROUND
- * @param command
- * @return {@link ProcessResult} object
- */
- public static ProcessResult executeCommand(String... command) {
- ArrayList<String> commandList = new ArrayList<String>();
- for (String part : command) {
- commandList.add(part);
- }
- return executeCommand(commandList);
- }
-
- /**
- * Executes given command in foreground/background
- * @param runInForeground Boolean flag indicating whether the command should
- * be executed in foreground
- * @param command
- * @return {@link ProcessResult} object
- */
- public static ProcessResult executeCommand(boolean runInForeground, List<String> command) {
- StringBuilder output = new StringBuilder();
- try {
- Process process = new ProcessBuilder(command).redirectErrorStream(true).start();
- if (runInForeground) {
- process.waitFor(); // Wait for process to finish
-
- InputStream is = process.getInputStream();
- InputStreamReader isr = new InputStreamReader(is);
- BufferedReader br = new BufferedReader(isr);
- String line;
-
- while ((line = br.readLine()) != null) {
- output.append(line);
- output.append(NEWLINE);
- }
- br.close();
- isr.close();
- is.close();
- } else {
- output.append("Command [");
- output.append(command);
- output.append("] triggerred in background.");
- }
-
- return new ProcessResult(process.exitValue(), output.toString());
- } catch (Throwable e) {
- throw new GlusterRuntimeException("Exception while executing command [" + command + "] : ["
- + e.getMessage() + "]", e);
- }
- }
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/StringUtil.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/StringUtil.java
deleted file mode 100644
index 26c244dd..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/StringUtil.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
- * This file is part of Gluster Management Console.
- *
- * Gluster Management Console is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Gluster Management Console is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see
- * <http://www.gnu.org/licenses/>.
- *******************************************************************************/
-package com.gluster.storage.management.core.utils;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-public class StringUtil {
- public static boolean filterString(String sourceString, String filterString, boolean caseSensitive) {
- return caseSensitive ? sourceString.contains(filterString) : sourceString.toLowerCase().contains(
- filterString.toLowerCase());
- }
-
- public static String removeSpaces(String str) {
- return str.replaceAll("\\s+", "");
- }
-
- public static String collectionToString(Collection<? extends Object> list, String delimiter) {
- if (list.size() == 0) {
- return "";
- }
- StringBuilder output = new StringBuilder();
- for (Object element : list) {
- output.append(element.toString()).append(delimiter);
- }
- String outputStr = output.toString();
- int endIndex = outputStr.length() - delimiter.length();
- return outputStr.substring(0, endIndex);
- }
-
- public static <T extends Enum<T>> List<String> enumToArray(T[] values) {
- List<String> enumAsArray = new ArrayList<String>();
- for (T value : values) {
- enumAsArray.add(value.toString());
- }
- return enumAsArray;
- }
-
- /**
- * Extracts a list from a string by splitting it on given delimiter
- * @param input the input string
- * @return A {@link List} of extracted tokens
- */
- public static List<String> extractList(String input, String delim) {
- String[] arr = input.split(delim);
- List<String> output = new ArrayList<String>();
- for(String str : arr) {
- String brick = str.trim();
- if(!brick.isEmpty()) {
- output.add(brick);
- }
- }
- return output;
- }
-
- /**
- * Extracts a map from a string by splitting it on the given primary and secondary delimiter. e.g. The input string
- * <i>k1=v1,k2=v2,k3=v3</i> will yield the following map:<br>
- * k1 -> v1<br>
- * k2 -> v2<br>
- * k3 -> v3<br>
- * where <b>,</b> is the primary delimiter and <b>=</b> is the secondary delimiter.
- *
- * @param input
- * @param majorDelim
- * @param minorDelim
- * @return Map of key value pairs
- */
- public static Map<String, String> extractMap(String input, String majorDelim, String minorDelim) {
- String[] arr = input.split(majorDelim);
- Map<String, String> output = new LinkedHashMap<String, String>();
- for(String str : arr) {
- String[] elements = str.split(minorDelim);
- if(elements.length == 2) {
- String key = elements[0].trim();
- String value = elements[1].trim();
- if(!key.isEmpty() && !value.isEmpty()) {
- output.put(key, value);
- }
- }
- }
- return output;
- }
-
- /**
- * Extract value of given token from given line. It is assumed that the token, if present, will be of the following
- * form: <code>token: value</code>
- *
- * @param line
- * Line to be analyzed
- * @param token
- * Token whose value is to be extracted
- * @return Value of the token, if present in the line
- */
- public static String extractToken(String line, String token) {
- if (line.contains(token)) {
- return line.split(token)[1].trim();
- }
- return null;
- }
-}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/ValidationUtil.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/ValidationUtil.java
deleted file mode 100644
index df0b749a..00000000
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/utils/ValidationUtil.java
+++ /dev/null
@@ -1,95 +0,0 @@
-package com.gluster.storage.management.core.utils;
-
-import java.util.regex.Pattern;
-
-public class ValidationUtil {
-
- // Access control may contains IP with wild card(*), hostname and/or multiple ip/hostnames
- public static boolean isValidAccessControl(String ac) {
- String access[] = ac.split(",");
- String ip;
- boolean isValidAccessControl = true;
- for (int i = 0; i < access.length && isValidAccessControl; i++) {
- ip = access[i].trim();
- isValidAccessControl = (isValidIpWithWC(ip) || isValidHostName(ip));
- }
- return isValidAccessControl;
- }
-
- public static String getInvalidIpOrHostname(String ac) {
- String access[] = ac.split(",");
- String ip;
- boolean isValidAccessControl = true;
- for (int i = 0; i < access.length && isValidAccessControl; i++) {
- ip = access[i].trim();
- if (!(isValidIpWithWC(ip) || isValidHostName(ip))) {
- return access[i];
- }
- }
- return "";
- }
-
- public static boolean isValidIpWithWC(String ip) {
- String ipAddress[] = ip.split("\\.");
- boolean isValid = true;
-
- if (ip.equals("0.0.0.0") || ip.equals("255.255.255.255")) { // Invalidate the special ip's
- isValid = false;
- }
-
- int iterator=ipAddress.length-1;
-
- if (ipAddress.length <= 4 && ipAddress[ipAddress.length - 1].equals("*")) {
- iterator = ipAddress.length - 2;
- } else if (ipAddress.length < 4 || ipAddress.length > 4 ){
- isValid = false;
- iterator = ipAddress.length - 1;
- }
-
- for (int i = 0; i <= iterator && isValid; i++) {
- if (ipAddress[i].equals("*")) {
- isValid = (i == ipAddress.length - 1) ? isValid : false;
- } else {
- isValid = isValidIpQuad(ipAddress[i]);
- }
- }
- return isValid;
- }
-
- public static boolean isValidIp(String ip) {
- String ipAddress[] = ip.split("\\.");
- boolean isValid = true;
-
- if (ip.equals("0.0.0.0") || ip.equals("255.255.255.255")) { // Invalidate the special ip's
- isValid = false;
- }
- if (ipAddress.length < 4) {
- isValid = false;
- }
- for (int i = 0; i < ipAddress.length && isValid; i++) {
- isValid = isValidIpQuad(ipAddress[i]);
- }
- return isValid;
- }
-
- private static boolean isValidIpQuad(String ipQuad) {
- Pattern pattern = Pattern.compile("([01]?\\d\\d?|2[0-4]\\d|25[0-5])");
- return pattern.matcher(ipQuad).matches();
- }
-
- public static boolean isValidHostName(String hostName) {
- Pattern pattern = Pattern
- .compile("^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\\-]*[A-Za-z0-9])$");
- return pattern.matcher(hostName).matches();
- }
-
- public static void main(String[] argv) {
- String ip = "0.0.0.0";
- // System.out.println("Is valid ip (" + ip + ")? " + isValidIp(ip));
- String hostName = "myhost.q";
- // System.out.println(isValidHostName(hostName));
- // System.out.println(isValidHostName(hostName));
- System.out.println(isValidAccessControl(hostName));
- }
-
-}