diff options
Diffstat (limited to 'src/com.gluster.storage.management.server')
86 files changed, 1985 insertions, 0 deletions
diff --git a/src/com.gluster.storage.management.server/.classpath b/src/com.gluster.storage.management.server/.classpath new file mode 100644 index 00000000..59631d14 --- /dev/null +++ b/src/com.gluster.storage.management.server/.classpath @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src"/> + <classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v7.0"> + <attributes> + <attribute name="owner.project.facets" value="jst.web"/> + </attributes> + </classpathentry> + <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/> + <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/> + <classpathentry combineaccessrules="false" kind="src" path="/com.gluster.storage.management.core"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> + <classpathentry kind="output" path="WebContent/WEB-INF/classes"/> +</classpath> diff --git a/src/com.gluster.storage.management.server/.project b/src/com.gluster.storage.management.server/.project new file mode 100644 index 00000000..86d34a3b --- /dev/null +++ b/src/com.gluster.storage.management.server/.project @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>com.gluster.storage.management.server</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.python.pydev.PyDevBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.wst.jsdt.core.javascriptValidator</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.wst.common.project.facet.core.builder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.wst.validation.validationbuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jem.workbench.JavaEMFNature</nature> + <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature> + <nature>org.eclipse.wst.common.project.facet.core.nature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>org.eclipse.wst.jsdt.core.jsNature</nature> + <nature>org.python.pydev.pythonNature</nature> + </natures> +</projectDescription> diff --git a/src/com.gluster.storage.management.server/.pydevproject b/src/com.gluster.storage.management.server/.pydevproject new file mode 100644 index 00000000..a9cca037 --- /dev/null +++ b/src/com.gluster.storage.management.server/.pydevproject @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<?eclipse-pydev version="1.0"?> + +<pydev_project> +<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property> +<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.7</pydev_property> +</pydev_project> diff --git a/src/com.gluster.storage.management.server/.settings/.jsdtscope b/src/com.gluster.storage.management.server/.settings/.jsdtscope new file mode 100644 index 00000000..3a28de0c --- /dev/null +++ b/src/com.gluster.storage.management.server/.settings/.jsdtscope @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="WebContent"/> + <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/> + <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject"> + <attributes> + <attribute name="hide" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/> + <classpathentry kind="output" path=""/> +</classpath> diff --git a/src/com.gluster.storage.management.server/.settings/org.eclipse.jdt.core.prefs b/src/com.gluster.storage.management.server/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000..476db350 --- /dev/null +++ b/src/com.gluster.storage.management.server/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Wed Dec 29 14:57:23 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.server/.settings/org.eclipse.ltk.core.refactoring.prefs b/src/com.gluster.storage.management.server/.settings/org.eclipse.ltk.core.refactoring.prefs new file mode 100644 index 00000000..5d9c71b6 --- /dev/null +++ b/src/com.gluster.storage.management.server/.settings/org.eclipse.ltk.core.refactoring.prefs @@ -0,0 +1,3 @@ +#Mon Jan 31 15:29:36 IST 2011 +eclipse.preferences.version=1 +org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false diff --git a/src/com.gluster.storage.management.server/.settings/org.eclipse.wst.common.component b/src/com.gluster.storage.management.server/.settings/org.eclipse.wst.common.component new file mode 100644 index 00000000..bb2eaf45 --- /dev/null +++ b/src/com.gluster.storage.management.server/.settings/org.eclipse.wst.common.component @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project-modules id="moduleCoreId" project-version="1.5.0"> + <wb-module deploy-name="com.gluster.storage.management.server"> + <wb-resource deploy-path="/" source-path="/WebContent"/> + <wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/> + <property name="java-output-path" value="/com.gluster.storage.management.server/build/classes"/> + <property name="context-root" value="glustermc"/> + </wb-module> +</project-modules> diff --git a/src/com.gluster.storage.management.server/.settings/org.eclipse.wst.common.project.facet.core.xml b/src/com.gluster.storage.management.server/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 00000000..8f960f27 --- /dev/null +++ b/src/com.gluster.storage.management.server/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?><!-- + Copyright (c) 2011 IBM Corporation and others. + All rights reserved. This program and the accompanying materials + are made available under the terms of the Eclipse Public License v1.0 + which accompanies this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Contributors: + IBM Corporation - initial API and implementation + --> + +<faceted-project> + <runtime name="Apache Tomcat v7.0"/> + <fixed facet="wst.jsdt.web"/> + <fixed facet="jst.web"/> + <fixed facet="java"/> + <installed facet="java" version="1.6"/> + <installed facet="jst.web" version="3.0"/> + <installed facet="wst.jsdt.web" version="1.0"/> +</faceted-project> diff --git a/src/com.gluster.storage.management.server/.settings/org.eclipse.wst.jsdt.ui.superType.container b/src/com.gluster.storage.management.server/.settings/org.eclipse.wst.jsdt.ui.superType.container new file mode 100644 index 00000000..3bd5d0a4 --- /dev/null +++ b/src/com.gluster.storage.management.server/.settings/org.eclipse.wst.jsdt.ui.superType.container @@ -0,0 +1 @@ +org.eclipse.wst.jsdt.launching.baseBrowserLibrary
\ No newline at end of file diff --git a/src/com.gluster.storage.management.server/.settings/org.eclipse.wst.jsdt.ui.superType.name b/src/com.gluster.storage.management.server/.settings/org.eclipse.wst.jsdt.ui.superType.name new file mode 100644 index 00000000..05bd71b6 --- /dev/null +++ b/src/com.gluster.storage.management.server/.settings/org.eclipse.wst.jsdt.ui.superType.name @@ -0,0 +1 @@ +Window
\ No newline at end of file diff --git a/src/com.gluster.storage.management.server/.settings/org.eclipse.wst.ws.service.policy.prefs b/src/com.gluster.storage.management.server/.settings/org.eclipse.wst.ws.service.policy.prefs new file mode 100644 index 00000000..e5ca6272 --- /dev/null +++ b/src/com.gluster.storage.management.server/.settings/org.eclipse.wst.ws.service.policy.prefs @@ -0,0 +1,3 @@ +#Mon Jan 31 15:29:36 IST 2011 +eclipse.preferences.version=1 +org.eclipse.wst.ws.service.policy.projectEnabled=false diff --git a/src/com.gluster.storage.management.server/WebContent/META-INF/MANIFEST.MF b/src/com.gluster.storage.management.server/WebContent/META-INF/MANIFEST.MF new file mode 100644 index 00000000..5e949512 --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0
+Class-Path:
+
diff --git a/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/aopalliance-1.0.jar b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/aopalliance-1.0.jar Binary files differnew file mode 100644 index 00000000..578b1a0c --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/aopalliance-1.0.jar diff --git a/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/asm-3.1.jar b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/asm-3.1.jar Binary files differnew file mode 100644 index 00000000..8217cae0 --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/asm-3.1.jar diff --git a/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/commons-logging-1.1.1.jar b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/commons-logging-1.1.1.jar Binary files differnew file mode 100644 index 00000000..8758a96b --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/commons-logging-1.1.1.jar diff --git a/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/derby.jar b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/derby.jar Binary files differnew file mode 100644 index 00000000..dc8ae8df --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/derby.jar diff --git a/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/derbytools.jar b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/derbytools.jar Binary files differnew file mode 100644 index 00000000..ca367aae --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/derbytools.jar diff --git a/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/jackson-core-asl-1.5.5.jar b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/jackson-core-asl-1.5.5.jar Binary files differnew file mode 100644 index 00000000..a3248188 --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/jackson-core-asl-1.5.5.jar diff --git a/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/jackson-jaxrs-1.5.5.jar b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/jackson-jaxrs-1.5.5.jar Binary files differnew file mode 100644 index 00000000..faf12cf6 --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/jackson-jaxrs-1.5.5.jar diff --git a/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/jackson-mapper-asl-1.5.5.jar b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/jackson-mapper-asl-1.5.5.jar Binary files differnew file mode 100644 index 00000000..ca612580 --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/jackson-mapper-asl-1.5.5.jar diff --git a/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/jackson-xc-1.5.5.jar b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/jackson-xc-1.5.5.jar Binary files differnew file mode 100644 index 00000000..57c2c670 --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/jackson-xc-1.5.5.jar diff --git a/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/jersey-client-1.5.jar b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/jersey-client-1.5.jar Binary files differnew file mode 100644 index 00000000..62f790fa --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/jersey-client-1.5.jar diff --git a/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/jersey-core-1.5.jar b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/jersey-core-1.5.jar Binary files differnew file mode 100644 index 00000000..92b38466 --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/jersey-core-1.5.jar diff --git a/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/jersey-json-1.5.jar b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/jersey-json-1.5.jar Binary files differnew file mode 100644 index 00000000..01d8c83b --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/jersey-json-1.5.jar diff --git a/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/jersey-server-1.5.jar b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/jersey-server-1.5.jar Binary files differnew file mode 100644 index 00000000..a29d7409 --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/jersey-server-1.5.jar diff --git a/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/jersey-spring-1.5.jar b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/jersey-spring-1.5.jar Binary files differnew file mode 100644 index 00000000..c79b4490 --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/jersey-spring-1.5.jar diff --git a/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/jettison-1.1.jar b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/jettison-1.1.jar Binary files differnew file mode 100644 index 00000000..e4e9c8c3 --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/jettison-1.1.jar diff --git a/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/jnlp-servlet.jar b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/jnlp-servlet.jar Binary files differnew file mode 100644 index 00000000..23782c02 --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/jnlp-servlet.jar diff --git a/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/jsr311-api-1.1.1.jar b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/jsr311-api-1.1.1.jar Binary files differnew file mode 100644 index 00000000..ec8bc818 --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/jsr311-api-1.1.1.jar diff --git a/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.eclipse.equinox.common_3.6.0.v20100503.jar b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.eclipse.equinox.common_3.6.0.v20100503.jar Binary files differnew file mode 100644 index 00000000..a5d37aa1 --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.eclipse.equinox.common_3.6.0.v20100503.jar diff --git a/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.aop-3.0.5.RELEASE.jar b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.aop-3.0.5.RELEASE.jar Binary files differnew file mode 100644 index 00000000..db6f529f --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.aop-3.0.5.RELEASE.jar diff --git a/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.asm-3.0.5.RELEASE.jar b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.asm-3.0.5.RELEASE.jar Binary files differnew file mode 100644 index 00000000..7cd3a626 --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.asm-3.0.5.RELEASE.jar diff --git a/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.aspects-3.0.5.RELEASE.jar b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.aspects-3.0.5.RELEASE.jar Binary files differnew file mode 100644 index 00000000..11fc11b9 --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.aspects-3.0.5.RELEASE.jar diff --git a/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.beans-3.0.5.RELEASE.jar b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.beans-3.0.5.RELEASE.jar Binary files differnew file mode 100644 index 00000000..f2e2e927 --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.beans-3.0.5.RELEASE.jar diff --git a/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.context-3.0.5.RELEASE.jar b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.context-3.0.5.RELEASE.jar Binary files differnew file mode 100644 index 00000000..bd1367d8 --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.context-3.0.5.RELEASE.jar diff --git a/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.context.support-3.0.5.RELEASE.jar b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.context.support-3.0.5.RELEASE.jar Binary files differnew file mode 100644 index 00000000..e46f9eb8 --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.context.support-3.0.5.RELEASE.jar diff --git a/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.core-3.0.5.RELEASE.jar b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.core-3.0.5.RELEASE.jar Binary files differnew file mode 100644 index 00000000..ea9500d6 --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.core-3.0.5.RELEASE.jar diff --git a/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.expression-3.0.5.RELEASE.jar b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.expression-3.0.5.RELEASE.jar Binary files differnew file mode 100644 index 00000000..6ef99d8d --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.expression-3.0.5.RELEASE.jar diff --git a/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.instrument-3.0.5.RELEASE.jar b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.instrument-3.0.5.RELEASE.jar Binary files differnew file mode 100644 index 00000000..e149290e --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.instrument-3.0.5.RELEASE.jar diff --git a/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.instrument.tomcat-3.0.5.RELEASE.jar b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.instrument.tomcat-3.0.5.RELEASE.jar Binary files differnew file mode 100644 index 00000000..dcd1e4d9 --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.instrument.tomcat-3.0.5.RELEASE.jar diff --git a/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.jdbc-3.0.5.RELEASE.jar b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.jdbc-3.0.5.RELEASE.jar Binary files differnew file mode 100644 index 00000000..f7a3b837 --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.jdbc-3.0.5.RELEASE.jar diff --git a/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.jms-3.0.5.RELEASE.jar b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.jms-3.0.5.RELEASE.jar Binary files differnew file mode 100644 index 00000000..9cea2aef --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.jms-3.0.5.RELEASE.jar diff --git a/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.orm-3.0.5.RELEASE.jar b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.orm-3.0.5.RELEASE.jar Binary files differnew file mode 100644 index 00000000..d0550ccd --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.orm-3.0.5.RELEASE.jar diff --git a/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.oxm-3.0.5.RELEASE.jar b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.oxm-3.0.5.RELEASE.jar Binary files differnew file mode 100644 index 00000000..1688cf74 --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.oxm-3.0.5.RELEASE.jar diff --git a/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.spring-library-3.0.5.RELEASE.libd b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.spring-library-3.0.5.RELEASE.libd new file mode 100644 index 00000000..b3aa6af8 --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.spring-library-3.0.5.RELEASE.libd @@ -0,0 +1,21 @@ +Library-SymbolicName: org.springframework.spring +Library-Version: 3.0.5.RELEASE +Library-Name: Spring Framework +Import-Bundle: + org.springframework.aop;version="[3.0.5.RELEASE, 3.0.5.RELEASE]", + org.springframework.asm;version="[3.0.5.RELEASE, 3.0.5.RELEASE]", + org.springframework.aspects;version="[3.0.5.RELEASE, 3.0.5.RELEASE]", + org.springframework.beans;version="[3.0.5.RELEASE, 3.0.5.RELEASE]", + org.springframework.context;version="[3.0.5.RELEASE, 3.0.5.RELEASE]", + org.springframework.context.support;version="[3.0.5.RELEASE, 3.0.5.RELEASE]", + org.springframework.core;version="[3.0.5.RELEASE, 3.0.5.RELEASE]", + org.springframework.expression;version="[3.0.5.RELEASE, 3.0.5.RELEASE]", + org.springframework.jdbc;version="[3.0.5.RELEASE, 3.0.5.RELEASE]", + org.springframework.jms;version="[3.0.5.RELEASE, 3.0.5.RELEASE]", + org.springframework.orm;version="[3.0.5.RELEASE, 3.0.5.RELEASE]", + org.springframework.oxm;version="[3.0.5.RELEASE, 3.0.5.RELEASE]", + org.springframework.transaction;version="[3.0.5.RELEASE, 3.0.5.RELEASE]", + org.springframework.web;version="[3.0.5.RELEASE, 3.0.5.RELEASE]", + org.springframework.web.servlet;version="[3.0.5.RELEASE, 3.0.5.RELEASE]", + org.springframework.web.portlet;version="[3.0.5.RELEASE, 3.0.5.RELEASE]", + com.springsource.org.aopalliance;version="[1.0.0, 1.0.0]" diff --git a/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.test-3.0.5.RELEASE.jar b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.test-3.0.5.RELEASE.jar Binary files differnew file mode 100644 index 00000000..237995c5 --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.test-3.0.5.RELEASE.jar diff --git a/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.transaction-3.0.5.RELEASE.jar b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.transaction-3.0.5.RELEASE.jar Binary files differnew file mode 100644 index 00000000..2f52122b --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.transaction-3.0.5.RELEASE.jar diff --git a/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.web-3.0.5.RELEASE.jar b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.web-3.0.5.RELEASE.jar Binary files differnew file mode 100644 index 00000000..5a2381a0 --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.web-3.0.5.RELEASE.jar diff --git a/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.web.portlet-3.0.5.RELEASE.jar b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.web.portlet-3.0.5.RELEASE.jar Binary files differnew file mode 100644 index 00000000..6ec9d681 --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.web.portlet-3.0.5.RELEASE.jar diff --git a/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.web.servlet-3.0.5.RELEASE.jar b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.web.servlet-3.0.5.RELEASE.jar Binary files differnew file mode 100644 index 00000000..6d13bd40 --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.web.servlet-3.0.5.RELEASE.jar diff --git a/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.web.struts-3.0.5.RELEASE.jar b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.web.struts-3.0.5.RELEASE.jar Binary files differnew file mode 100644 index 00000000..e351ae7b --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/org.springframework.web.struts-3.0.5.RELEASE.jar diff --git a/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/plugins/com.gluster.storage.management.client_1.0.0.jar b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/plugins/com.gluster.storage.management.client_1.0.0.jar Binary files differnew file mode 100644 index 00000000..56222cbf --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/plugins/com.gluster.storage.management.client_1.0.0.jar diff --git a/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/plugins/com.gluster.storage.management.core_1.0.0.jar b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/plugins/com.gluster.storage.management.core_1.0.0.jar Binary files differnew file mode 100644 index 00000000..d321e76c --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/plugins/com.gluster.storage.management.core_1.0.0.jar diff --git a/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/servlet-api.jar b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/servlet-api.jar Binary files differnew file mode 100644 index 00000000..e5bc672b --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/servlet-api.jar diff --git a/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/spring-security-config-3.0.5.RELEASE.jar b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/spring-security-config-3.0.5.RELEASE.jar Binary files differnew file mode 100644 index 00000000..78818fc5 --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/spring-security-config-3.0.5.RELEASE.jar diff --git a/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/spring-security-core-3.0.5.RELEASE.jar b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/spring-security-core-3.0.5.RELEASE.jar Binary files differnew file mode 100644 index 00000000..a8077d5d --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/spring-security-core-3.0.5.RELEASE.jar diff --git a/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/spring-security-web-3.0.5.RELEASE.jar b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/spring-security-web-3.0.5.RELEASE.jar Binary files differnew file mode 100644 index 00000000..26611b55 --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/WEB-INF/lib/spring-security-web-3.0.5.RELEASE.jar diff --git a/src/com.gluster.storage.management.server/WebContent/WEB-INF/web.xml b/src/com.gluster.storage.management.server/WebContent/WEB-INF/web.xml new file mode 100644 index 00000000..34337a5d --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/WEB-INF/web.xml @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="UTF-8"?> +<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" + id="WebApp_ID" version="3.0"> + <display-name>com.gluster.storage.management.server</display-name> + <welcome-file-list> + <welcome-file>index.html</welcome-file> + <welcome-file>index.htm</welcome-file> + <welcome-file>index.jsp</welcome-file> + <welcome-file>default.html</welcome-file> + <welcome-file>default.htm</welcome-file> + <welcome-file>default.jsp</welcome-file> + </welcome-file-list> + + <!-- Spring context loaded --> + <context-param> + <param-name>contextConfigLocation</param-name> + <param-value> + classpath:spring/gluster-server-security.xml + classpath:spring/gluster-server-base.xml + </param-value> + </context-param> + <listener> + <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> + </listener> + <listener> + <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class> + </listener> + + <!-- Jersey REST servlet --> + <servlet> + <servlet-name>gluster-resources</servlet-name> + <!-- servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class --> + <servlet-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</servlet-class> + <init-param> + <param-name>com.sun.jersey.config.property.packages</param-name> + <param-value>com.gluster.storage.management.server.resources</param-value> + </init-param> + <load-on-startup>1</load-on-startup> + </servlet> + <servlet-mapping> + <servlet-name>gluster-resources</servlet-name> + <url-pattern>/resources/*</url-pattern> + </servlet-mapping> + + <!-- JNLP download servlet --> + <servlet> + <servlet-name>JnlpDownloadServlet</servlet-name> + <servlet-class>jnlp.sample.servlet.JnlpDownloadServlet</servlet-class> + </servlet> + <servlet-mapping> + <servlet-name>JnlpDownloadServlet</servlet-name> + <url-pattern>*.jnlp</url-pattern> + </servlet-mapping> + <servlet-mapping> + <servlet-name>JnlpDownloadServlet</servlet-name> + <url-pattern>*.jar</url-pattern> + </servlet-mapping> + + <!-- Spring Security --> + <filter> + <filter-name>springSecurityFilterChain</filter-name> + <filter-class> + org.springframework.web.filter.DelegatingFilterProxy + </filter-class> + </filter> + <filter-mapping> + <filter-name>springSecurityFilterChain</filter-name> + <url-pattern>/*</url-pattern> + </filter-mapping> +</web-app> diff --git a/src/com.gluster.storage.management.server/WebContent/scripts/Common.py b/src/com.gluster.storage.management.server/WebContent/scripts/Common.py new file mode 100644 index 00000000..60f200fe --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/scripts/Common.py @@ -0,0 +1,34 @@ +# Copyright (c) 2009 Gluster, Inc. <http://www.gluster.com>
+# This file is part of GlusterSP.
+#
+# GlusterSP 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 3 of the License,
+# or (at your option) any later version.
+#
+# GlusterSP 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, see
+# <http://www.gnu.org/licenses/>.
+
+import sys
+import syslog
+
+def log(priority, message=None):
+ if type(priority) == type(""):
+ logPriority = syslog.LOG_INFO
+ logMessage = priority
+ else:
+ logPriority = priority
+ logMessage = message
+ if not logMessage:
+ return
+ #if Globals.DEBUG:
+ # sys.stderr.write(logMessage)
+ else:
+ syslog.syslog(logPriority, logMessage)
+ return
diff --git a/src/com.gluster.storage.management.server/WebContent/scripts/Globals.py b/src/com.gluster.storage.management.server/WebContent/scripts/Globals.py new file mode 100644 index 00000000..6e68adbd --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/scripts/Globals.py @@ -0,0 +1,3 @@ +MULTICAST_GROUP = '224.224.1.1'
+MULTICAST_PORT = 5353
+DISCOVERED_SERVER_LIST_FILENAME = "/tmp/discovered-server-list"
diff --git a/src/com.gluster.storage.management.server/WebContent/scripts/vmware-discover-servers.py b/src/com.gluster.storage.management.server/WebContent/scripts/vmware-discover-servers.py new file mode 100755 index 00000000..6ac15fed --- /dev/null +++ b/src/com.gluster.storage.management.server/WebContent/scripts/vmware-discover-servers.py @@ -0,0 +1,83 @@ +#!/usr/bin/python +# Copyright (C) 2009 Gluster, Inc. <http://www.gluster.com> +# This file is part of Gluster Storage Platform. +# +# Gluster Storage Platform 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 3 of +# the License, or (at your option) any later version. +# +# Gluster Storage Platform 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, see +# <http://www.gnu.org/licenses/>. + +import sys +import socket +import signal +import struct +import syslog +import Globals +import Common + +class TimeoutException(Exception): + pass + +def timeoutSignal(signum, frame): + raise TimeoutException, "Timed out" + +def serverDiscoveryRequest(multiCastGroup, port): + servers = [] + # Sending request to all the servers + socketSend = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP) + socketSend.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, 2) + socketSend.sendto("ServerDiscovery", (multiCastGroup, port)) + + # Waiting for the response + socketReceive = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP) + socketReceive.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) + socketReceive.bind(('', port)) + mreq = struct.pack("4sl", socket.inet_aton(multiCastGroup), socket.INADDR_ANY) + + socketReceive.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, mreq) + socketSend.sendto("ServerDiscovery", (multiCastGroup, port)) + + try: + while True: + response = socketReceive.recvfrom(200) + if response and response[0].upper() != "SERVERDISCOVERY": + servers.append(response[0]) + signal.signal(signal.SIGALRM, timeoutSignal) + signal.alarm(3) + except TimeoutException: + return servers + return None + +def main(): + syslog.openlog("discovery server request") + servers = serverDiscoveryRequest(Globals.MULTICAST_GROUP, Globals.MULTICAST_PORT) + if not servers: + Common.log(syslog.LOG_ERR, "Failed to discover new servers") + sys.exit(-1) + + servers = set(servers) + try: + #fp = open(Globals.DISCOVERED_SERVER_LIST_FILENAME, "w") + #fp.writelines(list(servers)) + #fp.close() + for server in servers: + print server + except IOError: + Common.log(syslog.LOG_ERR, "Unable to open file %s" % Globals.DISCOVERED_SERVER_LIST_FILENAME) + sys.exit(-1) + + #for serverName in servers: + # print serverName + sys.exit(0) + +if __name__ == "__main__": + main() diff --git a/src/com.gluster.storage.management.server/buckminster.cspex b/src/com.gluster.storage.management.server/buckminster.cspex new file mode 100644 index 00000000..31eb9d67 --- /dev/null +++ b/src/com.gluster.storage.management.server/buckminster.cspex @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<cspecExtension + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:bc="http://www.eclipse.org/buckminster/Common-1.0" + xmlns="http://www.eclipse.org/buckminster/CSpec-1.0"> + <dependencies> + <!-- Place your Dependencies here --> + </dependencies> + <generators> + <!-- Place your Generators here --> + </generators> + <artifacts> + <!-- Place your Artifacts here --> + </artifacts> + <actions> + <public name="archive" actor="ant"> + <actorProperties> + <property key="buildFile" value="build/glusterserver.ant"/> + </actorProperties> + </public> + </actions> + <groups> + <!-- Place your Groups here --> + </groups> + <alterDependencies> + <!-- Place your Dependency alterations here --> + </alterDependencies> + <alterArtifacts> + <!-- Place your Artifact alterations here --> + </alterArtifacts> + <alterActions> + <!-- Place your Action alterations here --> + </alterActions> + <alterGroups> + <!-- Place your Group alterations here --> + </alterGroups> +</cspecExtension> diff --git a/src/com.gluster.storage.management.server/build/glusterserver.ant b/src/com.gluster.storage.management.server/build/glusterserver.ant new file mode 100644 index 00000000..88602fb6 --- /dev/null +++ b/src/com.gluster.storage.management.server/build/glusterserver.ant @@ -0,0 +1,64 @@ +<project name="com.gluster.storage.management.server" basedir="." default="archive"> + <echo message="basedir=${basedir}" /> + <echo message="buckminster.output=${buckminster.output}" /> + <property name="WEB-INF" value="${basedir}/WebContent/WEB-INF" /> + <property name="OUT" value="${buckminster.output}/glusterserver/" /> + <property name="WAR_FILE_NAME" value="glustermc.war" /> + <property name="TEMP" value="${buckminster.output}/temp" /> + + <target name="help"> + <echo> + -------------------------------------------------- + compile - Compile + archive - Generate WAR file + -------------------------------------------------- + </echo> + </target> + + <target name="init"> + <delete dir="${WEB-INF}/classes" /> + <mkdir dir="${WEB-INF}/classes" /> + <mkdir dir="${WEB-INF}/classes/spring" /> + <mkdir dir="${WEB-INF}/classes/data" /> + </target> + + <target name="compile" depends="init"> + <!-- flatten=true means ignore directory structure and copy files directly to destination --> + <copy todir="${WEB-INF}/lib" flatten="true"> + <fileset dir="${buckminster.output}/.." casesensitive="yes"> + <include name="**/*.jar" /> + </fileset> + </copy> + <copy todir="${WEB-INF}/classes/spring"> + <fileset dir="${basedir}/src/spring" casesensitive="yes"> + <include name="**/*.xml" /> + </fileset> + </copy> + <copy todir="${WEB-INF}/classes/data"> + <fileset dir="${basedir}/src/data" casesensitive="yes"> + <include name="**/*.sql" /> + </fileset> + </copy> + <javac srcdir="${basedir}/src" destdir="${WEB-INF}/classes" classpathref="libs" /> + </target> + + <target name="archive" depends="compile"> + <delete dir="${OUT}" /> + <mkdir dir="${OUT}" /> + <delete dir="${TEMP}" /> + <mkdir dir="${TEMP}" /> + <copy todir="${TEMP}"> + <fileset dir="${basedir}/WebContent"> + <!-- servlet-api.jar is required during compilation. At runtime, it is picked from tomcat lib directory --> + <exclude name="**/servlet-api.jar" /> + </fileset> + </copy> + <war destfile="${OUT}/${WAR_FILE_NAME}" basedir="${TEMP}" compress="true" webxml="${TEMP}/WEB-INF/web.xml" /> + <delete dir="${TEMP}" /> + </target> + + <path id="libs"> + <fileset includes="*.jar" dir="${WEB-INF}/lib" /> + </path> + +</project>
\ No newline at end of file diff --git a/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/constants/VolumeOptionsDefaults.java b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/constants/VolumeOptionsDefaults.java new file mode 100644 index 00000000..384038f4 --- /dev/null +++ b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/constants/VolumeOptionsDefaults.java @@ -0,0 +1,120 @@ +/** + * DefaultVolumeOptions.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.server.constants; + +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.constants.CoreConstants; +import com.gluster.storage.management.core.model.VolumeOptionInfo; + +@XmlRootElement +public class VolumeOptionsDefaults { + @XmlElementWrapper(name = "volumeOptions") + @XmlElement(name = "volumeOption", type = VolumeOptionInfo.class) + public List<VolumeOptionInfo> options; + + public VolumeOptionsDefaults() { + } + + public VolumeOptionsDefaults getDefaults() { + options = getVolumeOptionsInfo(); + return this; + } + + /** + * Fetches the list of all volume options with their information from GlusterFS and returns the same + * + * @return List of volume option information objects + */ + private List<VolumeOptionInfo> getVolumeOptionsInfo() { + List<VolumeOptionInfo> volumeOptionsInfo = new ArrayList<VolumeOptionInfo>(); + + volumeOptionsInfo + .add(new VolumeOptionInfo( + "cluster.stripe-block-size", + "This could be used in case of a stripe setup. Specifies the size of the stripe unit that will read from or written to the striped servers. " + + CoreConstants.NEWLINE + + "Optionally different stripe unit sizes can be specified for different fies, with the following pattern <filename-pattern:blk-size>. ", + "*:128KB")); + volumeOptionsInfo + .add(new VolumeOptionInfo( + "cluster.self-heal-window-size", + "Specifies the number of maximum number blocks per file for which self-heal process would be applied simultaneously.", + "16")); + volumeOptionsInfo.add(new VolumeOptionInfo("cluster.data-self-heal-algorithm", + "cluster.data-self-heal-algorithm", "auto")); + volumeOptionsInfo + .add(new VolumeOptionInfo( + "network.frame-timeout", + "The time frame after which the operation has to be declared as dead, if the server does not respond for a particular operation.", + "1800")); + volumeOptionsInfo.add(new VolumeOptionInfo("network.ping-timeout", + "The time duration for which the client waits to check if the server is responsive.", "42")); + volumeOptionsInfo.add(new VolumeOptionInfo("auth.allow", + "'IP addresses/Host name' of the clients which should be allowed to access the the volume.", "*")); + volumeOptionsInfo.add(new VolumeOptionInfo("auth.reject", + "'IP addresses/Host name' of the clients which should be denied to access the volume.", "NONE")); + volumeOptionsInfo + .add(new VolumeOptionInfo( + "performance.cache-refresh-timeout", + "The cached data for a file will be retained till 'cache-refresh-timeout' seconds, after which data re-validation is performed.", + "1")); + volumeOptionsInfo.add(new VolumeOptionInfo("performance.cache-size", "Size of the read cache.", "32MB")); + volumeOptionsInfo.add(new VolumeOptionInfo("performance.write-behind-window-size", + "Size of the per-file write-behind buffer.", "1MB")); + volumeOptionsInfo.add(new VolumeOptionInfo("performance.cache-max-file-size", + "performance.cache-max-file-size", "-1")); + volumeOptionsInfo.add(new VolumeOptionInfo("performance.cache-min-file-size", + "performance.cache-min-file-size", "0")); + volumeOptionsInfo + .add(new VolumeOptionInfo( + "performance.io-thread-count", + " Number of threads in the thread-pool in the bricks to improve the concurrency in I/O s of server side.", + "16")); + volumeOptionsInfo + .add(new VolumeOptionInfo( + "diagnostics.latency-measurement", + "Statistics related to the latency of each operation would be tracked inside GlusterFS data-structures.", + "off")); + volumeOptionsInfo.add(new VolumeOptionInfo("diagnostics.dump-fd-stats", + "Statistics related to file-operations would be tracked inside GlusterFS data-structures.", "off")); + volumeOptionsInfo.add(new VolumeOptionInfo("diagnostics.brick-log-level", + "Changes the log-level of the bricks (servers).", "NORMAL")); + volumeOptionsInfo.add(new VolumeOptionInfo("diagnostics.client-log-level", + "Changes the log-level of the clients.", "NORMAL")); + volumeOptionsInfo.add(new VolumeOptionInfo("nfs.enable-ino32", + "Use this option from the CLI to make Gluster NFS return 32-bit inode numbers instead of 64-bit.", + "off")); + volumeOptionsInfo + .add(new VolumeOptionInfo( + "nfs.mem-factor", + "This option specifies a multiple that determines the total amount of memory used. Increases this increases the performance of NFS.", + "15")); + volumeOptionsInfo.add(new VolumeOptionInfo("transport.keepalive", "transport.keepalive", "on")); + + return volumeOptionsInfo; + } +}
\ No newline at end of file diff --git a/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/data/GlusterDataSource.java b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/data/GlusterDataSource.java new file mode 100644 index 00000000..e669a130 --- /dev/null +++ b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/data/GlusterDataSource.java @@ -0,0 +1,48 @@ +/** + * GlusterDataSource.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.server.data; + +import javax.servlet.ServletContext; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.datasource.DriverManagerDataSource; +import org.springframework.stereotype.Component; + +@Component +public class GlusterDataSource extends DriverManagerDataSource { + @Autowired + ServletContext servletContext; + + public GlusterDataSource() { + setDriverClassName(org.apache.derby.jdbc.EmbeddedDriver.class.getName()); + + setUsername("gluster"); + // TODO: change to a stronger (encrypted) password + setPassword("gluster"); + } + + public DriverManagerDataSource getDataSource() { + // Database directory = work/data relative to context root + setUrl("jdbc:derby:" + servletContext.getRealPath("data") + ";create=true"); + + return this; + } +}
\ No newline at end of file diff --git a/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/AbstractServersResource.java b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/AbstractServersResource.java new file mode 100644 index 00000000..004160a7 --- /dev/null +++ b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/AbstractServersResource.java @@ -0,0 +1,79 @@ +/** + * AbstractServersResource.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.server.resources; + +import com.gluster.storage.management.core.model.Disk; +import com.gluster.storage.management.core.model.NetworkInterface; +import com.gluster.storage.management.core.model.Server; + +/** + * Abstract resource class for servers. Abstracts basic server related functionality like "get server details". + */ +public class AbstractServersResource { + // TODO: Used for generating dummy ip address. To be removed after implementing actual logic for fetching server + // details + private static int ipCount = 1; + + /** + * Fetch details of the given server. The server name must be populated in the object before calling this method. + * + * @param server + * Server whose details are to be fetched + */ + protected void fetchServerDetails(Server server) { + String serverName = server.getName(); + + // TODO: Fetch the server details and populate in the object. + // For now, populating dummy data. + populateDummyData(server); + } + + /** + * @param server + */ + private void populateDummyData(Server server) { + server.setNumOfCPUs((int) (Math.ceil(Math.random() * 8))); + server.setCpuUsage(Math.random() * 100); + server.setTotalMemory(Math.ceil(Math.random() * 8)); + server.setMemoryInUse(Math.random() * server.getTotalMemory()); + addDummyDisks(server); + addDummyNetworkInterfaces(server, (int) Math.ceil(Math.random() * 4)); + } + + private void addDummyNetworkInterfaces(Server server, int interfaceCount) { + for (int i = 0; i < interfaceCount; i++) { + server.addNetworkInterface(new NetworkInterface("eth" + i, server, "192.168.1." + ipCount++, + "255.255.255.0", "192.168.1.1")); + } + } + + /** + * @param server + */ + private void addDummyDisks(Server server) { + double dummyDiskSpace = Math.random() * 500; + server.addDisk(new Disk(server, "sda", dummyDiskSpace, Math.random() * dummyDiskSpace, Disk.DISK_STATUS.READY)); + dummyDiskSpace = Math.random() * 500; + server.addDisk(new Disk(server, "sdb", dummyDiskSpace, Math.random() * dummyDiskSpace, Disk.DISK_STATUS.READY)); + dummyDiskSpace = Math.random() * 500; + server.addDisk(new Disk(server, "sdc", dummyDiskSpace, Math.random() * dummyDiskSpace, Disk.DISK_STATUS.READY)); + } +} diff --git a/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/DiscoveredServersResource.java b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/DiscoveredServersResource.java new file mode 100644 index 00000000..5987857a --- /dev/null +++ b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/DiscoveredServersResource.java @@ -0,0 +1,89 @@ +/******************************************************************************* + * 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.server.resources; + +import java.util.ArrayList; +import java.util.List; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; + +import org.springframework.stereotype.Component; + +import com.gluster.storage.management.core.model.Response; +import com.gluster.storage.management.core.model.Server; +import com.gluster.storage.management.core.model.ServerListResponse; +import com.gluster.storage.management.core.model.Status; +import com.gluster.storage.management.core.model.StringListResponse; +import com.sun.jersey.spi.resource.Singleton; + +@Component +@Singleton +@Path("/discoveredservers") +public class DiscoveredServersResource extends AbstractServersResource { + private List<String> discoveredServerNames = new ArrayList<String>(); + + public List<String> getDiscoveredServerNames() { + return discoveredServerNames; + } + + @GET + @Produces(MediaType.TEXT_XML) + public Response getDiscoveredServers(@QueryParam("details") Boolean getDetails) { + if(getDetails != null && getDetails == true) { + return new ServerListResponse(Status.STATUS_SUCCESS, getDiscoveredServerDetails()); + } + return new StringListResponse(getDiscoveredServerNames()); + } + + private List<Server> getDiscoveredServerDetails() { + List<Server> discoveredServers = new ArrayList<Server>(); + List<String> serverNames = getDiscoveredServerNames(); + for (String serverName : serverNames) { + discoveredServers.add(getDiscoveredServer(serverName)); + } + return discoveredServers; + } + + public void setDiscoveredServerNames(List<String> discoveredServerNames) { + synchronized (discoveredServerNames) { + this.discoveredServerNames = discoveredServerNames; + } + } + + @Path("/{serverName}") + @GET + @Produces(MediaType.TEXT_XML) + public Server getDiscoveredServer(@PathParam("serverName") String serverName) { + Server server = new Server(serverName); + fetchServerDetails(server); + return server; + } + + public static void main(String[] args) { + StringListResponse listResponse = (StringListResponse)new DiscoveredServersResource().getDiscoveredServers(false); + for (String server : listResponse.getData()) { + System.out.println(server); + } + } +} diff --git a/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/GlusterServersResource.java b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/GlusterServersResource.java new file mode 100644 index 00000000..6204bf9b --- /dev/null +++ b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/GlusterServersResource.java @@ -0,0 +1,115 @@ +/******************************************************************************* + * 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.server.resources; + +import java.util.List; + +import javax.ws.rs.FormParam; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +import org.springframework.stereotype.Component; + +import com.gluster.storage.management.core.model.GenericResponse; +import com.gluster.storage.management.core.model.GlusterServer; +import com.gluster.storage.management.core.model.GlusterServer.SERVER_STATUS; +import com.gluster.storage.management.core.model.GlusterServerListResponse; +import com.gluster.storage.management.core.model.GlusterServerResponse; +import com.gluster.storage.management.core.model.Server; +import com.gluster.storage.management.core.model.Status; +import com.gluster.storage.management.core.utils.GlusterUtil; +import com.gluster.storage.management.core.utils.ProcessResult; +import com.sun.jersey.spi.resource.Singleton; + +@Component +@Singleton +@Path("/cluster/servers") +public class GlusterServersResource extends AbstractServersResource { + private GlusterUtil glusterUtil = new GlusterUtil(); + public static final String HOSTNAMETAG = "hostname:"; + + private List<GlusterServer> getServerDetails() { + List<GlusterServer> glusterServers = glusterUtil.getGlusterServers(); + for (GlusterServer server : glusterServers) { + if (server.getStatus() == SERVER_STATUS.ONLINE) { + fetchServerDetails(server); + // server.setPreferredNetworkInterface(server.getNetworkInterfaces().get(0)); + } + } + return glusterServers; + } + + @GET + @Produces(MediaType.TEXT_XML) + public GlusterServerListResponse getGlusterServers() { + return new GlusterServerListResponse(Status.STATUS_SUCCESS, getServerDetails()); + } + + @GET + @Path("{serverName}") + @Produces(MediaType.TEXT_XML) + public GlusterServer getGlusterServer(@PathParam("serverName") String serverName) { + GlusterServer server = new GlusterServer(serverName); + fetchServerDetails(server); + // server.setPreferredNetworkInterface(server.getNetworkInterfaces().get(0)); + server.setStatus(SERVER_STATUS.ONLINE); + return server; + } + + /* + * (non-Javadoc) + * + * @see + * com.gluster.storage.management.server.resources.AbstractServersResource#fetchServerDetails(com.gluster.storage + * .management.core.model.Server) + */ + @Override + protected void fetchServerDetails(Server server) { + // fetch standard server details like cpu, disk, memory details + super.fetchServerDetails(server); + + // TODO: Fetch gluster server details like status + } + + @POST + @Produces(MediaType.TEXT_XML) + public GlusterServerResponse addServer(@FormParam("serverName") String serverName) { + ProcessResult result = glusterUtil.addServer(serverName); + + if (!result.isSuccess()) { + Status failure = new Status(Status.STATUS_CODE_FAILURE, "Add server [" + serverName + "] failed: [" + result.getExitValue() + + "][" + result.getOutput() + "]"); + return new GlusterServerResponse(failure, null); + } + return new GlusterServerResponse(Status.STATUS_SUCCESS, getGlusterServer(serverName)); + } + + public static void main(String[] args) { + GlusterServersResource glusterServersResource = new GlusterServersResource(); + System.out.println(glusterServersResource.getServerDetails()); + + // To add a server + GlusterServerResponse response = glusterServersResource.addServer("my-server"); + System.out.println(response.getData().getName()); + } +} diff --git a/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/Hello.java b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/Hello.java new file mode 100644 index 00000000..4e379199 --- /dev/null +++ b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/Hello.java @@ -0,0 +1,50 @@ +/******************************************************************************* + * 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.server.resources; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +//Sets the path to base URL + /hello +@Path("/hello") +public class Hello { + // This method is called if TEXT_PLAIN is request + @GET + @Produces(MediaType.TEXT_PLAIN) + public String sayPlainTextHello() { + return "Hello Jersey"; + } + + // This method is called if XMLis request + @GET + @Produces(MediaType.TEXT_XML) + public String sayXMLHello() { + return "<?xml version=\"1.0\"?>" + "<hello> Hello Jersey" + "</hello>"; + } + + // This method is called if HTML is request + @GET + @Produces(MediaType.TEXT_HTML) + public String sayHtmlHello() { + return "<html> " + "<title>" + "Hello Jersey" + "</title>" + + "<body><h1>" + "Hello Jersey" + "</body></h1>" + "</html> "; + } +} diff --git a/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/RunningTaskResource.java b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/RunningTaskResource.java new file mode 100644 index 00000000..2cec4c36 --- /dev/null +++ b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/RunningTaskResource.java @@ -0,0 +1,128 @@ +/******************************************************************************* + * 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.server.resources; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import javax.ws.rs.FormParam; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +import org.springframework.stereotype.Component; + +import static com.gluster.storage.management.core.constants.RESTConstants.RESOURCE_PATH_RUNNING_TASKS; +import com.gluster.storage.management.core.model.Response; +import com.gluster.storage.management.core.model.RunningTask; +import com.gluster.storage.management.core.model.RunningTaskListResponse; +import com.gluster.storage.management.core.model.RunningTaskStatus; +import com.gluster.storage.management.core.model.Status; +import com.gluster.storage.management.server.runningtasks.managers.RunningTaskManager; + +@Component +@Path(RESOURCE_PATH_RUNNING_TASKS) +public class RunningTaskResource { + + @GET + @Produces(MediaType.TEXT_XML) + public RunningTaskListResponse getRunningTasks() { + + RunningTaskStatus status = new RunningTaskStatus(); + List<RunningTask> runningTasks = new ArrayList<RunningTask>(); + + status.setCode(Status.STATUS_CODE_RUNNING); + status.setPercentageSupported(false); + + // Volume rebalance + RunningTask task = new RunningTask(); + task.setId("0001"); + task.setType("VolumeRebalance"); + task.setReference(""); + task.setDescription("Volume [Volume1] rebalance is running"); + task.setStatus(status); + runningTasks.add(task); + + task = new RunningTask(); + task.setId("0002"); + task.setType("VolumeRebalance"); + task.setReference(""); + task.setDescription("Volume [Volume2] rebalance is running"); + //task.setDescription("Error: volume rebalance operation failed at fd 0000 [/export/test-song-volume/mydirectory/test-video.avi"); + task.setStatus(status); + runningTasks.add(task); + + // MigrateDisk + task = new RunningTask(); + task.setId("0003"); + task.setType("MigrateDisk"); + task.setReference(""); + task.setDescription("Disk migration [Volume3/sda] is running"); + task.setStatus(status); + runningTasks.add(task); + + // FormatDisk + task = new RunningTask(); + task.setId("0004"); + task.setType("FormatDisk"); + task.setReference(""); + task.setDescription("Volume [vol1] rebalance is running"); + status.setPercentageSupported(true); + status.getPercentCompleted(45); + task.setStatus(status); + runningTasks.add(task); + return new RunningTaskListResponse(Status.STATUS_SUCCESS, runningTasks); + } + + @SuppressWarnings("rawtypes") + public Response startTask(@FormParam("taskType") String taskType) { + String managerClassName = "com.gluster.storage.management.server.runningtasks.managers." + taskType + "Manager"; + Class managerClass; + RunningTaskManager manager = null; + try { + managerClass = Class.forName(managerClassName); + manager = (RunningTaskManager) managerClass.newInstance(); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } catch (InstantiationException e) { + e.printStackTrace(); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + + // TODO: set form params on the manager + Map params = null; + manager.setFormParams(params); + manager.start(); + return null; + } + + // TODO Remove the test script for production + public static void main(String[] args) { + RunningTaskResource rt = new RunningTaskResource(); + RunningTaskListResponse tasks = rt.getRunningTasks(); + List<RunningTask> runningTasks = tasks.getRunningTasks(); + for( RunningTask x : runningTasks) { + System.out.println( x.getId() + " : " + x.getType() + " : " + x.getDescription() ); + } + } +} + diff --git a/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/ServerResource.java b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/ServerResource.java new file mode 100644 index 00000000..97b874e2 --- /dev/null +++ b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/ServerResource.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * 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.server.resources;
+
+import java.io.File;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+import com.gluster.storage.management.core.utils.FileUtil;
+import com.gluster.storage.management.core.utils.MD5Crypt;
+import com.gluster.storage.management.core.utils.ProcessResult;
+import com.gluster.storage.management.core.utils.ProcessUtil;
+
+@Path("/server")
+public class ServerResource {
+ // TODO: xml should be read from a "work" directory under the tomcat server.
+ // Use relative path - do not hard code the absolute path.
+ public static final String DISCOVERED_SERVERS_XML = "/GLUSTER/discovered-servers.xml";
+
+ /**
+ * Discover newly available servers
+ *
+ * @return list of discovered servers
+ */
+ private String GetDiscoveredServers() {
+ File discoveredServersFile = new File(DISCOVERED_SERVERS_XML);
+ String serverNames = new FileUtil().readFileAsString(discoveredServersFile);
+ return serverNames;
+ }
+
+ @Path("/discover")
+ @GET
+ @Produces(MediaType.TEXT_XML)
+ public String discoveredServers() {
+ return GetDiscoveredServers();
+ }
+
+ private String GetDetails() {
+ ProcessResult result = new ProcessUtil().executeCommand("get-server-details.py");
+ if (!result.isSuccess()) {
+ //TODO:Generate error message and return
+ }
+ return result.getOutput();
+ }
+
+ @Path("/details")
+ @GET
+ @Produces(MediaType.TEXT_XML)
+ public String serverDetails() {
+ return GetDetails();
+ }
+
+}
diff --git a/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/UsersResource.java b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/UsersResource.java new file mode 100644 index 00000000..51134317 --- /dev/null +++ b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/UsersResource.java @@ -0,0 +1,91 @@ +/******************************************************************************* + * 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.server.resources; + +import javax.ws.rs.FormParam; +import javax.ws.rs.GET; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.authentication.encoding.PasswordEncoder; +import org.springframework.security.core.AuthenticationException; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.provisioning.JdbcUserDetailsManager; +import org.springframework.stereotype.Component; + +import com.gluster.storage.management.core.model.Status; +import com.sun.jersey.spi.resource.Singleton; + +@Singleton +@Component +@Path("/users") +public class UsersResource { + @Autowired + private JdbcUserDetailsManager jdbcUserService; + + @Autowired + private PasswordEncoder passwordEncoder; + + /** + * Authenticates given user with given password for login on current system + * + * @param user + * @param password + * @return true is user can be successfully authenticated using given password, else false + */ + /* + * NOTE: This method is no more required as user authentication is performed on every request by the spring security + * framework. Can be removed after testing. + */ + /* + * private boolean authenticate(String user, String password) { String tmpFileName = "tmp"; File saltFile = new + * File(tmpFileName); ProcessResult result = new ProcessUtil().executeCommand("get-user-password.py", user, + * tmpFileName); if (result.isSuccess()) { String salt = new FileUtil().readFileAsString(saltFile); String + * encryptedPassword = MD5Crypt.crypt(password, salt); return encryptedPassword.equals(salt); } + * + * return false; } + */ + + @Path("{user}") + @GET + @Produces(MediaType.TEXT_XML) + public Status login(@PathParam("user") String user) { + // success only if the user passed in query is same as the one passed in security header + return (SecurityContextHolder.getContext().getAuthentication().getName().equals(user) ? Status.STATUS_SUCCESS + : Status.STATUS_FAILURE); + } + + @Path("{user}") + @PUT + @Produces(MediaType.TEXT_XML) + public Status changePassword(@FormParam("oldpassword") String oldPassword, + @FormParam("newpassword") String newPassword) { + try { + jdbcUserService.changePassword(oldPassword, passwordEncoder.encodePassword(newPassword, null)); + } catch (AuthenticationException ex) { + ex.printStackTrace(); + return new Status(Status.STATUS_CODE_FAILURE, "Could not change password: [" + ex.getMessage() + "]"); + } + return Status.STATUS_SUCCESS; + } +} diff --git a/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/VolumesResource.java b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/VolumesResource.java new file mode 100644 index 00000000..dfa5a5cc --- /dev/null +++ b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/VolumesResource.java @@ -0,0 +1,93 @@ +/** + * VolumesResource.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.server.resources; + +import static com.gluster.storage.management.core.constants.RESTConstants.FORM_PARAM_OPERATION; +import static com.gluster.storage.management.core.constants.RESTConstants.FORM_PARAM_VALUE_START; +import static com.gluster.storage.management.core.constants.RESTConstants.FORM_PARAM_VALUE_STOP; +import static com.gluster.storage.management.core.constants.RESTConstants.PATH_PARAM_VOLUME_NAME; +import static com.gluster.storage.management.core.constants.RESTConstants.RESOURCE_PATH_VOLUMES; +import static com.gluster.storage.management.core.constants.RESTConstants.SUBRESOURCE_DEFAULT_OPTIONS; + +import java.util.Map; + +import javax.ws.rs.Consumes; +import javax.ws.rs.FormParam; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +import com.gluster.storage.management.core.model.GenericResponse; +import com.gluster.storage.management.core.model.Status; +import com.gluster.storage.management.core.model.Volume; +import com.gluster.storage.management.core.utils.GlusterUtil; +import com.gluster.storage.management.core.utils.ProcessResult; +import com.gluster.storage.management.server.constants.VolumeOptionsDefaults; +import com.sun.jersey.spi.resource.Singleton; + +@Singleton +@Path(RESOURCE_PATH_VOLUMES) +public class VolumesResource { + private final GlusterUtil glusterUtil = new GlusterUtil(); + + @POST + @Consumes(MediaType.TEXT_XML) + @Produces(MediaType.TEXT_XML) + public GenericResponse<String> createVolume(Volume volume) { + ProcessResult response = glusterUtil.createVolume(volume); + if (!response.isSuccess()) { + return new GenericResponse<String>(Status.STATUS_FAILURE, "Volume creation failed: [" + + response.getOutput() + "]"); + } + + response = glusterUtil.setVolumeAccessControl(volume); + + return new GenericResponse<String>(Status.STATUS_SUCCESS, response.getOutput()); + } + + @PUT + @Path("{" + PATH_PARAM_VOLUME_NAME + "}") + @Produces(MediaType.TEXT_XML) + public Status performOperation(@FormParam(FORM_PARAM_OPERATION) String operation, + @PathParam(PATH_PARAM_VOLUME_NAME) String volumeName) { + + if (operation.equals(FORM_PARAM_VALUE_START)) { + return new Status(glusterUtil.startVolume(volumeName)); + } + if (operation.equals(FORM_PARAM_VALUE_STOP)) { + return new Status(glusterUtil.stopVolume(volumeName)); + } + return new Status(Status.STATUS_CODE_FAILURE, "Invalid operation code [" + operation + "]"); + } + + @GET + @Path(SUBRESOURCE_DEFAULT_OPTIONS) + @Produces(MediaType.TEXT_XML) + public VolumeOptionsDefaults getDefaultOptions() { + // TODO: Fetch all volume options with their default values from GlusterFS + // whenever such a CLI command is made available in GlusterFS + return new VolumeOptionsDefaults().getDefaults(); + } +}
\ No newline at end of file diff --git a/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/runningtasks/managers/FormatDiskManager.java b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/runningtasks/managers/FormatDiskManager.java new file mode 100644 index 00000000..37cc22f6 --- /dev/null +++ b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/runningtasks/managers/FormatDiskManager.java @@ -0,0 +1,71 @@ +/******************************************************************************* + * 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.server.runningtasks.managers; + +import java.util.Map; + +import com.gluster.storage.management.core.model.Status; +import com.gluster.storage.management.core.model.RunningTaskStatus; + +public class FormatDiskManager implements RunningTaskManager { + + + @Override + public String getId() { + // TODO Auto-generated method stub + return null; + } + + @Override + public RunningTaskStatus start() { + // TODO Auto-generated method stub + return null; + } + + @Override + public RunningTaskStatus stop() { + // TODO Auto-generated method stub + return null; + } + + @Override + public RunningTaskStatus pause() { + // TODO Auto-generated method stub + return null; + } + + @Override + public RunningTaskStatus resume() { + // TODO Auto-generated method stub + return null; + } + + @Override + public void setFormParams(Map params) { + // TODO Auto-generated method stub + + } + + @Override + public RunningTaskStatus getStatus() { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/runningtasks/managers/MigrateDiskManager.java b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/runningtasks/managers/MigrateDiskManager.java new file mode 100644 index 00000000..97916abe --- /dev/null +++ b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/runningtasks/managers/MigrateDiskManager.java @@ -0,0 +1,50 @@ +package com.gluster.storage.management.server.runningtasks.managers; + +import java.util.Map; + +import com.gluster.storage.management.core.model.RunningTaskStatus; + +public class MigrateDiskManager implements RunningTaskManager { + + @Override + public String getId() { + // TODO Auto-generated method stub + return null; + } + + @Override + public RunningTaskStatus start() { + // TODO Auto-generated method stub + return null; + } + + @Override + public RunningTaskStatus stop() { + // TODO Auto-generated method stub + return null; + } + + @Override + public RunningTaskStatus pause() { + // TODO Auto-generated method stub + return null; + } + + @Override + public RunningTaskStatus resume() { + // TODO Auto-generated method stub + return null; + } + + @Override + public void setFormParams(Map params) { + // TODO Auto-generated method stub + + } + + @Override + public RunningTaskStatus getStatus() { + // TODO Auto-generated method stub + return null; + } +} diff --git a/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/runningtasks/managers/RunningTaskManager.java b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/runningtasks/managers/RunningTaskManager.java new file mode 100755 index 00000000..a21c6b81 --- /dev/null +++ b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/runningtasks/managers/RunningTaskManager.java @@ -0,0 +1,44 @@ +/******************************************************************************* + * 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.server.runningtasks.managers; + +import java.util.Map; + +import com.gluster.storage.management.core.model.Status; +import com.gluster.storage.management.core.model.RunningTaskStatus; + +public interface RunningTaskManager { + + public String getId(); + + public RunningTaskStatus start(); + + public RunningTaskStatus stop(); + + public RunningTaskStatus pause(); + + public RunningTaskStatus resume(); + + public RunningTaskStatus getStatus(); + + @SuppressWarnings("rawtypes") + public void setFormParams(Map params); + +} diff --git a/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/runningtasks/managers/VolumeRebalanceManager.java b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/runningtasks/managers/VolumeRebalanceManager.java new file mode 100644 index 00000000..01a5dc25 --- /dev/null +++ b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/runningtasks/managers/VolumeRebalanceManager.java @@ -0,0 +1,50 @@ +package com.gluster.storage.management.server.runningtasks.managers; + +import java.util.Map; + +import com.gluster.storage.management.core.model.RunningTaskStatus; + +public class VolumeRebalanceManager implements RunningTaskManager { + + @Override + public String getId() { + // TODO Auto-generated method stub + return null; + } + + @Override + public RunningTaskStatus start() { + // TODO Auto-generated method stub + return null; + } + + @Override + public RunningTaskStatus stop() { + // TODO Auto-generated method stub + return null; + } + + @Override + public RunningTaskStatus pause() { + // TODO Auto-generated method stub + return null; + } + + @Override + public RunningTaskStatus resume() { + // TODO Auto-generated method stub + return null; + } + + @Override + public void setFormParams(Map params) { + // TODO Auto-generated method stub + + } + + @Override + public RunningTaskStatus getStatus() { + // TODO Auto-generated method stub + return null; + } +} diff --git a/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/security/GlusterUserDetailsService.java b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/security/GlusterUserDetailsService.java new file mode 100644 index 00000000..21c13a03 --- /dev/null +++ b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/security/GlusterUserDetailsService.java @@ -0,0 +1,31 @@ +/** + * GlusterUserDetailsService.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.server.security; + +import org.springframework.security.core.userdetails.UserDetailsService; + +/** + * + */ +public interface GlusterUserDetailsService extends UserDetailsService { + void changePassword(String username, String password); +} + diff --git a/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/security/UserAuthDao.java b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/security/UserAuthDao.java new file mode 100644 index 00000000..cfc6e572 --- /dev/null +++ b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/security/UserAuthDao.java @@ -0,0 +1,42 @@ +/** + * UserAuthDao.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.server.security; + +import org.springframework.security.core.userdetails.jdbc.JdbcDaoImpl; + +/** + * @author root + * + */ +public class UserAuthDao extends JdbcDaoImpl implements GlusterUserDetailsService { + + /* + * (non-Javadoc) + * + * @see com.gluster.storage.management.server.security.GlusterUserDetailsService#changePassword(java.lang.String, + * java.lang.String) + */ + @Override + public void changePassword(String username, String password) { + getJdbcTemplate().update("UPDATE USERS SET PASSWORD = ? WHERE USERNAME = ?", password, username); + } + +} diff --git a/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/tasks/InitServerTask.java b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/tasks/InitServerTask.java new file mode 100644 index 00000000..d96db6ca --- /dev/null +++ b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/tasks/InitServerTask.java @@ -0,0 +1,99 @@ +/** + * GlusterServerInitializer.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.server.tasks; + +import java.io.ByteArrayOutputStream; +import java.sql.ResultSet; +import java.sql.SQLException; + +import org.apache.derby.tools.ij; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.dao.DataAccessException; +import org.springframework.jdbc.core.RowCallbackHandler; +import org.springframework.jdbc.core.support.JdbcDaoSupport; +import org.springframework.security.authentication.encoding.PasswordEncoder; + +import com.gluster.storage.management.core.constants.CoreConstants; +import com.gluster.storage.management.core.exceptions.GlusterRuntimeException; +import com.gluster.storage.management.core.utils.FileUtil; + +/** + * Initializes the Gluster Management Server. + */ +public class InitServerTask extends JdbcDaoSupport { + @Autowired + private PasswordEncoder passwordEncoder; + + public void securePasswords() { + getJdbcTemplate().query("select username, password from users", new RowCallbackHandler() { + @Override + public void processRow(ResultSet rs) throws SQLException { + String username = rs.getString(1); + String password = rs.getString(2); + String encodedPassword = passwordEncoder.encodePassword(password, null); + getJdbcTemplate().update("update users set password = ? where username = ?", encodedPassword, username); + logger.debug("Updating password for username: " + username); + } + }); + } + + private void executeScript(String script) { + ByteArrayOutputStream sqlOut = new ByteArrayOutputStream(); + int numOfExceptions; + try { + numOfExceptions = ij.runScript(getJdbcTemplate().getDataSource().getConnection(), + new FileUtil().loadResource(script), CoreConstants.ENCODING_UTF8, sqlOut, + CoreConstants.ENCODING_UTF8); + String output = sqlOut.toString(); + sqlOut.close(); + logger.debug("Data script [" + script + "] returned with exit status [" + numOfExceptions + + "] and output [" + output + "]"); + if (numOfExceptions != 0) { + throw new GlusterRuntimeException("Server data initialization script [ " + script + "] failed with [" + + numOfExceptions + "] exceptions! [" + output + "]"); + } + } catch (Exception ex) { + ex.printStackTrace(); + throw new GlusterRuntimeException("Server data initialization script [" + script + "] failed!", ex); + } + } + + private void initDatabase() { + logger.debug("Initializing server data..."); + executeScript("data/scripts/security-schema.sql"); + executeScript("data/scripts/users-authorities-groups.sql"); + securePasswords(); // encrypt the passwords + } + + /** + * Initializes the server database, if running for the first time. + */ + public synchronized void initServer() { + try { + // Query to check whether the user table exists + getJdbcTemplate().queryForInt("select count(*) from users"); + logger.debug("Server data is already initialized!"); + } catch (DataAccessException ex) { + // Database not created yet. Create it! + initDatabase(); + } + } +} diff --git a/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/tasks/ServerDiscoveryTask.java b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/tasks/ServerDiscoveryTask.java new file mode 100644 index 00000000..9fcb28e6 --- /dev/null +++ b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/tasks/ServerDiscoveryTask.java @@ -0,0 +1,75 @@ +/** + * ServerDiscoveryTask.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.server.tasks; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import javax.servlet.ServletContext; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import com.gluster.storage.management.core.constants.CoreConstants; +import com.gluster.storage.management.core.utils.ProcessResult; +import com.gluster.storage.management.server.resources.DiscoveredServersResource; +import com.gluster.storage.management.server.utils.ServerUtil; +import com.sun.jersey.spi.resource.Singleton; + +/** + * Task for auto-discovery of servers eligible to be added to the Gluster cluster. This task runs periodically and keeps + * the discovered server list at a common place. The server resource can then pick it and send to client whenever + * demanded. + */ +@Singleton +@Component +public class ServerDiscoveryTask { + private static final String ENV_AWS = "aws"; + private static final String ENV_VMWARE = "vmware"; + private static final String ENV_PHYCAL = "physical"; + private static final String SCRIPT_NAME_SFX = "-discover-servers.py"; + + @Autowired + private ServerUtil serverUtil; + + @Autowired + private ServletContext servletContext; + + @Autowired + private DiscoveredServersResource discoveredServersResource; + + @Autowired + private String environment; + + public void discoverServers() { + List<String> serverNameList = new ArrayList<String>(); + + ProcessResult result = serverUtil.executeGlusterScript(true, environment + SCRIPT_NAME_SFX, new ArrayList<String>()); + if(result.isSuccess()) { + String serverNames = result.getOutput(); + String[] parts = serverNames.split(CoreConstants.NEWLINE); + serverNameList = Arrays.asList(parts); + } + + discoveredServersResource.setDiscoveredServerNames(serverNameList); + } +}
\ No newline at end of file diff --git a/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/utils/ServerUtil.java b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/utils/ServerUtil.java new file mode 100644 index 00000000..1d237461 --- /dev/null +++ b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/utils/ServerUtil.java @@ -0,0 +1,58 @@ +/** + * ServerUtil.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.server.utils; + +import java.util.ArrayList; +import java.util.List; + +import javax.servlet.ServletContext; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import com.gluster.storage.management.core.constants.CoreConstants; +import com.gluster.storage.management.core.utils.ProcessResult; +import com.gluster.storage.management.core.utils.ProcessUtil; +import com.sun.jersey.spi.resource.Singleton; + +@Singleton +@Component +public class ServerUtil { + @Autowired + ServletContext servletContext; + + private static final String SCRIPT_DIR = "scripts"; + private static final String SCRIPT_COMMAND = "python"; + + public ProcessResult executeGlusterScript(boolean runInForeground, String scriptName, List<String> arguments) { + List<String> command = new ArrayList<String>(); + + command.add(SCRIPT_COMMAND); + command.add(getScriptPath(scriptName)); + command.addAll(arguments); + return new ProcessUtil().executeCommand(runInForeground, command); + } + + private String getScriptPath(String scriptName) { + String scriptPath = servletContext.getRealPath(SCRIPT_DIR) + CoreConstants.FILE_SEPARATOR + scriptName; + return scriptPath; + } +}
\ No newline at end of file diff --git a/src/com.gluster.storage.management.server/src/data/scripts/security-schema.sql b/src/com.gluster.storage.management.server/src/data/scripts/security-schema.sql new file mode 100644 index 00000000..fdde5823 --- /dev/null +++ b/src/com.gluster.storage.management.server/src/data/scripts/security-schema.sql @@ -0,0 +1,26 @@ +create table users( + username varchar(50) not null primary key, + password varchar(50) not null, + enabled smallint not null + ); + + create table authorities ( + username varchar(50) not null, + authority varchar(50) not null, + constraint fk_authorities_users foreign key(username) references users(username)); + create unique index ix_auth_username on authorities (username,authority); + +create table groups ( + id bigint generated by default as identity(start with 0) primary key, + group_name varchar(50) not null); + +create table group_authorities ( + group_id bigint not null, + authority varchar(50) not null, + constraint fk_group_authorities_group foreign key(group_id) references groups(id)); + +create table group_members ( + id bigint generated by default as identity(start with 0) primary key, + username varchar(50) not null, + group_id bigint not null, + constraint fk_group_members_group foreign key(group_id) references groups(id)); diff --git a/src/com.gluster.storage.management.server/src/data/scripts/users-authorities-groups.sql b/src/com.gluster.storage.management.server/src/data/scripts/users-authorities-groups.sql new file mode 100644 index 00000000..35ccf965 --- /dev/null +++ b/src/com.gluster.storage.management.server/src/data/scripts/users-authorities-groups.sql @@ -0,0 +1,21 @@ +-- Create users +insert into users(username, password, enabled) values ('gluster','gluster',1); +insert into users(username, password, enabled) values ('guest','guest',1); + +-- Assign authorities to users (to be removed after implementing user group functionality) +insert into authorities(username,authority) values ('gluster','ROLE_USER'); +insert into authorities(username,authority) values ('gluster','ROLE_ADMIN'); +insert into authorities(username,authority) values ('guest','ROLE_USER'); + +-- Create user groups +insert into groups(group_name) values ('Users'); +insert into groups(group_name) values ('Administrators'); + +-- Add authorities to groups (functionality not yet implemented in code) +insert into group_authorities(group_id, authority) select id,'ROLE_USER' from groups where group_name='Users'; +insert into group_authorities(group_id, authority) select id,'ROLE_USER' from groups where group_name='Administrators'; +insert into group_authorities(group_id, authority) select id,'ROLE_ADMIN' from groups where group_name='Administrators'; + +-- Assign group members +insert into group_members(group_id, username) select id,'guest' from groups where group_name='Users'; +insert into group_members(group_id, username) select id,'gluster' from groups where group_name='Administrators';
\ No newline at end of file diff --git a/src/com.gluster.storage.management.server/src/spring/gluster-server-base.xml b/src/com.gluster.storage.management.server/src/spring/gluster-server-base.xml new file mode 100644 index 00000000..86a8708f --- /dev/null +++ b/src/com.gluster.storage.management.server/src/spring/gluster-server-base.xml @@ -0,0 +1,50 @@ + +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" + xmlns:task="http://www.springframework.org/schema/task" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd + http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd + http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd"> + <context:component-scan base-package="com.gluster.storage.management.server" /> + <task:scheduler id="taskScheduler" /> + <task:executor id="taskExecutor" pool-size="1" /> + <task:annotation-driven executor="taskExecutor" + scheduler="taskScheduler" /> + + <task:scheduled-tasks> + <task:scheduled ref="serverDiscoveryTask" method="discoverServers" + fixed-delay="60000" /> + </task:scheduled-tasks> + + <bean id="environment" class="java.lang.String"> + <constructor-arg value="vmware" /> + </bean> + + <!-- Derby embedded data source --> + <!-- bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" + lazy-init="false"> <property name="driverClassName" value="org.apache.derby.jdbc.EmbeddedDriver" + /> <property name="url" value="jdbc:derby:work/data;create=true" /> <property + name="username" value="gluster" /> <property name="password" value="gluster" + /> </bean --> + + <bean id="dataSourceFactory" + class="com.gluster.storage.management.server.data.GlusterDataSource" /> + <bean id="dataSource" + class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"> + <property name="targetObject"> + <ref local="dataSourceFactory" /> + </property> + <property name="targetMethod"> + <value>getDataSource</value> + </property> + </bean> + + <!-- bean id="dataSource" class="com.gluster.storage.management.server.data.GlusterDataSource" + lazy-init="false" autowire="byType" / --> + + <bean class="com.gluster.storage.management.server.tasks.InitServerTask" + init-method="initServer" depends-on="dataSource"> + <property name="dataSource" ref="dataSource" /> + </bean> +</beans>
\ No newline at end of file diff --git a/src/com.gluster.storage.management.server/src/spring/gluster-server-security.xml b/src/com.gluster.storage.management.server/src/spring/gluster-server-security.xml new file mode 100644 index 00000000..0de97761 --- /dev/null +++ b/src/com.gluster.storage.management.server/src/spring/gluster-server-security.xml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8"?> +<beans:beans xmlns="http://www.springframework.org/schema/security" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans" + xmlns:jdbc="http://www.springframework.org/schema/jdbc" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd + http://www.springframework.org/schema/security + http://www.springframework.org/schema/security/spring-security-3.0.xsd + "> + + <http auto-config="true" use-expressions="true"> + <intercept-url pattern="/resources/*" + access="hasRole('ROLE_ADMIN') and fullyAuthenticated" /> + <intercept-url pattern="/*" access="permitAll" /> + <!-- SSL Protection --> + <!-- <intercept-url pattern="/resources/*" access="hasRole('ROLE_ADMIN') + and fullyAuthenticated" requires-channel="https"/> <intercept-url pattern="/*" + access="permitAll" requires-channel="any"/> --> + <port-mappings> + <port-mapping http="8080" https="8443" /> + </port-mappings> + + <!-- HTTP basic authentication --> + <http-basic /> + </http> + + <beans:bean + class="org.springframework.security.authentication.encoding.ShaPasswordEncoder" + id="passwordEncoder" /> + + <authentication-manager alias="authenticationManager"> + <authentication-provider user-service-ref="jdbcUserService"> + <!-- Passwords are SHA encrypted --> + <password-encoder hash="sha" /> + </authentication-provider> + </authentication-manager> + + <beans:bean id="jdbcUserService" + class="org.springframework.security.provisioning.JdbcUserDetailsManager" + lazy-init="false"> + <beans:property name="dataSource" ref="dataSource" /> + <beans:property name="authenticationManager" ref="authenticationManager" /> + </beans:bean> +</beans:beans>
\ No newline at end of file |
