git-svn-id: https://svn.d4science-ii.research-infrastructures.eu/gcube/private/alessandro.pieve/resource-management@146318 82a268e6-3cf1-43bd-a215-b396298e98cf
|
@ -0,0 +1,43 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/resource-management-6.3.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/resource-management-6.3.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
|
||||
<classpathentry kind="output" path="target/resource-management-6.3.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
</classpath>
|
|
@ -0,0 +1,60 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>resource-management</name>
|
||||
<comment>resource-management project</comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.common.project.facet.core.builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.validation.validationbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.maven.ide.eclipse.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.google.gdt.eclipse.core.webAppProjectValidator</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.google.gwt.eclipse.core.gwtProjectValidator</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
||||
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
|
||||
<nature>org.maven.ide.eclipse.maven2Nature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
||||
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
|
||||
<nature>com.google.gwt.eclipse.core.gwtNature</nature>
|
||||
<nature>com.liferay.ide.core.liferayNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src/main/webapp" />
|
||||
<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>
|
|
@ -0,0 +1,3 @@
|
|||
#Thu Jun 16 10:18:26 CEST 2011
|
||||
eclipse.preferences.version=1
|
||||
filesCopiedToWebInfLib=
|
|
@ -0,0 +1,5 @@
|
|||
eclipse.preferences.version=1
|
||||
jarsExcludedFromWebInfLib=
|
||||
lastWarOutDir=/Users/massi/Documents/workspace/resource-management/target/resource-management-5.3.0-SNAPSHOT
|
||||
warSrcDir=src/main/webapp
|
||||
warSrcDirIsOutput=false
|
|
@ -0,0 +1,5 @@
|
|||
#Thu Jun 16 11:14:17 CEST 2011
|
||||
eclipse.preferences.version=1
|
||||
entryPointModules=
|
||||
filesCopiedToWebInfLib=gwt-servlet.jar
|
||||
gwtCompileSettings=PGd3dC1jb21waWxlLXNldHRpbmdzPjxsb2ctbGV2ZWw+SU5GTzwvbG9nLWxldmVsPjxvdXRwdXQtc3R5bGU+T0JGVVNDQVRFRDwvb3V0cHV0LXN0eWxlPjxleHRyYS1hcmdzPjwhW0NEQVRBWy13YXIgc3JjL21haW4vd2ViYXBwXV0+PC9leHRyYS1hcmdzPjx2bS1hcmdzPjwhW0NEQVRBWy1YbXg1MTJtXV0+PC92bS1hcmdzPjxlbnRyeS1wb2ludC1tb2R1bGU+Y29tLmNvbXBhbnkuU29tZU1vZHVsZTwvZW50cnktcG9pbnQtbW9kdWxlPjwvZ3d0LWNvbXBpbGUtc2V0dGluZ3M+
|
|
@ -0,0 +1,7 @@
|
|||
#Wed Feb 27 16:43:28 CET 2013
|
||||
eclipse.preferences.version=1
|
||||
encoding//src/main/java=UTF-8
|
||||
encoding//src/main/resources=UTF-8
|
||||
encoding//src/test/java=UTF-8
|
||||
encoding//src/test/resources=UTF-8
|
||||
encoding/<project>=UTF-8
|
|
@ -0,0 +1,8 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.source=1.7
|
|
@ -0,0 +1,3 @@
|
|||
eclipse.preferences.version=1
|
||||
validateFragments=false
|
||||
validation.use-project-settings=true
|
|
@ -0,0 +1,5 @@
|
|||
#Wed Feb 27 16:43:28 CET 2013
|
||||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
resolveWorkspaceProjects=true
|
||||
version=1
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||
<wb-module deploy-name="resource-management-portlet">
|
||||
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
||||
<dependent-module archiveName="rmp-common-library-2.7.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/rmp-common-library/rmp-common-library">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module archiveName="ishealth-monitor-widget-1.2.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/resource-ishealth-monitor/resource-ishealth-monitor">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module archiveName="resource-sweeper-widget-2.3.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/resource-sweeper/resource-sweeper">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>
|
||||
<property name="context-root" value="resource-management"/>
|
||||
</wb-module>
|
||||
</project-modules>
|
|
@ -0,0 +1,7 @@
|
|||
<root>
|
||||
<facet id="jst.jaxrs">
|
||||
<node name="libprov">
|
||||
<attribute name="provider-id" value="jaxrs-no-op-library-provider"/>
|
||||
</node>
|
||||
</facet>
|
||||
</root>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<faceted-project>
|
||||
<fixed facet="wst.jsdt.web"/>
|
||||
<installed facet="wst.jsdt.web" version="1.0"/>
|
||||
<installed facet="jst.web" version="2.5"/>
|
||||
<installed facet="java" version="1.7"/>
|
||||
<installed facet="liferay.portlet" version="6.0"/>
|
||||
<installed facet="jst.jaxrs" version="2.0"/>
|
||||
</faceted-project>
|
|
@ -0,0 +1 @@
|
|||
org.eclipse.wst.jsdt.launching.baseBrowserLibrary
|
|
@ -0,0 +1,2 @@
|
|||
disabled=06target
|
||||
eclipse.preferences.version=1
|
|
@ -0,0 +1,9 @@
|
|||
#Thu Sep 02 10:42:12 CEST 2010
|
||||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
fullBuildGoals=process-test-resources
|
||||
includeModules=false
|
||||
resolveWorkspaceProjects=true
|
||||
resourceFilterGoals=process-resources resources\:testResources
|
||||
skipCompilerPlugin=true
|
||||
version=1
|
|
@ -0,0 +1 @@
|
|||
{"ide":{"scriptPaths":[]},"plugins":{"aui":{},"liferay":{},"yui":{}},"libs":["ecma5","browser"]}
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="com.google.gwt.eclipse.core.launch.gwtJUnit">
|
||||
<stringAttribute key="com.google.gwt.eclipse.core.LOG_LEVEL" value="INFO"/>
|
||||
<booleanAttribute key="com.google.gwt.eclipse.core.NOT_HEADLESS" value="false"/>
|
||||
<stringAttribute key="com.google.gwt.eclipse.core.OUT_DIR" value="www-test"/>
|
||||
<booleanAttribute key="com.google.gwt.eclipse.core.STANDARDS_MODE" value="false"/>
|
||||
<stringAttribute key="com.google.gwt.eclipse.core.STYLE" value="OBFUSCATED"/>
|
||||
<stringAttribute key="com.google.gwt.eclipse.core.WEB_MODE" value="false"/>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/resource-management/src/test/java/org/gcube/portlets/admin/resourcemanagement/client/GwtTestResourceManagementPortlet.java"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="1"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
|
||||
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="com.google.gdt.eclipse.maven.mavenClasspathProvider"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.gcube.portlets.admin.resourcemanagement.client.GwtTestResourceManagementPortlet"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="resource-management"/>
|
||||
</launchConfiguration>
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="com.google.gwt.eclipse.core.launch.gwtJUnit">
|
||||
<stringAttribute key="com.google.gwt.eclipse.core.LOG_LEVEL" value="INFO"/>
|
||||
<booleanAttribute key="com.google.gwt.eclipse.core.NOT_HEADLESS" value="false"/>
|
||||
<stringAttribute key="com.google.gwt.eclipse.core.OUT_DIR" value="www-test"/>
|
||||
<booleanAttribute key="com.google.gwt.eclipse.core.STANDARDS_MODE" value="false"/>
|
||||
<stringAttribute key="com.google.gwt.eclipse.core.STYLE" value="OBFUSCATED"/>
|
||||
<stringAttribute key="com.google.gwt.eclipse.core.WEB_MODE" value="true"/>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/resource-management/src/test/java/org/gcube/portlets/admin/resourcemanagement/client/GwtTestResourceManagementPortlet.java"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="1"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
|
||||
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="com.google.gdt.eclipse.maven.mavenClasspathProvider"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.gcube.portlets.admin.resourcemanagement.client.GwtTestResourceManagementPortlet"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="resource-management"/>
|
||||
</launchConfiguration>
|
|
@ -0,0 +1 @@
|
|||
${gcube.license}
|
|
@ -0,0 +1,67 @@
|
|||
The gCube System - ${name}
|
||||
--------------------------------------------------
|
||||
|
||||
${description}
|
||||
|
||||
|
||||
${gcube.description}
|
||||
|
||||
${gcube.funding}
|
||||
|
||||
|
||||
Version
|
||||
--------------------------------------------------
|
||||
|
||||
${version} (${buildDate})
|
||||
|
||||
Please see the file named "changelog.xml" in this directory for the release notes.
|
||||
|
||||
|
||||
Authors
|
||||
--------------------------------------------------
|
||||
|
||||
* Massimiliano Assante (massimiliano.assante-AT-isti.cnr.it), Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" - CNR, Pisa (Italy).
|
||||
|
||||
|
||||
|
||||
Maintainers
|
||||
-----------
|
||||
|
||||
* Massimiliano Assante (massimiliano.assante-AT-isti.cnr.it), Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" - CNR, Pisa (Italy).
|
||||
|
||||
|
||||
Download information
|
||||
--------------------------------------------------
|
||||
|
||||
Source code is available from SVN:
|
||||
${scm.url}
|
||||
|
||||
Binaries can be downloaded from the gCube website:
|
||||
${gcube.website}
|
||||
|
||||
|
||||
Installation
|
||||
--------------------------------------------------
|
||||
|
||||
Installation documentation is available on-line in the gCube Wiki:
|
||||
${gcube.wikiRoot}/
|
||||
|
||||
|
||||
Documentation
|
||||
--------------------------------------------------
|
||||
|
||||
Documentation is available on-line in the gCube Wiki:
|
||||
${gcube.wikiRoot}/
|
||||
${gcube.wikiRoot}/
|
||||
|
||||
Support
|
||||
--------------------------------------------------
|
||||
|
||||
Bugs and support requests can be reported in the gCube issue tracking tool:
|
||||
${gcube.issueTracking}
|
||||
|
||||
|
||||
Licensing
|
||||
--------------------------------------------------
|
||||
|
||||
This software is licensed under the terms you may find in the file named "LICENSE" in this directory.
|
|
@ -0,0 +1,138 @@
|
|||
<ReleaseNotes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="xsd/changelog.xsd">
|
||||
<Changeset component="org.gcube.portlets-admin.resource-management-portlet.6-3-0"
|
||||
date="2017-02-24">
|
||||
<Change>Changed codes for AuthZ framework</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlets-admin.resource-management-portlet.6-0-0"
|
||||
date="2016-06-28">
|
||||
<Change>Ported to Liferay 6.2</Change>
|
||||
<Change>Removed Software Upload Widget</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlets-admin.resource-management-portlet.5-7-0"
|
||||
date="2015-11-24">
|
||||
<Change>Added support for new AuthZ framework, Feature #1496</Change>
|
||||
<Change>Removed Activation Record Widget, #1497</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlets-admin.resource-management-portlet.5-6-0"
|
||||
date="2015-09-28">
|
||||
<Change>Refactored code in dependencies to promote reuse of sweeper
|
||||
features</Change>
|
||||
<Change>Implemented Feature #187, remove scope operation with Report
|
||||
</Change>
|
||||
<Change>Implemented Feature #446 Show SmartGearsDistribution version
|
||||
instead of SmartGearsDistributionBundle version for Distro Version
|
||||
</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlets-admin.resource-management-portlet.5-5-0"
|
||||
date="2015-06-09">
|
||||
<Change>Fix for Incident #187, remove scope operation not passing
|
||||
through Resource Manager
|
||||
</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlets-admin.resource-management-portlet.5-4-0"
|
||||
date="2015-04-21">
|
||||
<Change>fixed Ticket #1119 Resource Management / Monitor wrong generic
|
||||
resource query
|
||||
</Change>
|
||||
<Change>Ported to GWT 270</Change>
|
||||
<Change>Updated for showing SmartGears versions in gHN Grid View
|
||||
</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlets-admin.resource-management-portlet.5-3-0"
|
||||
date="2014-12-09">
|
||||
<Change>Added Host column in grid view for service endpoints</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlets-admin.resource-management-portlet.5-2-0"
|
||||
date="2014-06-06">
|
||||
<Change>Ported to gCore Free Portal</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlets-admin.resource-management-portlet.5-1-0"
|
||||
date="2013-10-21">
|
||||
<Change>New Look And Feel</Change>
|
||||
<Change>Ported to GWT 2-5-1</Change>
|
||||
<Change>Ported to Feather Weight Stack</Change>
|
||||
<Change>Removed GCF Dependency</Change>
|
||||
<Change>Logging with sl4j Enabled</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlets-admin.resource-management-portlet.4-1-0"
|
||||
date="2013-04-19">
|
||||
<Change>added activation record widget as external module</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlets-admin.resource-management-portlet.4-0-0"
|
||||
date="2013-02-27">
|
||||
<Change>Mavenized</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlets-admin.resource-management-portlet.3-0-0"
|
||||
date="2013-01-13">
|
||||
<Change>Reengineered completely to support modules</Change>
|
||||
<Change>Added one click feature for retrieving resource profiles
|
||||
</Change>
|
||||
<Change>generic Resource grid view show description</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlets-admin.resource-management-portlet.2-3-0"
|
||||
date="2012-10-18">
|
||||
<Change>Added plugin for TreeManager activation record creation
|
||||
</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlets-admin.resource-management-portlet.2-2-0"
|
||||
date="2012-09-21">
|
||||
<Change>New Software Upload Wizard integrated</Change>
|
||||
<Change>Added support for resource manger service 2</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlets-admin.resource-management-portlet.2-0-0"
|
||||
date="2012-05-04">
|
||||
<Change>Completely restyled pinned resources panel (former opened
|
||||
resources panel) using CSS3 and HTML5
|
||||
</Change>
|
||||
<Change>Added support for runtime resources editing</Change>
|
||||
<Change>Added support for remove from scope</Change>
|
||||
<Change>Added automatic show of gHN List at startup with possibility
|
||||
to set it on or off by editing a configuration file
|
||||
</Change>
|
||||
<Change>Added automatic highlighting of low memory or disk machines
|
||||
and gHN States
|
||||
</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlets-admin.resource-management-portlet.1-0-0"
|
||||
date="2010-10-15">
|
||||
<Change>First release on gxt and gwt2.0</Change>
|
||||
<Change>for etics 2.0.1 release</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlets-admin.resource-management-portlet.1-1-0"
|
||||
date="2010-10-24">
|
||||
<Change>for etics 2.1.0 release</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlets-admin.resource-management-portlet.1-2-0"
|
||||
date="2010-11-3">
|
||||
<Change>for etics 2.2.0 release</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlets-admin.resource-management-portlet.1-3-0"
|
||||
date="2010-11-24">
|
||||
<Change>for etics 2.2.1 release</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlets-admin.resource-management-portlet.1-4-0"
|
||||
date="2011-01-13">
|
||||
<Change>for etics 2.2.2 release</Change>
|
||||
<Change>Added sweeper for invalid resources (expired GHNs and orphan
|
||||
RIs)
|
||||
</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlets-admin.resource-management-portlet.1-7-0"
|
||||
date="2011-07-01">
|
||||
<Change>Correctly lists GCUBECollection type from new Content Manager
|
||||
</Change>
|
||||
<Change>Correctly lists VIEW type from new Content Manager</Change>
|
||||
<Change>Ported to GWT 2.2 GXT 2.2.3</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlets-admin.resource-management-portlet.1-9-0"
|
||||
date="2011-12-14">
|
||||
<Change>Added support for runtime resources</Change>
|
||||
</Changeset>
|
||||
<Changeset
|
||||
component="org.gcube.portlets-admin.resource-management-portlet.1-10-0"
|
||||
date="2012-02-17">
|
||||
<Change>Added support for runtime resources removal</Change>
|
||||
<Change>Added support for runtime resources scope change</Change>
|
||||
</Changeset>
|
||||
</ReleaseNotes>
|
|
@ -0,0 +1,42 @@
|
|||
<assembly
|
||||
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
|
||||
<id>servicearchive</id>
|
||||
<formats>
|
||||
<format>tar.gz</format>
|
||||
</formats>
|
||||
<baseDirectory>/</baseDirectory>
|
||||
<fileSets>
|
||||
<fileSet>
|
||||
<directory>${distroDirectory}</directory>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
<useDefaultExcludes>true</useDefaultExcludes>
|
||||
<includes>
|
||||
<include>README</include>
|
||||
<include>LICENSE</include>
|
||||
<include>changelog.xml</include>
|
||||
<include>profile.xml</include>
|
||||
</includes>
|
||||
<fileMode>755</fileMode>
|
||||
<filtered>true</filtered>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>target/apidocs</directory>
|
||||
<outputDirectory>/${artifactId}/doc/api</outputDirectory>
|
||||
<useDefaultExcludes>true</useDefaultExcludes>
|
||||
<fileMode>755</fileMode>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
<files>
|
||||
<file>
|
||||
<source>${distroDirectory}/profile.xml</source>
|
||||
<outputDirectory>./</outputDirectory>
|
||||
<filtered>true</filtered>
|
||||
</file>
|
||||
<file>
|
||||
<source>target/${build.finalName}.war</source>
|
||||
<outputDirectory>/${artifactId}</outputDirectory>
|
||||
</file>
|
||||
</files>
|
||||
</assembly>
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<ID></ID>
|
||||
<Type>Service</Type>
|
||||
<Profile>
|
||||
<Description>${description}</Description>
|
||||
<Class>PortletAdmin</Class>
|
||||
<Name>${artifactId}</Name>
|
||||
<Version>${version}</Version>
|
||||
<Packages>
|
||||
<Software>
|
||||
<Name>${artifactId}</Name>
|
||||
<Version>${version}</Version>
|
||||
<MavenCoordinates>
|
||||
<groupId>${groupId}</groupId>
|
||||
<artifactId>${artifactId}</artifactId>
|
||||
<version>${version}</version>
|
||||
</MavenCoordinates>
|
||||
<Files>
|
||||
<File>target/${build.finalName}.war</File>
|
||||
</Files>
|
||||
</Software>
|
||||
</Packages>
|
||||
</Profile>
|
||||
</Resource>
|
|
@ -0,0 +1,319 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>maven-parent</artifactId>
|
||||
<groupId>org.gcube.tools</groupId>
|
||||
<version>1.0.0</version>
|
||||
<relativePath />
|
||||
</parent>
|
||||
|
||||
<groupId>org.gcube.portlets.admin</groupId>
|
||||
<artifactId>resource-management</artifactId>
|
||||
<version>6.3.0-SNAPSHOT</version>
|
||||
<packaging>war</packaging>
|
||||
<name>gCube Resource Management Portlet</name>
|
||||
<description>
|
||||
gCube Resource Management Portlet
|
||||
</description>
|
||||
<scm>
|
||||
<connection>scm:svn:http://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/${project.artifactId}</connection>
|
||||
<developerConnection>scm:https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/${project.artifactId}</developerConnection>
|
||||
<url>http://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/${project.artifactId}</url>
|
||||
</scm>
|
||||
<properties>
|
||||
<!-- Convenience property to set the GWT version -->
|
||||
<gwtVersion>2.7.0</gwtVersion>
|
||||
<liferay.version>6.2.5</liferay.version>
|
||||
<guice.version>3.0</guice.version>
|
||||
<distroDirectory>distro</distroDirectory>
|
||||
<maven.compiler.source>1.7</maven.compiler.source>
|
||||
<maven.compiler.target>1.7</maven.compiler.target>
|
||||
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
|
||||
<!-- To make this work on gwt-run you need to set up global env vars. on
|
||||
MacOSX edit this file /etc/launchd.conf and put "setenv CATALINA_HOME /Users/massi/portal/Portal-Bundle/gCore"
|
||||
on Linux? -->
|
||||
<CATALINA_HOME>${env.CATALINA_HOME}</CATALINA_HOME>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
</properties>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.gcube.distribution</groupId>
|
||||
<artifactId>maven-portal-bom</artifactId>
|
||||
<version>LATEST</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.google.gwt</groupId>
|
||||
<artifactId>gwt-user</artifactId>
|
||||
<version>${gwtVersion}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.gwt</groupId>
|
||||
<artifactId>gwt-servlet</artifactId>
|
||||
<version>${gwtVersion}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>gcube-widgets</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.portal</groupId>
|
||||
<artifactId>custom-portal-handler</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sencha.gxt</groupId>
|
||||
<artifactId>gxt2.2.5-gwt2.X</artifactId>
|
||||
<version>2.7.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.googlecode.gwtquery</groupId>
|
||||
<artifactId>gwtquery</artifactId>
|
||||
<version>1.3.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.applicationsupportlayer</groupId>
|
||||
<artifactId>aslcore</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.dvos</groupId>
|
||||
<artifactId>usermanagement-core</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.admin</groupId>
|
||||
<artifactId>rmp-common-library</artifactId>
|
||||
<version>[2.7.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
<!-- FWS DEPS -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.resources.discovery</groupId>
|
||||
<artifactId>ic-client</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.core</groupId>
|
||||
<artifactId>common-fw-clients</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.core</groupId>
|
||||
<artifactId>common-clients</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.core</groupId>
|
||||
<artifactId>common-scope-maps</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.resourcemanagement</groupId>
|
||||
<artifactId>resourcemanager-client</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.resources</groupId>
|
||||
<artifactId>registry-publisher</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.resourcemanagement</groupId>
|
||||
<artifactId>ghn-manager-client</artifactId>
|
||||
<version>[1.1.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.resourcemanagement</groupId>
|
||||
<artifactId>softwaregateway-client</artifactId>
|
||||
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
<!-- External Modules -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.admin</groupId>
|
||||
<artifactId>ishealth-monitor-widget</artifactId>
|
||||
<version>[1.2.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.admin</groupId>
|
||||
<artifactId>resource-sweeper-widget</artifactId>
|
||||
<version>[2.2.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
<!-- Liferay, Servlets Etc -->
|
||||
<dependency>
|
||||
<groupId>com.liferay.portal</groupId>
|
||||
<artifactId>portal-service</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.liferay.portal</groupId>
|
||||
<artifactId>util-java</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.portlet</groupId>
|
||||
<artifactId>portlet-api</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- Apache commons -->
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-compress</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-fileupload</groupId>
|
||||
<artifactId>commons-fileupload</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!-- Logging -->
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.allen-sauer.gwt.log</groupId>
|
||||
<artifactId>gwt-log</artifactId>
|
||||
<version>3.1.7</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<!-- Generate compiled stuff in the folder used for developing mode -->
|
||||
<outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
|
||||
|
||||
<plugins>
|
||||
|
||||
<!-- GWT Maven Plugin -->
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>gwt-maven-plugin</artifactId>
|
||||
<version>${gwtVersion}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>compile</goal>
|
||||
<!-- <goal>test</goal> -->
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<!-- Plugin configuration. There are many available options, see gwt-maven-plugin
|
||||
documentation at codehaus.org -->
|
||||
<configuration>
|
||||
<extraJvmArgs>-Xmx512M -DGLOBUS_LOCATION=${GLOBUS_LOCATION} -Dlog4j.configuration=clientlog4j.properties</extraJvmArgs>
|
||||
<runTarget>ResourceManagementPortlet.html</runTarget>
|
||||
<hostedWebapp>${webappDirectory}</hostedWebapp>
|
||||
<!-- <logLevel>DEBUG</logLevel> -->
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<!-- Copy static web files before executing gwt:run -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<version>2.1.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>compile</phase>
|
||||
<goals>
|
||||
<goal>exploded</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<webappDirectory>${webappDirectory}</webappDirectory>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- SA Plugin -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>2.2</version>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>${distroDirectory}/descriptor.xml</descriptor>
|
||||
</descriptors>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>servicearchive</id>
|
||||
<phase>install</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>2.5</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-profile</id>
|
||||
<phase>install</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>target</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>${distroDirectory}</directory>
|
||||
<filtering>true</filtering>
|
||||
<includes>
|
||||
<include>profile.xml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,700 @@
|
|||
/****************************************************************************
|
||||
* This software is part of the gCube Project.
|
||||
* Site: http://www.gcube-system.org/
|
||||
****************************************************************************
|
||||
* The gCube/gCore software is licensed as Free Open Source software
|
||||
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
* The software and documentation is provided by its authors/distributors
|
||||
* "as is" and no expressed or
|
||||
* implied warranty is given for its use, quality or fitness for a
|
||||
* particular case.
|
||||
****************************************************************************
|
||||
* Filename: ResourceManagementPortlet.java
|
||||
****************************************************************************
|
||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
||||
***************************************************************************/
|
||||
|
||||
package org.gcube.portlets.admin.resourcemanagement.client;
|
||||
|
||||
|
||||
import org.gcube.portlets.admin.ishealthmonitor.client.dialog.ISMonitor;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.forms.genericresources.DeployVirtualCollection;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.remote.ProxyRegistry;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.utils.Commands;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.utils.Messages;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.utils.OpCommands;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.views.resourcedetails.ResourceDetailsPanel;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.console.ConsoleMessageBroker;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.console.ConsolePanel;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.dialogs.ExtendedMessageBox;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.panels.DetachablePanel;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.panels.MainPanel;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.registry.UIIdentifiers;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.registry.WidgetsRegistry;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.viewport.MainContainer;
|
||||
import org.gcube.portlets.admin.resourcesweeper.client.dialog.SweeperDialog;
|
||||
import org.gcube.resourcemanagement.support.client.Resource_support;
|
||||
import org.gcube.resourcemanagement.support.client.events.SetScopeEvent;
|
||||
import org.gcube.resourcemanagement.support.client.events.SetScopeEventHandler;
|
||||
import org.gcube.resourcemanagement.support.client.utils.CurrentStatus;
|
||||
import org.gcube.resourcemanagement.support.client.utils.LocalStatus;
|
||||
import org.gcube.resourcemanagement.support.client.utils.StatusHandler;
|
||||
import org.gcube.resourcemanagement.support.shared.exceptions.InvalidParameterException;
|
||||
import org.gcube.resourcemanagement.support.shared.operations.SupportedOperations;
|
||||
import org.gcube.resourcemanagement.support.shared.types.RunningMode;
|
||||
import org.gcube.resourcemanagement.support.shared.types.UserGroup;
|
||||
import org.gcube.resourcemanagement.support.shared.util.Configuration;
|
||||
|
||||
import com.extjs.gxt.ui.client.Style.LayoutRegion;
|
||||
import com.extjs.gxt.ui.client.Style.Scroll;
|
||||
import com.extjs.gxt.ui.client.event.ComponentEvent;
|
||||
import com.extjs.gxt.ui.client.event.Listener;
|
||||
import com.extjs.gxt.ui.client.event.MessageBoxEvent;
|
||||
import com.extjs.gxt.ui.client.util.Margins;
|
||||
import com.extjs.gxt.ui.client.widget.ContentPanel;
|
||||
import com.extjs.gxt.ui.client.widget.Dialog;
|
||||
import com.extjs.gxt.ui.client.widget.Label;
|
||||
import com.extjs.gxt.ui.client.widget.MessageBox;
|
||||
import com.extjs.gxt.ui.client.widget.ProgressBar;
|
||||
import com.extjs.gxt.ui.client.widget.Status;
|
||||
import com.extjs.gxt.ui.client.widget.Text;
|
||||
import com.extjs.gxt.ui.client.widget.button.Button;
|
||||
import com.extjs.gxt.ui.client.widget.layout.AccordionLayout;
|
||||
import com.extjs.gxt.ui.client.widget.layout.BorderLayout;
|
||||
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
||||
import com.extjs.gxt.ui.client.widget.menu.CheckMenuItem;
|
||||
import com.extjs.gxt.ui.client.widget.menu.Menu;
|
||||
import com.extjs.gxt.ui.client.widget.menu.MenuBar;
|
||||
import com.extjs.gxt.ui.client.widget.menu.MenuBarItem;
|
||||
import com.extjs.gxt.ui.client.widget.menu.MenuItem;
|
||||
import com.extjs.gxt.ui.client.widget.menu.SeparatorMenuItem;
|
||||
import com.extjs.gxt.ui.client.widget.toolbar.FillToolItem;
|
||||
import com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem;
|
||||
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
|
||||
import com.google.gwt.core.client.EntryPoint;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.core.client.RunAsyncCallback;
|
||||
import com.google.gwt.event.logical.shared.ResizeEvent;
|
||||
import com.google.gwt.event.logical.shared.ResizeHandler;
|
||||
import com.google.gwt.event.shared.HandlerManager;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.RootPanel;
|
||||
|
||||
/**
|
||||
* Entry point classes define <code>onModuleLoad()</code>.
|
||||
*/
|
||||
public class ResourceManagementPortlet implements EntryPoint {
|
||||
|
||||
public static final String CONTAINER_DIV = "MyUniqueDIV";
|
||||
|
||||
private final HandlerManager eventBus = new HandlerManager(null);
|
||||
|
||||
private void printStatus(final CurrentStatus status) {
|
||||
ConsoleMessageBroker.trace(this, "User: " + status.getCurrentUser());
|
||||
ConsoleMessageBroker.trace(this, "Scope: " + status.getCurrentScope());
|
||||
ConsoleMessageBroker.trace(this, "Credentials: " + status.getCredentials());
|
||||
ConsoleMessageBroker.trace(this, "Running Mode: " + status.getRunningMode());
|
||||
}
|
||||
/**
|
||||
* events binder
|
||||
*/
|
||||
private void bind() {
|
||||
//set the eventbus to the support common classes
|
||||
new Resource_support(eventBus);
|
||||
|
||||
eventBus.addHandler(SetScopeEvent.TYPE, new SetScopeEventHandler() {
|
||||
@Override
|
||||
public void onSetScope(SetScopeEvent event) {
|
||||
Commands.setStatusScope(event.getScope());
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* This is the entry point method.
|
||||
*/
|
||||
public final void onModuleLoad() {
|
||||
//for event handling
|
||||
bind();
|
||||
|
||||
MainContainer vp = buildUI();
|
||||
RootPanel.get(CONTAINER_DIV).add(vp);
|
||||
Commands.mask("Waiting servlet initialization", UIIdentifiers.MAIN_CONTAINER_VIEWPORT_ID);
|
||||
|
||||
ProxyRegistry.getProxyInstance().initStatus(new AsyncCallback<CurrentStatus>() {
|
||||
// Received status
|
||||
public void onSuccess(final CurrentStatus result) {
|
||||
StatusHandler.setStatus(result);
|
||||
printStatus(result);
|
||||
|
||||
Commands.mask("Contacting the Infrastructure, please wait", UIIdentifiers.MAIN_CONTAINER_VIEWPORT_ID);
|
||||
|
||||
// loads the scopes
|
||||
ProxyRegistry.getProxyInstance().initScopes(true, new AsyncCallback<Void>() {
|
||||
public void onSuccess(final Void result) {
|
||||
// Now that both scopes and user credentials have been loaded
|
||||
// the menu and statusbar can be built.
|
||||
buildMenu();
|
||||
buildStatusBar();
|
||||
Commands.mask("Loading infrastructure scopes", UIIdentifiers.MAIN_CONTAINER_VIEWPORT_ID);
|
||||
Commands.doGetAvailableScopes(this);
|
||||
|
||||
if (StatusHandler.getStatus().getCurrentScope() != null) {
|
||||
Commands.setStatusScope(StatusHandler.getStatus().getCurrentScope());
|
||||
Commands.doLoadResourceTree(this, StatusHandler.getStatus().getCurrentScope());
|
||||
}
|
||||
}
|
||||
public void onFailure(final Throwable caught) {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
public void onFailure(final Throwable caught) {
|
||||
MessageBox.info("Failure", "cannot initialize servlet", null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private MainContainer buildUI() {
|
||||
MainContainer viewport = new MainContainer();
|
||||
BorderLayout bl = new BorderLayout();
|
||||
viewport.setLayout(bl);
|
||||
WidgetsRegistry.registerWidget(UIIdentifiers.MAIN_CONTAINER_VIEWPORT_ID, viewport);
|
||||
|
||||
MainPanel northPanel = new MainPanel(56, "Main App", LayoutRegion.NORTH) {
|
||||
@Override
|
||||
public void init() {
|
||||
ConsoleMessageBroker.log(this, "Initializing north panel");
|
||||
this.setCollapsible(false);
|
||||
this.setMargins(new Margins(5, 5, 0, 5));
|
||||
|
||||
this.setSplit(false);
|
||||
this.hideHeader();
|
||||
}
|
||||
};
|
||||
|
||||
MainPanel eastPanel = new MainPanel(150, "Pinned Resources", LayoutRegion.EAST) {
|
||||
@Override
|
||||
public void init() {
|
||||
ConsoleMessageBroker.log(this, "Initializing east panel");
|
||||
this.setCollapsible(true);
|
||||
this.setMargins(new Margins(5, 5, 5, 0));
|
||||
this.getContainer().setScrollMode(Scroll.AUTOY);
|
||||
this.getContainer().setHeight(100);
|
||||
((ContentPanel) this.getContainer()).getBody().setStyleName("taskbar-pattern");
|
||||
}
|
||||
};
|
||||
|
||||
MainPanel westPanel = new MainPanel(200, "Resources", LayoutRegion.WEST) {
|
||||
@Override
|
||||
public void init() {
|
||||
ConsoleMessageBroker.log(this, "Initializing west panel");
|
||||
this.setCollapsible(false);
|
||||
this.setMargins(new Margins(5, 0, 5, 5));
|
||||
Text widget = new Text();
|
||||
widget.setId("res-details-widget-fake");
|
||||
widget.setStyleName("left-panel-tree-background");
|
||||
this.getContainer().setLayout(new AccordionLayout());
|
||||
ContentPanel cp = new ContentPanel();
|
||||
cp.setAnimCollapse(false);
|
||||
cp.setHeading("Resources");
|
||||
cp.setLayout(new FitLayout());
|
||||
cp.add(widget);
|
||||
this.getContainer().add(cp);
|
||||
}
|
||||
};
|
||||
|
||||
MainPanel southPanel = new MainPanel(180, "Console (debug mode)", LayoutRegion.SOUTH) {
|
||||
@Override
|
||||
public void init() {
|
||||
ConsoleMessageBroker.log(this, "Initializing south panel");
|
||||
this.setCollapsible(false);
|
||||
this.setSplit(true);
|
||||
this.setMargins(new Margins(0, 0, 0, 0));
|
||||
|
||||
// Inserts the console
|
||||
this.getContainer().setLayout(new FitLayout());
|
||||
//this.getContainer().setScrollMode(Scroll.AUTOY);
|
||||
try {
|
||||
// Creates a detachable panel in which a console will be inserted
|
||||
DetachablePanel consolePanel = new DetachablePanel(
|
||||
this.getContainer(),
|
||||
"Console (debug mode)",
|
||||
UIIdentifiers.CONSOLE_COMPONENT_ID ,
|
||||
false);
|
||||
ConsolePanel console = new ConsolePanel(consolePanel);
|
||||
WidgetsRegistry.registerElem(UIIdentifiers.CONSOLE_WIDGET_ID, console);
|
||||
// initially the console will be hidden
|
||||
Commands.showHideConsole();
|
||||
} catch (InvalidParameterException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
MainPanel centerPanel = new MainPanel(LayoutRegion.CENTER) {
|
||||
@Override
|
||||
public void init() {
|
||||
this.getContainer().setLayout(new FitLayout());
|
||||
this.hideHeader();
|
||||
ConsoleMessageBroker.log(this, "Initialiting center panel");
|
||||
this.setMargins(new Margins(5));
|
||||
ResourceDetailsPanel resourceDetailGrid = new ResourceDetailsPanel();
|
||||
this.add(resourceDetailGrid.getWidget(), false);
|
||||
WidgetsRegistry.registerElem(UIIdentifiers.RESOURCE_DETAIL_GRID_CONTAINER_ID, resourceDetailGrid);
|
||||
}
|
||||
};
|
||||
|
||||
viewport.addPanel(UIIdentifiers.GLOBAL_MENU_CONTAINER_PANEL, northPanel);
|
||||
viewport.addPanel(UIIdentifiers.RESOURCE_NAVIGATION_PANEL, westPanel);
|
||||
viewport.addPanel(UIIdentifiers.RESOURCE_DETAIL_GRID_PANEL, centerPanel);
|
||||
viewport.addPanel(UIIdentifiers.TASKBAR_PANEL, eastPanel);
|
||||
viewport.addPanel(UIIdentifiers.CONSOLE_PANEL_ID, southPanel);
|
||||
|
||||
Window.addResizeHandler(new ResizeHandler() {
|
||||
public void onResize(final ResizeEvent event) {
|
||||
updateSize();
|
||||
}
|
||||
});
|
||||
|
||||
// updates for the first time
|
||||
updateSize();
|
||||
|
||||
//viewport.setAutoHeight(false);
|
||||
//viewport.setAutoWidth(false);
|
||||
return viewport;
|
||||
}
|
||||
|
||||
private void updateSize() {
|
||||
RootPanel workspace = RootPanel.get(CONTAINER_DIV);
|
||||
|
||||
if (workspace == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
int topBorder = workspace.getAbsoluteTop();
|
||||
int leftBorder = workspace.getAbsoluteLeft();
|
||||
int rightScrollBar = 17;
|
||||
int rootHeight = Window.getClientHeight() - topBorder - 4;
|
||||
int rootWidth = (Window.getClientWidth() - 2 * leftBorder - rightScrollBar);
|
||||
|
||||
ConsoleMessageBroker.debug(this, "New workspace dimension Height: " + rootHeight + " Width: " + rootWidth);
|
||||
|
||||
MainContainer viewport = (MainContainer) WidgetsRegistry.getWidget(UIIdentifiers.MAIN_CONTAINER_VIEWPORT_ID);
|
||||
|
||||
viewport.setHeight(rootHeight);
|
||||
viewport.setWidth(rootWidth);
|
||||
}
|
||||
|
||||
/**
|
||||
* Internally used to build up the main panel menu.
|
||||
* @return the menu
|
||||
*/
|
||||
private void buildMenu() {
|
||||
|
||||
/***********************************************************
|
||||
* MENU - OPTIONS
|
||||
**********************************************************/
|
||||
Menu optionsMenu = new Menu();
|
||||
|
||||
CheckMenuItem highlightInvalid = new CheckMenuItem("Highlight invalid fields") {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent be) {
|
||||
super.onClick(be);
|
||||
Commands.getResourceDetailPanel().toggleHighlightInvalidFields();
|
||||
}
|
||||
};
|
||||
highlightInvalid.setChecked(false);
|
||||
optionsMenu.add(highlightInvalid);
|
||||
|
||||
CheckMenuItem showConsole = new CheckMenuItem("Show Console") {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent be) {
|
||||
super.onClick(be);
|
||||
Commands.showHideConsole();
|
||||
}
|
||||
};
|
||||
showConsole.setChecked(false);
|
||||
// Checks that this menu item is permitted to the current user
|
||||
Commands.evaluateCredentials(
|
||||
showConsole,
|
||||
UserGroup.ADMIN, UserGroup.DEBUG);
|
||||
optionsMenu.add(showConsole);
|
||||
|
||||
CheckMenuItem superUser = new CheckMenuItem("Super User Mode") {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent be) {
|
||||
super.onClick(be);
|
||||
|
||||
if (this.isChecked()) {
|
||||
ConsoleMessageBroker.info(this, "Going in super user mode");
|
||||
|
||||
|
||||
|
||||
ExtendedMessageBox.password("Super User Authentication", new Listener<MessageBoxEvent>() {
|
||||
public void handleEvent(final MessageBoxEvent be) {
|
||||
String pwd = be.getValue();
|
||||
Commands.mask("Veryfing super user mode password, please wait ...", UIIdentifiers.MAIN_CONTAINER_VIEWPORT_ID);
|
||||
ProxyRegistry.getProxyInstance().enableSuperUserMode(pwd, new AsyncCallback<Boolean>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
MessageBox.alert("Server error", "Cannot reach server", null);
|
||||
}
|
||||
@Override
|
||||
public void onSuccess(Boolean result) {
|
||||
if (result) {
|
||||
Commands.doSetSuperUser(true);
|
||||
} else {
|
||||
MessageBox.alert("Wrong code", "Invalid Password entered.", null);
|
||||
setChecked(false);
|
||||
Commands.unmask(UIIdentifiers.MAIN_CONTAINER_VIEWPORT_ID);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
//reloadMenu();
|
||||
} else {
|
||||
ConsoleMessageBroker.info(this, "Going in debug mode");
|
||||
Commands.doSetSuperUser(false);
|
||||
//reloadMenu();
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
// Checks that this menu item is permitted to the current user
|
||||
Commands.evaluateCredentials(
|
||||
superUser,
|
||||
UserGroup.DEBUG);
|
||||
superUser.setChecked(StatusHandler.getStatus().getCredentials() == UserGroup.ADMIN);
|
||||
optionsMenu.add(superUser);
|
||||
|
||||
|
||||
CheckMenuItem useCache = new CheckMenuItem("Use Remote Cache") {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent be) {
|
||||
super.onClick(be);
|
||||
StatusHandler.getStatus().setUseCache(this.isChecked());
|
||||
ProxyRegistry.getProxyInstance().setUseCache(this.isChecked(),
|
||||
new AsyncCallback<Void>() {
|
||||
public void onSuccess(final Void result) {
|
||||
}
|
||||
public void onFailure(final Throwable caught) {
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
useCache.setChecked(StatusHandler.getStatus().useCache());
|
||||
optionsMenu.add(useCache);
|
||||
|
||||
CheckMenuItem openProfileOnLoad = new CheckMenuItem("Open Profile onLoad") {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent be) {
|
||||
super.onClick(be);
|
||||
Configuration.openProfileOnLoad = !Configuration.openProfileOnLoad;
|
||||
}
|
||||
};
|
||||
openProfileOnLoad.setChecked(false);
|
||||
optionsMenu.add(openProfileOnLoad);
|
||||
|
||||
|
||||
CheckMenuItem allowMultipleProfiles = new CheckMenuItem("Allow Multiple Profiles") {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent be) {
|
||||
super.onClick(be);
|
||||
Configuration.allowMultipleProfiles = !Configuration.allowMultipleProfiles;
|
||||
}
|
||||
};
|
||||
allowMultipleProfiles.setChecked(false);
|
||||
optionsMenu.add(allowMultipleProfiles);
|
||||
|
||||
|
||||
/***********************************************************
|
||||
* MENU - SEARCH
|
||||
**********************************************************/
|
||||
Menu searchMenu = new Menu();
|
||||
MenuItem getResource = new MenuItem("Get Resource By ID") {
|
||||
protected void onClick(final ComponentEvent be) {
|
||||
OpCommands.doGetResourceByID();
|
||||
};
|
||||
};
|
||||
getResource.setIconStyle("resources-icon");
|
||||
Commands.evaluateCredentials(
|
||||
getResource,
|
||||
SupportedOperations.SERVICE_GET_RESOURCE_BY_ID.getPermissions());
|
||||
searchMenu.add(getResource);
|
||||
|
||||
MenuItem getReport = new MenuItem("Get Report") {
|
||||
protected void onClick(final ComponentEvent be) {
|
||||
OpCommands.doGetDeployReport();
|
||||
};
|
||||
};
|
||||
getReport.setIconStyle("getreport-icon");
|
||||
Commands.evaluateCredentials(
|
||||
getReport,
|
||||
SupportedOperations.SERVICE_GET_REPORT.getPermissions());
|
||||
searchMenu.add(getReport);
|
||||
|
||||
/***********************************************************
|
||||
* MENU - TOOLS
|
||||
**********************************************************/
|
||||
Menu toolsMenu = new Menu();
|
||||
|
||||
MenuItem testIS = new MenuItem("Check IS Health") {
|
||||
protected void onClick(final ComponentEvent be) {
|
||||
super.onClick(be);
|
||||
if (LocalStatus.getInstance().getAvailableScopes() == null || LocalStatus.getInstance().getAvailableScopes().isEmpty()) {
|
||||
MessageBox.info("Sorry", "This functionality is not available in logged-in mode.", null);
|
||||
} else {
|
||||
GWT.runAsync(ISMonitor.class, new RunAsyncCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
ISMonitor.pingIS();
|
||||
}
|
||||
public void onFailure(Throwable reason) {
|
||||
Window.alert("There are networks problem, please check your connection.");
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
testIS.setIconStyle("is-icon");
|
||||
Commands.evaluateCredentials(
|
||||
testIS,
|
||||
SupportedOperations.SERVICE_GET_RESOURCE_BY_ID.getPermissions());
|
||||
toolsMenu.add(testIS);
|
||||
|
||||
|
||||
MenuItem cleanGHN = new MenuItem("Resource Sweeper") {
|
||||
protected void onClick(final ComponentEvent be) {
|
||||
super.onClick(be);
|
||||
if (SupportedOperations.SWEEP_GHN.isAllowed(StatusHandler.getStatus().getCredentials())) {
|
||||
GWT.runAsync(SweeperDialog.class, new RunAsyncCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
String currentScope = StatusHandler.getStatus().getCurrentScope();
|
||||
new SweeperDialog(currentScope);
|
||||
}
|
||||
|
||||
public void onFailure(Throwable reason) {
|
||||
Window.alert("There are networks problem, please check your connection.");
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
MessageBox.alert("Resource Sweeper", "You are not allowed to execute this operation", null);
|
||||
|
||||
};
|
||||
};
|
||||
cleanGHN.setIconStyle("sweeper-icon");
|
||||
toolsMenu.add(cleanGHN);
|
||||
|
||||
MenuItem createSub = new MenuItem("Create");
|
||||
createSub.setIconStyle("new-icon");
|
||||
Menu createMnu = new Menu();
|
||||
|
||||
// Create Generic Resource
|
||||
MenuItem createGR = new MenuItem("Generic Resource") {
|
||||
protected void onClick(final ComponentEvent be) {
|
||||
super.onClick(be);
|
||||
OpCommands.doOpenGenericResourceForm();
|
||||
};
|
||||
};
|
||||
|
||||
createGR.setIconStyle("genericresource-icon");
|
||||
createMnu.add(createGR);
|
||||
|
||||
// Create Service Endpoint (former Runtime Resource)
|
||||
MenuItem createSE = new MenuItem("Service Endpoint") {
|
||||
protected void onClick(final ComponentEvent be) {
|
||||
super.onClick(be);
|
||||
OpCommands.doOpenServiceEndpointForm();
|
||||
};
|
||||
};
|
||||
createSE.setIconStyle("runtimeresource-icon");
|
||||
createMnu.add(createSE);
|
||||
|
||||
// Create Generic Resource
|
||||
MenuItem deployVirtualCollection = new MenuItem("Instantiate Virtual Collections") {
|
||||
protected void onClick(final ComponentEvent be) {
|
||||
super.onClick(be);
|
||||
if (SupportedOperations.GENERIC_RESOURCE_CREATE.isAllowed(StatusHandler.getStatus().getCredentials())) {
|
||||
new DeployVirtualCollection().show();
|
||||
} else {
|
||||
MessageBox.alert("Instantiate Virtual Collections", "You are not allowed to execute this operation", null);
|
||||
}
|
||||
};
|
||||
};
|
||||
deployVirtualCollection.setIconStyle("install-icon");
|
||||
createMnu.add(deployVirtualCollection);
|
||||
|
||||
createSub.setSubMenu(createMnu);
|
||||
Commands.evaluateCredentials(
|
||||
createSub,
|
||||
SupportedOperations.CREATE_MENU_SHOW.getPermissions());
|
||||
toolsMenu.add(createSub);
|
||||
|
||||
|
||||
toolsMenu.add(new SeparatorMenuItem());
|
||||
|
||||
/***********************************************************
|
||||
* SUBMENU - OPTIONS->REFRESH
|
||||
**********************************************************/
|
||||
MenuItem sub = new MenuItem("Refresh");
|
||||
sub.setIconStyle("refresh-icon");
|
||||
Menu refresh = new Menu();
|
||||
refresh.add(new MenuItem("Resource Navigation") {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent be) {
|
||||
super.onClick(be);
|
||||
Commands.refreshResourceTree();
|
||||
}
|
||||
});
|
||||
refresh.add(new MenuItem("Resource Details Grid") {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent be) {
|
||||
super.onClick(be);
|
||||
Commands.refreshResourceGrid();
|
||||
}
|
||||
});
|
||||
refresh.add(new MenuItem("Console (UI)") {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent be) {
|
||||
super.onClick(be);
|
||||
Commands.refreshConsole();
|
||||
}
|
||||
});
|
||||
refresh.add(new MenuItem("Resource Details (UI)") {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent be) {
|
||||
super.onClick(be);
|
||||
Commands.refreshResourceDetails();
|
||||
}
|
||||
});
|
||||
refresh.add(new MenuItem("Desktop (UI)") {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent be) {
|
||||
super.onClick(be);
|
||||
Commands.refreshViewport();
|
||||
}
|
||||
});
|
||||
sub.setSubMenu(refresh);
|
||||
toolsMenu.add(sub);
|
||||
|
||||
MenuItem emptyCache = new MenuItem("Empty Cache") {
|
||||
protected void onClick(final ComponentEvent be) {
|
||||
super.onClick(be);
|
||||
ProxyRegistry.getProxyInstance().emptyCache(new AsyncCallback<Void>() {
|
||||
public void onSuccess(final Void result) {
|
||||
Commands.showPopup("Empty cache", "The remote cache has been cleaned");
|
||||
}
|
||||
public void onFailure(final Throwable caught) {
|
||||
Commands.showPopup("Empty cache error", "The remote cache has not been cleaned");
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
emptyCache.setIconStyle("clear-icon");
|
||||
toolsMenu.add(emptyCache);
|
||||
|
||||
|
||||
/***********************************************************
|
||||
* MENU - ABOUT
|
||||
**********************************************************/
|
||||
Menu helpMenu = new Menu();
|
||||
MenuItem aboutMnuItem = new MenuItem("About") {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent be) {
|
||||
super.onClick(be);
|
||||
Dialog dlg = new Dialog();
|
||||
dlg.setHeading("About - Resource Management");
|
||||
dlg.addText("<br/>This software is part of the gCube Project.<br/>" +
|
||||
"Site: <a href=\"http://www.gcube-system.org/\">http://www.gcube-system.org/</a>" +
|
||||
"<p>The gCube/gCore software is licensed as Free Open Source software " +
|
||||
"conveying to the EUPL (<a href=\"http://ec.europa.eu/idabc/eupl\">http://ec.europa.eu/idabc/eupl</a>).</p><br/>" +
|
||||
"<p>The software and documentation is provided by its authors/distributors " +
|
||||
"\"as is\" and no expressed or " +
|
||||
"implied warranty is given for its use, quality or fitness for a " +
|
||||
"particular case.</p>" +
|
||||
"" +
|
||||
"<p><b>Issues</b> can be submitted <a href=\"https://support.d4science.research-infrastructures.eu/\">here</a>.</p>" +
|
||||
"<p><b>Notice:</b> specify this Component: <br/><i>Repository Path: /org/gcube/portlets/admin/resource-management</i></p>" +
|
||||
"<br/>This software was built over the <a href=\"http://gcube.wiki.gcube-system.org/gcube/index.php/Featherweight_Stack\">gCube Featherweight Stack (FWS) </a> and <a href=\"http://www.gwtproject.org\">Google Webtool Kit (GWT)</a> technologies.<br/>" +
|
||||
"<br/>");
|
||||
|
||||
dlg.setClosable(true);
|
||||
dlg.setModal(true);
|
||||
dlg.setHideOnButtonClick(true);
|
||||
dlg.show();
|
||||
}
|
||||
};
|
||||
aboutMnuItem.setIconStyle("about-icon");
|
||||
helpMenu.add(aboutMnuItem);
|
||||
|
||||
MenuBar mb = new MenuBar();
|
||||
mb.add(new MenuBarItem("Tools", toolsMenu));
|
||||
mb.add(new MenuBarItem("Options", optionsMenu));
|
||||
mb.add(new MenuBarItem("Search", searchMenu));
|
||||
mb.add(new MenuBarItem("Help", helpMenu));
|
||||
|
||||
|
||||
MainPanel menuPanel = WidgetsRegistry.getPanel(UIIdentifiers.GLOBAL_MENU_CONTAINER_PANEL);
|
||||
WidgetsRegistry.registerWidget(UIIdentifiers.GLOBAL_MENUBAR_ID, mb);
|
||||
menuPanel.add(mb, true);
|
||||
}
|
||||
|
||||
private void buildStatusBar() {
|
||||
MainPanel menuPanel = WidgetsRegistry.getPanel(UIIdentifiers.GLOBAL_MENU_CONTAINER_PANEL);
|
||||
ToolBar statusbar = new ToolBar();
|
||||
statusbar.add(new SeparatorToolItem());
|
||||
|
||||
if (StatusHandler.getStatus().getRunningMode() != RunningMode.PORTAL) {
|
||||
Button btnScope = new Button("Available Scopes");
|
||||
btnScope.setMenu(new Menu());
|
||||
WidgetsRegistry.registerWidget(UIIdentifiers.BUTTON_AVAILABLE_SCOPES_ID, btnScope);
|
||||
// Checks that this menu item is permitted to the current user
|
||||
statusbar.add(btnScope);
|
||||
} else {
|
||||
statusbar.add(new Label("Current role: " + StatusHandler.getStatus().getCredentials()));
|
||||
}
|
||||
|
||||
//statusbar.add(new FillToolItem());
|
||||
statusbar.add(new Label(" "));
|
||||
ProgressBar progressStatus = new ProgressBar();
|
||||
progressStatus.setWidth(200);
|
||||
progressStatus.updateText("Updating Infrastructure...");
|
||||
statusbar.add(progressStatus);
|
||||
progressStatus.hide();
|
||||
WidgetsRegistry.registerWidget(UIIdentifiers.STATUS_PROGRESS_BAR_ID, progressStatus);
|
||||
|
||||
statusbar.add(new FillToolItem());
|
||||
statusbar.add(new Label("Current Scope: "));
|
||||
Status scopeInfo = new Status();
|
||||
scopeInfo.setWidth(350);
|
||||
scopeInfo.setText(Messages.NO_SCOPE_SELECTED);
|
||||
scopeInfo.setBox(true);
|
||||
statusbar.add(scopeInfo);
|
||||
WidgetsRegistry.registerWidget(UIIdentifiers.STATUS_SCOPE_INFO_ID, scopeInfo);
|
||||
|
||||
statusbar.add(new Label(" Loaded Resources: "));
|
||||
Status loadedResources = new Status();
|
||||
loadedResources.setWidth(35);
|
||||
loadedResources.setText("0");
|
||||
loadedResources.setBox(true);
|
||||
statusbar.add(loadedResources);
|
||||
WidgetsRegistry.registerWidget(UIIdentifiers.STATUS_LOADED_RESOURCES_ID, loadedResources);
|
||||
|
||||
menuPanel.add(statusbar, false);
|
||||
|
||||
menuPanel.getContainer().setBorders(false);
|
||||
menuPanel.getContainer().setShadow(true);
|
||||
WidgetsRegistry.registerWidget(UIIdentifiers.GLOBAL_STATUS_BAR_ID, statusbar);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,346 @@
|
|||
/****************************************************************************
|
||||
* This software is part of the gCube Project.
|
||||
* Site: http://www.gcube-system.org/
|
||||
****************************************************************************
|
||||
* The gCube/gCore software is licensed as Free Open Source software
|
||||
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
* The software and documentation is provided by its authors/distributors
|
||||
* "as is" and no expressed or
|
||||
* implied warranty is given for its use, quality or fitness for a
|
||||
* particular case.
|
||||
****************************************************************************
|
||||
* Filename: DeployServicesForm.java
|
||||
****************************************************************************
|
||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
||||
***************************************************************************/
|
||||
|
||||
package org.gcube.portlets.admin.resourcemanagement.client.forms;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.remote.ProxyRegistry;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.utils.Callbacks;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.utils.Commands;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.views.resourcedetails.ResourceGridFactory;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.console.ConsoleMessageBroker;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.registry.UIIdentifiers;
|
||||
import org.gcube.resourcemanagement.support.client.utils.StatusHandler;
|
||||
import org.gcube.resourcemanagement.support.client.views.ResourceTypeDecorator;
|
||||
import org.gcube.resourcemanagement.support.shared.operations.SupportedOperations;
|
||||
import org.gcube.resourcemanagement.support.shared.types.datamodel.ResourceDescriptor;
|
||||
import org.gcube.resourcemanagement.support.shared.types.datamodel.ResourceDetailModel;
|
||||
|
||||
import com.extjs.gxt.ui.client.Style.Orientation;
|
||||
import com.extjs.gxt.ui.client.data.ModelData;
|
||||
import com.extjs.gxt.ui.client.event.ComponentEvent;
|
||||
import com.extjs.gxt.ui.client.event.Listener;
|
||||
import com.extjs.gxt.ui.client.event.MessageBoxEvent;
|
||||
import com.extjs.gxt.ui.client.store.ListStore;
|
||||
import com.extjs.gxt.ui.client.store.StoreSorter;
|
||||
import com.extjs.gxt.ui.client.util.Margins;
|
||||
import com.extjs.gxt.ui.client.widget.Component;
|
||||
import com.extjs.gxt.ui.client.widget.ContentPanel;
|
||||
import com.extjs.gxt.ui.client.widget.MessageBox;
|
||||
import com.extjs.gxt.ui.client.widget.Text;
|
||||
import com.extjs.gxt.ui.client.widget.Window;
|
||||
import com.extjs.gxt.ui.client.widget.button.Button;
|
||||
import com.extjs.gxt.ui.client.widget.form.DualListField;
|
||||
import com.extjs.gxt.ui.client.widget.form.FormPanel;
|
||||
import com.extjs.gxt.ui.client.widget.form.ListField;
|
||||
import com.extjs.gxt.ui.client.widget.grid.Grid;
|
||||
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
||||
import com.extjs.gxt.ui.client.widget.layout.FormData;
|
||||
import com.extjs.gxt.ui.client.widget.layout.RowData;
|
||||
import com.extjs.gxt.ui.client.widget.layout.RowLayout;
|
||||
import com.extjs.gxt.ui.client.widget.menu.Menu;
|
||||
import com.extjs.gxt.ui.client.widget.menu.MenuItem;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
|
||||
|
||||
/**
|
||||
* @author Daniele Strollo
|
||||
* @author Massimiliano Assante (ISTI-CNR)
|
||||
* @version 2.1 APR 2012
|
||||
*/
|
||||
public class DeployServicesForm {
|
||||
private ContentPanel rootPanel = null;
|
||||
private ContentPanel ghnContainer = null;
|
||||
private ContentPanel serviceContainer = null;
|
||||
private final ListStore<ModelData> GHNstore = new ListStore<ModelData>();
|
||||
private final ListStore<ModelData> selectedGHNs = new ListStore<ModelData>();
|
||||
private final Window window = new Window();
|
||||
private int resourceLoaded = 0;
|
||||
|
||||
|
||||
public DeployServicesForm() {
|
||||
this.ghnContainer = new ContentPanel(new FitLayout());
|
||||
this.serviceContainer = new ContentPanel(new FitLayout());
|
||||
|
||||
this.ghnContainer.getHeader().setStyleName("x-hide-panel-header");
|
||||
this.ghnContainer.setHeaderVisible(false);
|
||||
this.serviceContainer.getHeader().setStyleName("x-hide-panel-header");
|
||||
this.serviceContainer.setHeaderVisible(false);
|
||||
|
||||
this.ghnContainer.add(new Text());
|
||||
this.serviceContainer.add(new Text());
|
||||
this.init();
|
||||
}
|
||||
|
||||
private void markResourceLoaded() {
|
||||
this.resourceLoaded++;
|
||||
if (this.resourceLoaded >= 2) {
|
||||
Commands.unmask(Commands.getViewport());
|
||||
Commands.unmask(this.rootPanel);
|
||||
}
|
||||
}
|
||||
|
||||
private void loadGHNs(final String scope) {
|
||||
ProxyRegistry.getProxyInstance().getResourcesModel(scope,
|
||||
ResourceTypeDecorator.GHN.name(),
|
||||
null,
|
||||
null,
|
||||
new AsyncCallback<List<ResourceDescriptor>>() {
|
||||
|
||||
public void onSuccess(final List<ResourceDescriptor> result) {
|
||||
ghnContainer.removeAll();
|
||||
ghnContainer.add(createGHNForm());
|
||||
GHNstore.add(result);
|
||||
ghnContainer.layout(true);
|
||||
Commands.showPopup("GHN load", "Loaded " + result.size() + " GHNs");
|
||||
markResourceLoaded();
|
||||
}
|
||||
public void onFailure(final Throwable caught) {
|
||||
markResourceLoaded();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void closeDialog() {
|
||||
this.window.hide();
|
||||
}
|
||||
|
||||
private Component createGHNForm() {
|
||||
FormPanel panel = new FormPanel();
|
||||
panel.setFrame(true);
|
||||
panel.getHeader().setStyleName("x-hide-panel-header");
|
||||
|
||||
DualListField<ModelData> lists = new DualListField<ModelData>();
|
||||
lists.setFieldLabel("GHNs");
|
||||
|
||||
ListField<ModelData> from = lists.getFromList();
|
||||
from.setDisplayField("name");
|
||||
GHNstore.setStoreSorter(new StoreSorter<ModelData>());
|
||||
GHNstore.setSortField("name");
|
||||
from.setStore(GHNstore);
|
||||
ListField<ModelData> to = lists.getToList();
|
||||
to.setDisplayField("name");
|
||||
to.setStore(this.selectedGHNs);
|
||||
|
||||
panel.addButton(new Button("Cancel") {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent ce) {
|
||||
super.onClick(ce);
|
||||
closeDialog();
|
||||
}
|
||||
});
|
||||
panel.addButton(new Button("Apply Deploy") {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent ce) {
|
||||
super.onClick(ce);
|
||||
MessageBox.confirm("Software Deployment",
|
||||
"Are you sure you want to apply the deployment plan?",
|
||||
new Listener<MessageBoxEvent>() {
|
||||
public void handleEvent(final MessageBoxEvent be) {
|
||||
if (be.getButtonClicked().getItemId().equalsIgnoreCase("yes")) {
|
||||
// - THE OPERATION IS CONFIRMED
|
||||
List<ModelData> ghns = getSelectedGHNs();
|
||||
List<ModelData> sw = getSelectedSoftwares();
|
||||
|
||||
if (ghns == null || ghns.size() == 0) {
|
||||
MessageBox.alert("Service Deployment", "No GHNs have been selected", null);
|
||||
return;
|
||||
}
|
||||
if (sw == null || sw.size() == 0) {
|
||||
MessageBox.alert("Service Deployment", "No softwares have been selected", null);
|
||||
return;
|
||||
}
|
||||
|
||||
List<String> ghnNames = new Vector<String>();
|
||||
for (ModelData m : ghns) {
|
||||
String name = m.get("name").toString();
|
||||
ghnNames.add(name);
|
||||
}
|
||||
List<String> swIDs = new Vector<String>();
|
||||
for (ModelData m : sw) {
|
||||
swIDs.add(((Object) m.get("ID")).toString());
|
||||
}
|
||||
ConsoleMessageBroker.info(this, "Applying deployment of " + swIDs.size() + " softwares on " + ghnNames.size() + " gHNs");
|
||||
Commands.mask("Waiting the deployment report", UIIdentifiers.GLOBAL_STATUS_BAR_ID);
|
||||
ProxyRegistry.getProxyInstance().deploy(
|
||||
ghnNames,
|
||||
swIDs,
|
||||
new AsyncCallback<String>() {
|
||||
public void onSuccess(final String result) {
|
||||
if (result != null) {
|
||||
MessageBox.info("Service Deployment",
|
||||
"The required deployment has been applied.<br/>" +
|
||||
"The generated report ID is:<br/>" +
|
||||
"<b>" + result + "</b>",
|
||||
null);
|
||||
ProxyRegistry.getProxyInstance().checkDeployStatus(
|
||||
StatusHandler.getStatus().getCurrentScope(),
|
||||
result.trim(),
|
||||
Callbacks.handleGetDeploymentReport);
|
||||
} else {
|
||||
MessageBox.alert("Service Deployment",
|
||||
"The required deployment has been applied.<br/>" +
|
||||
"But the resulting report ID is null or invalid.",
|
||||
null);
|
||||
Commands.unmask(UIIdentifiers.GLOBAL_STATUS_BAR_ID);
|
||||
}
|
||||
}
|
||||
public void onFailure(final Throwable caught) {
|
||||
Commands.unmask(UIIdentifiers.GLOBAL_STATUS_BAR_ID);
|
||||
MessageBox.alert("Service Deployment error",
|
||||
"The required deployment has not been applied. " +
|
||||
"Received exception:<br/>" + caught.getMessage(),
|
||||
null);
|
||||
}
|
||||
});
|
||||
|
||||
closeDialog();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
panel.add(lists, new FormData("100%"));
|
||||
return panel;
|
||||
}
|
||||
|
||||
private List<ModelData> getSelectedGHNs() {
|
||||
return this.selectedGHNs.getModels();
|
||||
}
|
||||
|
||||
private List<ModelData> getSelectedSoftwares() {
|
||||
List<ModelData> retval = new Vector<ModelData>();
|
||||
if (serviceContainer.getWidget(0) == null ||
|
||||
!(serviceContainer.getWidget(0) instanceof Grid)) {
|
||||
return null;
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
Grid<ModelData> grid = (Grid<ModelData>) serviceContainer.getWidget(0);
|
||||
if (grid.getSelectionModel().getSelectedItems() == null) {
|
||||
return null;
|
||||
}
|
||||
Object toDeploy = null;
|
||||
for (ModelData m : grid.getStore().getModels()) {
|
||||
toDeploy = m.get(ResourceDetailModel.SERVICE_INSTALL_KEY);
|
||||
if (toDeploy != null && Boolean.parseBoolean(toDeploy.toString())) {
|
||||
retval.add(m);
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
private void loadSoftwares(final String scope) {
|
||||
|
||||
ProxyRegistry.getProxyInstance().getResourcesByType(
|
||||
scope,
|
||||
ResourceTypeDecorator.Service.name(),
|
||||
new AsyncCallback<List<String>>() {
|
||||
|
||||
public void onSuccess(final List<String> result) {
|
||||
Grid<ModelData> grid =
|
||||
ResourceGridFactory.createGrid(ResourceTypeDecorator.InstallableSoftware.name(),
|
||||
result,
|
||||
null,
|
||||
false);
|
||||
|
||||
/******************************************
|
||||
* ADD TO INSTALL FEATURE
|
||||
*****************************************/
|
||||
// 0 - INSTALL button
|
||||
MenuItem toInstall = new MenuItem("Mark for install") {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent be) {
|
||||
super.onClick(be);
|
||||
|
||||
if (serviceContainer.getWidget(0) == null ||
|
||||
!(serviceContainer.getWidget(0) instanceof Grid)) {
|
||||
return;
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
Grid<ModelData> grid = (Grid<ModelData>) serviceContainer.getWidget(0);
|
||||
if (grid.getSelectionModel().getSelectedItems() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (ModelData e : grid.getSelectionModel().getSelectedItems()) {
|
||||
ConsoleMessageBroker.info(this, "Required install for: " + e.get("ServiceName") + " " + e.get("ID"));
|
||||
if (e.getProperties().containsKey(ResourceDetailModel.SERVICE_INSTALL_KEY) &&
|
||||
Boolean.parseBoolean(((Object) e.get(ResourceDetailModel.SERVICE_INSTALL_KEY)).toString()))
|
||||
{
|
||||
e.set(ResourceDetailModel.SERVICE_INSTALL_KEY, false);
|
||||
} else {
|
||||
e.set(ResourceDetailModel.SERVICE_INSTALL_KEY, true);
|
||||
}
|
||||
grid.getStore().update(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
Commands.evaluateCredentials(
|
||||
toInstall,
|
||||
SupportedOperations.SERVICE_DEPLOY.getPermissions());
|
||||
|
||||
Menu menu = new Menu();
|
||||
menu.add(toInstall);
|
||||
grid.setContextMenu(menu);
|
||||
/******************************************
|
||||
* ENDOF ADD TO INSTALL FEATURE
|
||||
*****************************************/
|
||||
|
||||
serviceContainer.removeAll();
|
||||
serviceContainer.add(grid);
|
||||
serviceContainer.layout(true);
|
||||
Commands.showPopup("Service load", "Loaded " + result.size() + " services");
|
||||
markResourceLoaded();
|
||||
}
|
||||
|
||||
public void onFailure(final Throwable caught) {
|
||||
markResourceLoaded();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void init() {
|
||||
this.rootPanel = new ContentPanel();
|
||||
this.rootPanel.getHeader().setStyleName("x-hide-panel-header");
|
||||
this.rootPanel.setHeaderVisible(false);
|
||||
this.rootPanel.setLayout(new RowLayout(Orientation.VERTICAL));
|
||||
|
||||
this.rootPanel.add(this.ghnContainer, new RowData(1, .4, new Margins(4)));
|
||||
this.rootPanel.add(this.serviceContainer, new RowData(1, .6, new Margins(0, 4, 0, 4)));
|
||||
|
||||
String scope = StatusHandler.getStatus().getCurrentScope();
|
||||
|
||||
Commands.mask("Loading Deployment Resources in scope: " + scope, Commands.getViewport());
|
||||
Commands.mask("Loading Deployment Resources in scope: " + scope, this.rootPanel);
|
||||
|
||||
this.loadGHNs(scope);
|
||||
this.loadSoftwares(scope);
|
||||
}
|
||||
|
||||
public final void show() {
|
||||
window.setPlain(true);
|
||||
window.setSize(800, 600);
|
||||
window.setHeading("Software Deployment");
|
||||
window.setLayout(new FitLayout());
|
||||
window.add(this.rootPanel);
|
||||
window.show();
|
||||
window.layout(true);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,173 @@
|
|||
/****************************************************************************
|
||||
* This software is part of the gCube Project.
|
||||
* Site: http://www.gcube-system.org/
|
||||
****************************************************************************
|
||||
* The gCube/gCore software is licensed as Free Open Source software
|
||||
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
* The software and documentation is provided by its authors/distributors
|
||||
* "as is" and no expressed or
|
||||
* implied warranty is given for its use, quality or fitness for a
|
||||
* particular case.
|
||||
****************************************************************************
|
||||
* Filename: DeployVirtualCollection.java
|
||||
****************************************************************************
|
||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
||||
***************************************************************************/
|
||||
|
||||
package org.gcube.portlets.admin.resourcemanagement.client.forms.genericresources;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.remote.ProxyRegistry;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.utils.Commands;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.console.ConsoleMessageBroker;
|
||||
|
||||
import org.gcube.resourcemanagement.support.client.utils.StatusHandler;
|
||||
import org.gcube.resourcemanagement.support.client.views.ResourceTypeDecorator;
|
||||
import org.gcube.resourcemanagement.support.shared.exceptions.InvalidParameterException;
|
||||
import org.gcube.resourcemanagement.support.shared.types.Tuple;
|
||||
import org.gcube.resourcemanagement.support.shared.types.datamodel.AtomicTreeNode;
|
||||
import org.gcube.resourcemanagement.support.shared.types.datamodel.ResourceDescriptor;
|
||||
import com.extjs.gxt.ui.client.data.ModelData;
|
||||
import com.extjs.gxt.ui.client.event.ComponentEvent;
|
||||
import com.extjs.gxt.ui.client.store.ListStore;
|
||||
import com.extjs.gxt.ui.client.widget.Dialog;
|
||||
import com.extjs.gxt.ui.client.widget.MessageBox;
|
||||
import com.extjs.gxt.ui.client.widget.button.Button;
|
||||
import com.extjs.gxt.ui.client.widget.form.FormPanel;
|
||||
import com.extjs.gxt.ui.client.widget.grid.CheckBoxSelectionModel;
|
||||
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
|
||||
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
|
||||
import com.extjs.gxt.ui.client.widget.grid.Grid;
|
||||
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
||||
import com.extjs.gxt.ui.client.widget.toolbar.FillToolItem;
|
||||
import com.google.gwt.user.client.Element;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
|
||||
/**
|
||||
* @author Daniele Strollo (ISTI-CNR)
|
||||
*
|
||||
*/
|
||||
public class DeployVirtualCollection extends Dialog {
|
||||
private Grid<ResourceDescriptor> grid = null;
|
||||
|
||||
public DeployVirtualCollection() {
|
||||
this.setLayout(new FitLayout());
|
||||
this.setHeading("Deploy Virtual Collections");
|
||||
this.setModal(true);
|
||||
this.setWidth(700);
|
||||
this.setHeight(500);
|
||||
this.setResizable(false);
|
||||
//this.getButtonBar().removeAll();
|
||||
this.setHideOnButtonClick(true);
|
||||
}
|
||||
|
||||
protected final void onRender(final Element parent, final int index) {
|
||||
super.onRender(parent, index);
|
||||
initForm();
|
||||
}
|
||||
|
||||
private void closeDialog() {
|
||||
this.hide();
|
||||
}
|
||||
|
||||
private void initForm() {
|
||||
String scope = StatusHandler.getStatus().getCurrentScope();
|
||||
FormPanel form = new FormPanel();
|
||||
form.setFrame(true);
|
||||
form.setAutoWidth(true);
|
||||
|
||||
initModel(scope);
|
||||
this.add(grid);
|
||||
|
||||
this.getButtonBar().removeAll();
|
||||
this.getButtonBar().add(new FillToolItem());
|
||||
this.getButtonBar().add(new Button("Cancel") {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent ce) {
|
||||
super.onClick(ce);
|
||||
closeDialog();
|
||||
}
|
||||
});
|
||||
this.getButtonBar().add(new Button("Submit") {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent ce) {
|
||||
super.onClick(ce);
|
||||
for (ResourceDescriptor elem : grid.getSelectionModel().getSelectedItems()) {
|
||||
ConsoleMessageBroker.info(this, "Selected: " + elem.getID());
|
||||
|
||||
String body = "";
|
||||
if (elem.getProperty("body") != null) {
|
||||
body = ((Object) elem.getProperty("body")).toString().trim();
|
||||
if (body.startsWith("<Body>")) {
|
||||
body = body.replace("<Body>", "").trim();
|
||||
body = body.substring(0, body.lastIndexOf("</Body>")).trim();
|
||||
}
|
||||
}
|
||||
|
||||
ProxyRegistry.getProxyInstance().createGenericResource(
|
||||
null, // id auto-provided
|
||||
"CMSRecord", // name fixed
|
||||
"Activation Record for collection " + elem.getName(), // description
|
||||
body, // the body
|
||||
"ActivationRecord", // the subtype
|
||||
new AsyncCallback<String>() {
|
||||
public void onSuccess(final String result) {
|
||||
Commands.showPopup("Deploy Virtual Collection", "Deployed virtual collection with id " + result);
|
||||
}
|
||||
public void onFailure(final Throwable caught) {
|
||||
Commands.showPopup("Deploy Virtual Collection", "Creation failed " + caught.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
closeDialog();
|
||||
}
|
||||
});
|
||||
|
||||
updateGrid(scope);
|
||||
}
|
||||
|
||||
private void initModel(final String scope) {
|
||||
// loads the model of generic resources
|
||||
final List<ColumnConfig> modelColumns = new ArrayList<ColumnConfig>();
|
||||
modelColumns.add(new ColumnConfig("name", "Name", 300));
|
||||
//modelColumns.add(new ColumnConfig("subtype", "Secondary Type", 170));
|
||||
modelColumns.add(new ColumnConfig("ID", "ID", 300));
|
||||
modelColumns.add(new ColumnConfig("description", "Description", 300));
|
||||
final ColumnModel cm = new ColumnModel(modelColumns);
|
||||
|
||||
final CheckBoxSelectionModel<ModelData> sm = new CheckBoxSelectionModel<ModelData>();
|
||||
// adds the checkbox at the beginning
|
||||
modelColumns.add(0, sm.getColumn());
|
||||
ListStore<ResourceDescriptor> store = new ListStore<ResourceDescriptor>();
|
||||
this.grid = new Grid<ResourceDescriptor>(store, cm);
|
||||
}
|
||||
|
||||
private void updateGrid(final String scope) {
|
||||
final List<Tuple<String>> additionalFields = new Vector<Tuple<String>>();
|
||||
additionalFields.add(new Tuple<String>("description", "//Profile/Description/text()"));
|
||||
additionalFields.add(new Tuple<String>("body", "//Profile/Body"));
|
||||
|
||||
ProxyRegistry.getProxyInstance().getResourcesModel(scope,
|
||||
ResourceTypeDecorator.GenericResource.name(),
|
||||
"VirtualCollection",
|
||||
additionalFields,
|
||||
new AsyncCallback<List<ResourceDescriptor>>() {
|
||||
public void onSuccess(final List<ResourceDescriptor> result) {
|
||||
if (result == null || result.size() == 0) {
|
||||
MessageBox.alert("Deploy Virtual Collections", "No deployable resources found in the current scope",
|
||||
null);
|
||||
closeDialog();
|
||||
} else {
|
||||
grid.getStore().removeAll();
|
||||
grid.getStore().add(result);
|
||||
}
|
||||
}
|
||||
public void onFailure(final Throwable caught) {
|
||||
ConsoleMessageBroker.error(this, caught.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,183 @@
|
|||
/****************************************************************************
|
||||
* This software is part of the gCube Project.
|
||||
* Site: http://www.gcube-system.org/
|
||||
****************************************************************************
|
||||
* The gCube/gCore software is licensed as Free Open Source software
|
||||
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
* The software and documentation is provided by its authors/distributors
|
||||
* "as is" and no expressed or
|
||||
* implied warranty is given for its use, quality or fitness for a
|
||||
* particular case.
|
||||
****************************************************************************
|
||||
* Filename: GenericResourceForm.java
|
||||
****************************************************************************
|
||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
||||
***************************************************************************/
|
||||
|
||||
package org.gcube.portlets.admin.resourcemanagement.client.forms.genericresources;
|
||||
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.utils.OpCommands;
|
||||
import org.gcube.resourcemanagement.support.client.views.validators.XMLValidator;
|
||||
import org.gcube.resourcemanagement.support.shared.types.Tuple;
|
||||
import org.gcube.resourcemanagement.support.shared.types.datamodel.ResourceDescriptor;
|
||||
|
||||
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
|
||||
import com.extjs.gxt.ui.client.event.ComponentEvent;
|
||||
import com.extjs.gxt.ui.client.widget.Dialog;
|
||||
import com.extjs.gxt.ui.client.widget.button.Button;
|
||||
import com.extjs.gxt.ui.client.widget.form.Field;
|
||||
import com.extjs.gxt.ui.client.widget.form.FormButtonBinding;
|
||||
import com.extjs.gxt.ui.client.widget.form.FormPanel;
|
||||
import com.extjs.gxt.ui.client.widget.form.TextArea;
|
||||
import com.extjs.gxt.ui.client.widget.form.TextField;
|
||||
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
||||
import com.extjs.gxt.ui.client.widget.layout.FormData;
|
||||
import com.google.gwt.user.client.Element;
|
||||
|
||||
public class GenericResourceForm extends Dialog {
|
||||
private FormData formData = null;
|
||||
private FormPanel form = null;
|
||||
private ResourceDescriptor toEdit = null;
|
||||
|
||||
public GenericResourceForm() {
|
||||
this.setLayout(new FitLayout());
|
||||
this.setHeading("Generic Resource Creation");
|
||||
this.setModal(true);
|
||||
this.setWidth(700);
|
||||
this.setHeight(500);
|
||||
this.setResizable(false);
|
||||
this.getButtonBar().removeAll();
|
||||
this.setHideOnButtonClick(true);
|
||||
}
|
||||
|
||||
// Added for editing mode
|
||||
public GenericResourceForm(final ResourceDescriptor genericRes) {
|
||||
this();
|
||||
this.setHeading("Generic Resource Edit");
|
||||
this.toEdit = genericRes;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void onRender(final Element parent, final int index) {
|
||||
super.onRender(parent, index);
|
||||
formData = new FormData("-20");
|
||||
createForm();
|
||||
}
|
||||
|
||||
public final void closeDialog() {
|
||||
this.hide();
|
||||
}
|
||||
|
||||
private boolean isEditing() {
|
||||
return this.toEdit != null;
|
||||
}
|
||||
|
||||
private void createForm() {
|
||||
form = new FormPanel();
|
||||
form.setFrame(true);
|
||||
form.setAutoWidth(true);
|
||||
|
||||
form.setHeaderVisible(false);
|
||||
form.getHeader().setStyleName("x-hide-panel-header");
|
||||
|
||||
TextField<String> resID = new TextField<String>();
|
||||
resID.setFieldLabel("Resource ID");
|
||||
// resID.setValidator(new StringValidator(120, false));
|
||||
resID.setAllowBlank(false); // is required
|
||||
// If in editing mode
|
||||
if (toEdit != null && toEdit.getID() != null) {
|
||||
resID.setValue(toEdit.getID());
|
||||
} else {
|
||||
resID.setEmptyText("<generated by Resource Manager>");
|
||||
}
|
||||
resID.setEnabled(false);
|
||||
form.add(resID, formData);
|
||||
|
||||
TextField<String> resName = new TextField<String>();
|
||||
resName.setFieldLabel("Resource Name");
|
||||
// resName.setValidator(new StringValidator(120, false));
|
||||
resName.setAllowBlank(false); // is required
|
||||
// If in editing mode
|
||||
if (toEdit != null && toEdit.getName() != null) {
|
||||
resName.setValue(toEdit.getName());
|
||||
}
|
||||
form.add(resName, formData);
|
||||
|
||||
TextField<String> resType = new TextField<String>();
|
||||
resType.setFieldLabel("Secondary type");
|
||||
// resType.setValidator(new StringValidator(120, false));
|
||||
resType.setAllowBlank(false); // is required
|
||||
// If in editing mode
|
||||
if (toEdit != null && toEdit.get("SecondaryType") != null) {
|
||||
resType.setValue(((Object) toEdit.get("SecondaryType")).toString());
|
||||
}
|
||||
form.add(resType, formData);
|
||||
|
||||
TextArea description = new TextArea();
|
||||
description.setFieldLabel("Description");
|
||||
// If in editing mode
|
||||
if (toEdit != null && toEdit.get("Description") != null) {
|
||||
description.setValue(((Object) toEdit.get("Description")).toString());
|
||||
}
|
||||
form.add(description, formData);
|
||||
|
||||
TextArea body = new TextArea();
|
||||
body.setFieldLabel("Body");
|
||||
body.setHeight(235);
|
||||
body.setValidator(new XMLValidator("body"));
|
||||
// If in editing mode
|
||||
if (toEdit != null && toEdit.get("Body") != null) {
|
||||
body.setValue(((Object) toEdit.get("Body")).toString());
|
||||
}
|
||||
form.add(body, formData);
|
||||
|
||||
Button submitBtn = new Button("Submit") {
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent ce) {
|
||||
super.onClick(ce);
|
||||
if (!form.isValid()) {
|
||||
return;
|
||||
}
|
||||
Tuple<String> values = new Tuple<String>();
|
||||
for (Field<?> field : form.getFields()) {
|
||||
values.append(field.getRawValue());
|
||||
}
|
||||
// Creation mode
|
||||
if (!isEditing()) {
|
||||
String resName = values.get(1);
|
||||
String resType = values.get(2);
|
||||
String description = values.get(3);
|
||||
String body = values.get(4);
|
||||
|
||||
OpCommands.doCreateGenericResource(null, resName, description, body, resType);
|
||||
} else {
|
||||
// Editing mode
|
||||
String resID = values.get(0);
|
||||
String resName = values.get(1);
|
||||
String resType = values.get(2);
|
||||
String description = values.get(3);
|
||||
String body = values.get(4);
|
||||
OpCommands.doEditGenericResource(resID, resName, description, body, resType);
|
||||
}
|
||||
|
||||
closeDialog();
|
||||
}
|
||||
};
|
||||
form.addButton(submitBtn);
|
||||
form.addButton(new Button("Cancel") {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent ce) {
|
||||
super.onClick(ce);
|
||||
closeDialog();
|
||||
}
|
||||
});
|
||||
|
||||
form.setButtonAlign(HorizontalAlignment.CENTER);
|
||||
|
||||
FormButtonBinding binding = new FormButtonBinding(form);
|
||||
binding.addButton(submitBtn);
|
||||
|
||||
this.add(form);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
/****************************************************************************
|
||||
* This software is part of the gCube Project.
|
||||
* Site: http://www.gcube-system.org/
|
||||
****************************************************************************
|
||||
* The gCube/gCore software is licensed as Free Open Source software
|
||||
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
* The software and documentation is provided by its authors/distributors
|
||||
* "as is" and no expressed or
|
||||
* implied warranty is given for its use, quality or fitness for a
|
||||
* particular case.
|
||||
****************************************************************************
|
||||
* Filename: ProxyRegistry.java
|
||||
****************************************************************************
|
||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
||||
***************************************************************************/
|
||||
|
||||
package org.gcube.portlets.admin.resourcemanagement.client.remote;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.user.client.rpc.ServiceDefTarget;
|
||||
|
||||
/**
|
||||
* Utility to simply access in a singleton manner to the
|
||||
* remote RPC proxy implemented by
|
||||
* {@link org.gcube.portlets.admin.resourcemanagement.server.ServiceProxyImpl}.
|
||||
* @author Daniele Strollo (ISTI-CNR)
|
||||
*/
|
||||
public class ProxyRegistry {
|
||||
private static ServiceProxyAsync instance = null;
|
||||
private static final String proxyURI = "ServiceProxy";
|
||||
|
||||
/**
|
||||
* Access to the singleton instance of proxy to contact the
|
||||
* servlet implementing the server side logics of the application.
|
||||
* @return the proxy used to invoke the remote servlet.
|
||||
*/
|
||||
public static synchronized ServiceProxyAsync getProxyInstance() {
|
||||
if (instance == null) {
|
||||
String moduleURL = GWT.getModuleBaseURL() + proxyURI;
|
||||
instance = (ServiceProxyAsync) GWT.create(ServiceProxy.class);
|
||||
ServiceDefTarget endpoint = (ServiceDefTarget) instance;
|
||||
endpoint.setServiceEntryPoint(moduleURL);
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,181 @@
|
|||
/****************************************************************************
|
||||
* This software is part of the gCube Project.
|
||||
* Site: http://www.gcube-system.org/
|
||||
****************************************************************************
|
||||
* The gCube/gCore software is licensed as Free Open Source software
|
||||
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
* The software and documentation is provided by its authors/distributors
|
||||
* "as is" and no expressed or
|
||||
* implied warranty is given for its use, quality or fitness for a
|
||||
* particular case.
|
||||
****************************************************************************
|
||||
* Filename: RemoteService.java
|
||||
****************************************************************************
|
||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
||||
***************************************************************************/
|
||||
|
||||
package org.gcube.portlets.admin.resourcemanagement.client.remote;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.resourcemanagement.support.client.utils.CurrentStatus;
|
||||
import org.gcube.resourcemanagement.support.shared.operations.SupportedOperations;
|
||||
import org.gcube.resourcemanagement.support.shared.plugins.GenericResourcePlugin;
|
||||
import org.gcube.resourcemanagement.support.shared.types.Tuple;
|
||||
import org.gcube.resourcemanagement.support.shared.types.datamodel.CompleteResourceProfile;
|
||||
import org.gcube.resourcemanagement.support.shared.types.datamodel.ResourceDescriptor;
|
||||
|
||||
import com.google.gwt.user.client.rpc.RemoteService;
|
||||
|
||||
/**
|
||||
* Interface of RPC servlet implementing the server side logics
|
||||
* of the application.
|
||||
* @author Daniele Strollo (ISTI-CNR)
|
||||
*/
|
||||
public interface ServiceProxy extends RemoteService {
|
||||
|
||||
boolean enableSuperUserMode(String password);
|
||||
|
||||
CurrentStatus initStatus();
|
||||
|
||||
void emptyCache();
|
||||
|
||||
void setUseCache(boolean flag);
|
||||
|
||||
void initScopes(boolean doClean);
|
||||
|
||||
void setSuperUser(boolean superUser);
|
||||
|
||||
/**
|
||||
* This way the servlet stores the scope in the session.
|
||||
*/
|
||||
void setCurrentScope(String scope);
|
||||
|
||||
/**
|
||||
* @return the list of all available scopes.
|
||||
*/
|
||||
List<String> getAvailableScopes();
|
||||
List<String> getAvailableAddScopes();
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param resType
|
||||
* @param resourceIDs
|
||||
* @param scope
|
||||
* @return the xml representation of the generated report (if not failed).
|
||||
* it is a tuple consisting of:
|
||||
* <br/>0) the reportID
|
||||
* <br/>1) the resourceType
|
||||
* <br/>2) the xmlrepresentation
|
||||
* <br/>3) the html representation
|
||||
* @throws Exception
|
||||
*/
|
||||
Tuple<String> addResourcesToScope(final String resType, final List<String> resourceIDs, final String scope) throws Exception;
|
||||
|
||||
Tuple<String> removeResourcesFromScope(String resType, List<String> resourceIDs, String scope) throws Exception;
|
||||
|
||||
|
||||
String deploy(final List<String> ghnsID, final List<String> servicesID) throws Exception;
|
||||
Tuple<String> checkDeployStatus(String scope, String deployID) throws Exception;
|
||||
|
||||
List<ResourceDescriptor> getResourcesModel(String scope, String type, String subType, final List<Tuple<String>> additionalMaps) throws Exception;
|
||||
/**
|
||||
* Given a scope, provides the set of (Type, SubType) couples
|
||||
* defining resources in the system.
|
||||
* The key of returned hashmap is the type and the associated
|
||||
* value is a list of string representing its related sub-types.
|
||||
* @see org.gcube.portlets.admin.resourcemanagement.server.gcube.services.ISClientRequester#getResourcesTypes(org.gcube.common.core.scope.GCUBEScope)
|
||||
* @param scope the scope of resources
|
||||
* @return the hash of (type, list(subtypes))
|
||||
*/
|
||||
HashMap<String, ArrayList<String>> getResourceTypeTree(String scope) throws Exception;
|
||||
|
||||
/**
|
||||
* Given a type retrieves its related resources.
|
||||
* E.g. for GHN returns the RunningInstances on it.
|
||||
* @param scope
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
List<String> getRelatedResources(String type, String id, String scope);
|
||||
|
||||
/**
|
||||
* For a given type returns all the resources defined in the IS having
|
||||
* the chosen type.
|
||||
* @param scope the scope of resources
|
||||
* @param type the type of searched resources (e.g. GHN, RunningInstance, ...)
|
||||
* @return list of XML profiles of resources found
|
||||
*/
|
||||
List<String> getResourcesByType(String scope, String type);
|
||||
|
||||
/**
|
||||
* Filters the resources in a given scope by their type and subtype.
|
||||
* For example it allows to retrieve in a scope all the GHN (type)
|
||||
* defined in a domain (its subtype).
|
||||
* @param scope the scope of resources
|
||||
* @param type the type of searched resources (e.g. GHN, RunningInstance, ...)
|
||||
* @param subtype the subtype of search resources (e.g. for GHN is its domain).
|
||||
* @return list of XML profiles of resources found
|
||||
*/
|
||||
List<String> getResourcesBySubType(String scope, String type, String subtype);
|
||||
|
||||
/**
|
||||
* Used for generic resource editing form to retrieve the profile.
|
||||
* @param scope
|
||||
* @param resID
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
ResourceDescriptor getGenericResourceDescriptor(String scope, String resID) throws Exception;
|
||||
|
||||
/**
|
||||
* Returns the list of WSResources
|
||||
* @param scope the scope of resources
|
||||
* @return list of XML profiles of resources found
|
||||
*/
|
||||
List<String> getWSResources(String scope);
|
||||
|
||||
/**
|
||||
* Retrieves the XML profiles and its HTML representation of
|
||||
* a resource given its unique identifier and its type.
|
||||
* Notice that the ID is ensured to be unique for resources
|
||||
* of the same type.
|
||||
* @param scope the scope of the resource
|
||||
* @param type the type of the searched resource (e.g. GHN, RunningInstance, ...)
|
||||
* @param resID the unique identifier of the resource
|
||||
* @return a couple of strings (XMLProfile, HTMLProfileRepresentation)
|
||||
*/
|
||||
CompleteResourceProfile getResourceByID(String scope, String type, String resID);
|
||||
|
||||
|
||||
String createGenericResource(
|
||||
final String id,
|
||||
final String name,
|
||||
final String description,
|
||||
final String body,
|
||||
final String subType)
|
||||
throws Exception;
|
||||
|
||||
void updateGenericResource(
|
||||
final String id,
|
||||
final String name,
|
||||
final String description,
|
||||
final String body,
|
||||
final String subType)
|
||||
throws Exception;
|
||||
|
||||
Map<String, GenericResourcePlugin> getGenericResourcePlugins() throws Exception;
|
||||
|
||||
/***********************************************************
|
||||
* RESOURCE OPERATIONS
|
||||
**********************************************************/
|
||||
void doOperation(SupportedOperations opCode, String scope, List<ResourceDescriptor> resources)
|
||||
throws Exception;
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,122 @@
|
|||
/****************************************************************************
|
||||
* This software is part of the gCube Project.
|
||||
* Site: http://www.gcube-system.org/
|
||||
****************************************************************************
|
||||
* The gCube/gCore software is licensed as Free Open Source software
|
||||
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
* The software and documentation is provided by its authors/distributors
|
||||
* "as is" and no expressed or
|
||||
* implied warranty is given for its use, quality or fitness for a
|
||||
* particular case.
|
||||
****************************************************************************
|
||||
* Filename: ServiceProxyAsync.java
|
||||
****************************************************************************
|
||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
||||
***************************************************************************/
|
||||
|
||||
package org.gcube.portlets.admin.resourcemanagement.client.remote;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.resourcemanagement.support.client.utils.CurrentStatus;
|
||||
import org.gcube.resourcemanagement.support.shared.operations.SupportedOperations;
|
||||
import org.gcube.resourcemanagement.support.shared.plugins.GenericResourcePlugin;
|
||||
import org.gcube.resourcemanagement.support.shared.types.Tuple;
|
||||
import org.gcube.resourcemanagement.support.shared.types.datamodel.CompleteResourceProfile;
|
||||
import org.gcube.resourcemanagement.support.shared.types.datamodel.ResourceDescriptor;
|
||||
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
|
||||
/**
|
||||
* The asynchronous representation of {@link ServiceProxy} interface.
|
||||
* Needed to implement the server side async RPC.
|
||||
*
|
||||
* @author Daniele Strollo (ISTI-CNR)
|
||||
*/
|
||||
public interface ServiceProxyAsync {
|
||||
|
||||
void emptyCache(AsyncCallback<Void> callback);
|
||||
void setUseCache(boolean flag, AsyncCallback<Void> callback);
|
||||
|
||||
void setSuperUser(boolean superUser, AsyncCallback<Void> callback);
|
||||
|
||||
void setCurrentScope(String scope, AsyncCallback<Void> callback);
|
||||
|
||||
void initStatus(AsyncCallback<CurrentStatus> callback);
|
||||
|
||||
void initScopes(boolean doClean, AsyncCallback<Void> callback);
|
||||
|
||||
void addResourcesToScope(final String resType, final List<String> resourceIDs, final String scope, AsyncCallback<Tuple<String>> callback);
|
||||
|
||||
void removeResourcesFromScope(final String resType, final List<String> resourceIDs, final String scope, AsyncCallback<Tuple<String>> callback);
|
||||
|
||||
void deploy(final List<String> ghnsID, final List<String> servicesID, AsyncCallback<String> callback);
|
||||
void checkDeployStatus(String scope, String deployID, AsyncCallback<Tuple<String>> callback);
|
||||
|
||||
void getResourcesModel(String scope, String type, String subType, final List<Tuple<String>> additionalMaps, AsyncCallback<List<ResourceDescriptor>> callback);
|
||||
|
||||
void getGenericResourceDescriptor(String scope, String resID, AsyncCallback<ResourceDescriptor> callback);
|
||||
|
||||
/**
|
||||
* @see ServiceProxy#getAvailableScopes()
|
||||
*/
|
||||
void getAvailableScopes(AsyncCallback<List<String>> callback);
|
||||
|
||||
void getAvailableAddScopes(AsyncCallback<List<String>> callback);
|
||||
|
||||
void getResourceTypeTree(String scope,
|
||||
AsyncCallback<HashMap<String, ArrayList<String>>> callback);
|
||||
|
||||
void getRelatedResources(String type, String id, String scope, AsyncCallback<List<String>> callback);
|
||||
|
||||
/**
|
||||
* @see ServiceProxy#getResourcesByType(String, String)
|
||||
*/
|
||||
void getResourcesByType(String scope, String type, AsyncCallback<List<String>> callback);
|
||||
|
||||
/**
|
||||
* @see ServiceProxy#getResourcesBySubType(String, String, String)
|
||||
*/
|
||||
void getResourcesBySubType(String scope, String type, String subtype, AsyncCallback<List<String>> callback);
|
||||
|
||||
|
||||
/**
|
||||
* @see ServiceProxy#getWSResources(String)
|
||||
*/
|
||||
void getWSResources(String scope, AsyncCallback<List<String>> callback);
|
||||
|
||||
/**
|
||||
* @see ServiceProxy#getResourceByID(String, String, String)
|
||||
*/
|
||||
void getResourceByID(String scope, String type, String resID, AsyncCallback<CompleteResourceProfile> callback);
|
||||
|
||||
void createGenericResource(
|
||||
final String id,
|
||||
final String name,
|
||||
final String description,
|
||||
final String body,
|
||||
final String subType,
|
||||
AsyncCallback<String> callback);
|
||||
|
||||
void updateGenericResource(
|
||||
final String id,
|
||||
final String name,
|
||||
final String description,
|
||||
final String body,
|
||||
final String subType,
|
||||
AsyncCallback<Void> callback);
|
||||
|
||||
void getGenericResourcePlugins(AsyncCallback<Map<String, GenericResourcePlugin>> callback);
|
||||
|
||||
|
||||
|
||||
/***********************************************************
|
||||
* RESOURCE OPERATIONS
|
||||
**********************************************************/
|
||||
void doOperation(SupportedOperations opCode, String scope, List<ResourceDescriptor> resources, AsyncCallback<Void> callback) throws Exception;
|
||||
void enableSuperUserMode(String password, AsyncCallback<Boolean> callback);
|
||||
|
||||
}
|
|
@ -0,0 +1,371 @@
|
|||
/****************************************************************************
|
||||
* This software is part of the gCube Project.
|
||||
* Site: http://www.gcube-system.org/
|
||||
****************************************************************************
|
||||
* The gCube/gCore software is licensed as Free Open Source software
|
||||
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
* The software and documentation is provided by its authors/distributors
|
||||
* "as is" and no expressed or
|
||||
* implied warranty is given for its use, quality or fitness for a
|
||||
* particular case.
|
||||
****************************************************************************
|
||||
* Filename: Callbacks.java
|
||||
****************************************************************************
|
||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
||||
***************************************************************************/
|
||||
|
||||
package org.gcube.portlets.admin.resourcemanagement.client.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.views.profile.ResourceProfilePanel;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.views.resourcedetails.ResourceDetailsPanel;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.views.resourcedetails.ResourceGridFactory;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.views.resourcetree.ResourcesTreePanel;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.views.resourcetree.WSResourcesTreePanel;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.console.ConsoleMessageBroker;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.panels.MainPanel;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.registry.UIIdentifiers;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.registry.WidgetsRegistry;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.taskbar.TaskbarItem;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.taskbar.TaskbarRegister;
|
||||
import org.gcube.resourcemanagement.support.client.utils.LocalStatus;
|
||||
import org.gcube.resourcemanagement.support.client.utils.StatusHandler;
|
||||
import org.gcube.resourcemanagement.support.client.views.ResourceTypeDecorator;
|
||||
import org.gcube.resourcemanagement.support.shared.types.Tuple;
|
||||
import org.gcube.resourcemanagement.support.shared.types.datamodel.CompleteResourceProfile;
|
||||
|
||||
import com.extjs.gxt.ui.client.data.ModelData;
|
||||
import com.extjs.gxt.ui.client.event.ComponentEvent;
|
||||
import com.extjs.gxt.ui.client.widget.ContentPanel;
|
||||
import com.extjs.gxt.ui.client.widget.Dialog;
|
||||
import com.extjs.gxt.ui.client.widget.MessageBox;
|
||||
import com.extjs.gxt.ui.client.widget.button.Button;
|
||||
import com.extjs.gxt.ui.client.widget.grid.Grid;
|
||||
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
||||
import com.extjs.gxt.ui.client.widget.menu.Menu;
|
||||
import com.extjs.gxt.ui.client.widget.menu.MenuItem;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
|
||||
/**
|
||||
* In order to simplify the management of asynchronous commands
|
||||
* executed by the application that involve access to the servlet
|
||||
* the invocations have been represented in {@link Commands} and
|
||||
* the related callbacks here.
|
||||
*
|
||||
* @author Daniele Strollo (ISTI-CNR)
|
||||
*/
|
||||
public class Callbacks {
|
||||
|
||||
|
||||
public static final AsyncCallback<List<String>> handleGetAvailableScopes = new AsyncCallback<List<String>>() {
|
||||
public void onSuccess(final List<String> result) {
|
||||
|
||||
if (!WidgetsRegistry.containsElem(UIIdentifiers.BUTTON_AVAILABLE_SCOPES_ID)) {
|
||||
//MessageBox.info("Failure", "cannot retrieve the scopes button", null);
|
||||
Commands.unmask(UIIdentifiers.MAIN_CONTAINER_VIEWPORT_ID);
|
||||
return;
|
||||
}
|
||||
Button btnScopes = (Button) WidgetsRegistry.getWidget(UIIdentifiers.BUTTON_AVAILABLE_SCOPES_ID);
|
||||
|
||||
Menu scrollMenu = new Menu();
|
||||
scrollMenu.setMaxHeight(200);
|
||||
|
||||
LocalStatus.getInstance().getAvailableScopes().clear();
|
||||
|
||||
for (String scope : result) {
|
||||
final String currScope = scope;
|
||||
LocalStatus.getInstance().getAvailableScopes().add(currScope);
|
||||
scrollMenu.add(new MenuItem(currScope) {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent be) {
|
||||
super.onClick(be);
|
||||
Commands.doLoadResourceTree(this, currScope);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
btnScopes.setMenu(scrollMenu);
|
||||
Commands.unmask(UIIdentifiers.MAIN_CONTAINER_VIEWPORT_ID);
|
||||
}
|
||||
public void onFailure(final Throwable caught) {
|
||||
Commands.unmask(UIIdentifiers.MAIN_CONTAINER_VIEWPORT_ID);
|
||||
MessageBox.info("Failure", "cannot retrieve the scopes", null);
|
||||
GWT.log("cannot retrieve the scopes", caught);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
public static final void builtResourceTree(final HashMap<String, ArrayList<String>> result, final boolean clearGrid) {
|
||||
MainPanel panel = WidgetsRegistry.getPanel(UIIdentifiers.RESOURCE_NAVIGATION_PANEL);
|
||||
|
||||
List<String> wsResourcesTypes = null;
|
||||
if (result.containsKey(ResourceTypeDecorator.WSResource.name())) {
|
||||
wsResourcesTypes = result.get(ResourceTypeDecorator.WSResource.name());
|
||||
result.remove(ResourceTypeDecorator.WSResource.name());
|
||||
}
|
||||
|
||||
// Creates the tree of resources
|
||||
ResourcesTreePanel resourceTree = new ResourcesTreePanel(result);
|
||||
resourceTree.getWidget().setWidth("100%");
|
||||
resourceTree.getWidget().setHeight("100%");
|
||||
ContentPanel cp = new ContentPanel();
|
||||
cp.setAnimCollapse(false);
|
||||
cp.setHeading("Resources");
|
||||
cp.setLayout(new FitLayout());
|
||||
cp.add(resourceTree.getWidget());
|
||||
panel.add(cp, true);
|
||||
|
||||
if (wsResourcesTypes != null && wsResourcesTypes.size() > 0) {
|
||||
// Creates the tree of WSResources
|
||||
WSResourcesTreePanel wsresourceTree = new WSResourcesTreePanel(wsResourcesTypes);
|
||||
wsresourceTree.getWidget().setWidth("100%");
|
||||
wsresourceTree.getWidget().setHeight("100%");
|
||||
cp = new ContentPanel();
|
||||
cp.setAnimCollapse(false);
|
||||
cp.setHeading("WSResources");
|
||||
cp.setLayout(new FitLayout());
|
||||
cp.add(wsresourceTree.getWidget());
|
||||
panel.add(cp, false);
|
||||
}
|
||||
|
||||
if (clearGrid) {
|
||||
Commands.clearResourceGridPanel();
|
||||
}
|
||||
|
||||
Commands.unmask(WidgetsRegistry.getPanel(UIIdentifiers.RESOURCE_NAVIGATION_PANEL).getContainer());
|
||||
Commands.unmask(
|
||||
UIIdentifiers.GLOBAL_STATUS_BAR_ID,
|
||||
UIIdentifiers.GLOBAL_MENUBAR_ID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Once received the list of Types/Subtypes they are shown in a tree panel.
|
||||
* Here implemented the logics for that.
|
||||
*/
|
||||
public static final AsyncCallback<HashMap<String, ArrayList<String>>> handleLoadResourceTree =
|
||||
new AsyncCallback<HashMap<String, ArrayList<String>>>() {
|
||||
public void onSuccess(final HashMap<String, ArrayList<String>> result) {
|
||||
builtResourceTree(result, true);
|
||||
}
|
||||
public void onFailure(final Throwable caught) {
|
||||
MessageBox.info("Failure", caught.getMessage(), null);
|
||||
|
||||
Commands.clearResourceTreePanel();
|
||||
ConsoleMessageBroker.error("loading resource", caught.getMessage());
|
||||
Commands.unmask(WidgetsRegistry.getPanel(UIIdentifiers.RESOURCE_NAVIGATION_PANEL).getContainer());
|
||||
Commands.unmask(
|
||||
UIIdentifiers.GLOBAL_STATUS_BAR_ID,
|
||||
UIIdentifiers.GLOBAL_MENUBAR_ID);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Once received the list of Types/Subtypes they are shown in a tree panel.
|
||||
* Here implemented the logics for that.
|
||||
*/
|
||||
public static final AsyncCallback<HashMap<String, ArrayList<String>>> handleReloadResourceTree =
|
||||
new AsyncCallback<HashMap<String, ArrayList<String>>>() {
|
||||
public void onSuccess(final HashMap<String, ArrayList<String>> result) {
|
||||
builtResourceTree(result, false);
|
||||
}
|
||||
public void onFailure(final Throwable caught) {
|
||||
MessageBox.info("Failure", caught.getMessage(), null);
|
||||
|
||||
Commands.clearResourceTreePanel();
|
||||
ConsoleMessageBroker.error("loading resource", caught.getMessage());
|
||||
Commands.unmask(WidgetsRegistry.getPanel(UIIdentifiers.RESOURCE_NAVIGATION_PANEL).getContainer());
|
||||
Commands.unmask(
|
||||
UIIdentifiers.GLOBAL_STATUS_BAR_ID,
|
||||
UIIdentifiers.GLOBAL_MENUBAR_ID);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Once received the list of resource profiles for resources of a given type,
|
||||
* they will be shown inside a grid that is created here.
|
||||
*/
|
||||
public static final AsyncCallback<List<String>> handleLoadResourceDetailsGrid =
|
||||
new AsyncCallback<List<String>>() {
|
||||
public void onSuccess(final List<String> result) {
|
||||
|
||||
Commands.mask(
|
||||
"Rendering grid",
|
||||
WidgetsRegistry.getPanel(UIIdentifiers.RESOURCE_DETAIL_GRID_PANEL).getContainer()
|
||||
);
|
||||
try {
|
||||
ResourceDetailsPanel resGrid = Commands.getResourceDetailPanel();
|
||||
Grid<ModelData> grid = ResourceGridFactory.createGrid(StatusHandler.getStatus().getCurrentResourceType(),
|
||||
result,
|
||||
"SubType");
|
||||
resGrid.setGrid(grid, true);
|
||||
} catch (NullPointerException e1) {
|
||||
MessageBox.info(
|
||||
"Failure",
|
||||
"the grid container cannot be retrieved",
|
||||
null);
|
||||
}
|
||||
Commands.unmask(WidgetsRegistry.getPanel(UIIdentifiers.RESOURCE_NAVIGATION_PANEL).getContainer());
|
||||
Commands.unmask(WidgetsRegistry.getPanel(UIIdentifiers.RESOURCE_DETAIL_GRID_PANEL).getContainer());
|
||||
|
||||
Commands.setLoadedResources(result != null ? result.size() : 0);
|
||||
Commands.showPopup("Grid Creation", "Retrieved " + (result != null ? result.size() : 0) + " elements.");
|
||||
}
|
||||
|
||||
public void onFailure(final Throwable caught) {
|
||||
MessageBox.info("Failure", "the grid has not been built", null);
|
||||
Commands.unmask(WidgetsRegistry.getPanel(UIIdentifiers.RESOURCE_NAVIGATION_PANEL).getContainer());
|
||||
Commands.unmask(WidgetsRegistry.getPanel(UIIdentifiers.RESOURCE_DETAIL_GRID_PANEL).getContainer());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
public static final AsyncCallback<List<String>> handleFilterResourceDetailsGrid =
|
||||
new AsyncCallback<List<String>>() {
|
||||
public void onSuccess(final List<String> result) {
|
||||
try {
|
||||
ResourceDetailsPanel resGrid = Commands.getResourceDetailPanel();
|
||||
Grid<ModelData> grid = ResourceGridFactory.createGrid(StatusHandler.getStatus().getCurrentResourceType(),
|
||||
result,
|
||||
null);
|
||||
resGrid.setGrid(grid, false);
|
||||
} catch (NullPointerException e1) {
|
||||
MessageBox.info(
|
||||
"Failure",
|
||||
"the grid container cannot be retrieved",
|
||||
null);
|
||||
} finally {
|
||||
Commands.unmask(WidgetsRegistry.getPanel(UIIdentifiers.RESOURCE_NAVIGATION_PANEL).getContainer());
|
||||
Commands.unmask(WidgetsRegistry.getPanel(UIIdentifiers.RESOURCE_DETAIL_GRID_PANEL).getContainer());
|
||||
}
|
||||
|
||||
Commands.setLoadedResources(result != null ? result.size() : 0);
|
||||
Commands.showPopup("Grid Creation", "Retrieved " + (result != null ? result.size() : 0) + " elements.");
|
||||
}
|
||||
|
||||
public void onFailure(final Throwable caught) {
|
||||
MessageBox.info("Failure", "the grid has not been built", null);
|
||||
|
||||
Commands.unmask(WidgetsRegistry.getPanel(UIIdentifiers.RESOURCE_NAVIGATION_PANEL).getContainer());
|
||||
Commands.unmask(WidgetsRegistry.getPanel(UIIdentifiers.RESOURCE_DETAIL_GRID_PANEL).getContainer());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public static final AsyncCallback<CompleteResourceProfile> handleGetResourceProfile =
|
||||
new AsyncCallback<CompleteResourceProfile>() {
|
||||
|
||||
public void onSuccess(final CompleteResourceProfile result) {
|
||||
Dialog dlg = new Dialog();
|
||||
dlg.setLayout(new FitLayout());
|
||||
dlg.setHeading("XML Resource Profile");
|
||||
dlg.setModal(true);
|
||||
dlg.setWidth(800);
|
||||
dlg.setHeight(400);
|
||||
dlg.setHideOnButtonClick(true);
|
||||
// HtmlContainer htmlContainer = new HtmlContainer();
|
||||
try {
|
||||
// This resource has already been opened
|
||||
if (TaskbarRegister.contains(result.getID())) {
|
||||
TaskbarRegister.getTaskbarItem(result.getID()).destroy();
|
||||
Commands.showPopup("Retrieve Resource Profile", "Refreshing profile for id: " +
|
||||
result.getID(), 3000);
|
||||
}
|
||||
MainPanel taskbarContainer = WidgetsRegistry.getPanel(UIIdentifiers.TASKBAR_PANEL);
|
||||
TaskbarItem tkItem = new TaskbarItem(
|
||||
StatusHandler.getStatus().getCurrentScope(),
|
||||
result.getType(),
|
||||
taskbarContainer,
|
||||
result.getID(),
|
||||
//result.getType() + ": " + result.getTitle(),
|
||||
result.getTitle(),
|
||||
"resource-profile-taskbar-item",
|
||||
"profile-big-icon");
|
||||
tkItem.getRelatedWindow().setMainWidget(
|
||||
new ResourceProfilePanel(
|
||||
result.getType(),
|
||||
result.getXmlRepresentation(),
|
||||
result.getHtmlRepresentation()).getWidget());
|
||||
TaskbarRegister.registerTaskbarWidget(result.getID(), tkItem);
|
||||
} catch (Exception e) {
|
||||
GWT.log("During HTML conversion", e);
|
||||
} finally {
|
||||
Commands.unmask(WidgetsRegistry.getPanel(UIIdentifiers.RESOURCE_DETAIL_GRID_PANEL).getContainer());
|
||||
}
|
||||
}
|
||||
|
||||
public void onFailure(final Throwable caught) {
|
||||
MessageBox.info("Failure", "the profile has not been retrieved", null);
|
||||
GWT.log("on handleGetResourceProfile", caught);
|
||||
Commands.unmask(WidgetsRegistry.getPanel(UIIdentifiers.RESOURCE_DETAIL_GRID_PANEL).getContainer());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public static final AsyncCallback<Tuple<String>> handleGetDeploymentReport =
|
||||
new AsyncCallback<Tuple<String>>() {
|
||||
|
||||
public void onSuccess(final Tuple<String> result) {
|
||||
|
||||
if (result.size() < 3) {
|
||||
MessageBox.alert("Invalid Report Received", "Don't know why :(", null);
|
||||
Commands.unmask(UIIdentifiers.GLOBAL_STATUS_BAR_ID);
|
||||
Commands.unmask(UIIdentifiers.MAIN_CONTAINER_VIEWPORT_ID, UIIdentifiers.RESOURCE_DETAIL_GRID_PANEL);
|
||||
return;
|
||||
}
|
||||
|
||||
Dialog dlg = new Dialog();
|
||||
dlg.setLayout(new FitLayout());
|
||||
dlg.setHeading("XML Resource Profile");
|
||||
dlg.setModal(true);
|
||||
dlg.setWidth(800);
|
||||
dlg.setHeight(400);
|
||||
dlg.setHideOnButtonClick(true);
|
||||
// HtmlContainer htmlContainer = new HtmlContainer();
|
||||
try {
|
||||
|
||||
String reportID = result.get(0);
|
||||
String resourceTitle = ResourceTypeDecorator.DeployReport.getLabel() + ": " + reportID;
|
||||
|
||||
// This resource has already been opened
|
||||
if (TaskbarRegister.contains(reportID)) {
|
||||
TaskbarRegister.getTaskbarItem(reportID).destroy();
|
||||
Commands.showPopup("Retrieve Report", "Refreshing Report id: " +
|
||||
reportID, 3000);
|
||||
}
|
||||
MainPanel taskbarContainer = WidgetsRegistry.getPanel(UIIdentifiers.TASKBAR_PANEL);
|
||||
TaskbarItem tkItem = new TaskbarItem(
|
||||
StatusHandler.getStatus().getCurrentScope(),
|
||||
ResourceTypeDecorator.DeployReport,
|
||||
taskbarContainer,
|
||||
reportID,
|
||||
resourceTitle,
|
||||
"resource-profile-taskbar-item",
|
||||
ResourceTypeDecorator.DeployReport.getIcon());
|
||||
tkItem.getRelatedWindow().setMainWidget(
|
||||
new ResourceProfilePanel(
|
||||
ResourceTypeDecorator.DeployReport,
|
||||
result.get(1),
|
||||
result.get(2)).getWidget());
|
||||
TaskbarRegister.registerTaskbarWidget(reportID, tkItem);
|
||||
} catch (Exception e) {
|
||||
GWT.log("During HTML conversion", e);
|
||||
} finally {
|
||||
Commands.unmask(UIIdentifiers.MAIN_CONTAINER_VIEWPORT_ID, UIIdentifiers.RESOURCE_DETAIL_GRID_PANEL);
|
||||
Commands.unmask(UIIdentifiers.GLOBAL_STATUS_BAR_ID);
|
||||
}
|
||||
}
|
||||
|
||||
public void onFailure(final Throwable caught) {
|
||||
MessageBox.info("Failure", "the report has not been retrieved", null);
|
||||
GWT.log("on handleGetDeploymentReport", caught);
|
||||
Commands.unmask(UIIdentifiers.MAIN_CONTAINER_VIEWPORT_ID, UIIdentifiers.RESOURCE_DETAIL_GRID_PANEL);
|
||||
Commands.unmask(UIIdentifiers.GLOBAL_STATUS_BAR_ID);
|
||||
}
|
||||
};
|
||||
}
|
|
@ -0,0 +1,590 @@
|
|||
/****************************************************************************
|
||||
* This software is part of the gCube Project.
|
||||
* Site: http://www.gcube-system.org/
|
||||
****************************************************************************
|
||||
* The gCube/gCore software is licensed as Free Open Source software
|
||||
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
* The software and documentation is provided by its authors/distributors
|
||||
* "as is" and no expressed or
|
||||
* implied warranty is given for its use, quality or fitness for a
|
||||
* particular case.
|
||||
****************************************************************************
|
||||
* Filename: Commands.java
|
||||
****************************************************************************
|
||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
||||
***************************************************************************/
|
||||
|
||||
package org.gcube.portlets.admin.resourcemanagement.client.utils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.remote.ProxyRegistry;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.views.profile.ResourceProfilePanel;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.views.resourcedetails.ResourceDetailsPanel;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.views.resourcedetails.ResourceGridFactory;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.console.ConsoleMessageBroker;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.console.ConsolePanel;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.panels.MainPanel;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.registry.UIIdentifiers;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.registry.WidgetsRegistry;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.taskbar.TaskbarItem;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.taskbar.TaskbarRegister;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.viewport.MainContainer;
|
||||
import org.gcube.portlets.admin.resourcemanagement.shared.exceptions.WidgetNotRegistered;
|
||||
import org.gcube.resourcemanagement.support.client.utils.StatusHandler;
|
||||
import org.gcube.resourcemanagement.support.client.views.ResourceTypeDecorator;
|
||||
import org.gcube.resourcemanagement.support.shared.types.Tuple;
|
||||
import org.gcube.resourcemanagement.support.shared.types.UserGroup;
|
||||
import org.gcube.resourcemanagement.support.shared.util.Configuration;
|
||||
import org.gcube.resourcemanagement.support.shared.util.DelayedOperation;
|
||||
|
||||
import com.extjs.gxt.ui.client.data.ModelData;
|
||||
import com.extjs.gxt.ui.client.widget.Component;
|
||||
import com.extjs.gxt.ui.client.widget.ContentPanel;
|
||||
import com.extjs.gxt.ui.client.widget.Dialog;
|
||||
import com.extjs.gxt.ui.client.widget.Info;
|
||||
import com.extjs.gxt.ui.client.widget.InfoConfig;
|
||||
import com.extjs.gxt.ui.client.widget.MessageBox;
|
||||
import com.extjs.gxt.ui.client.widget.ProgressBar;
|
||||
import com.extjs.gxt.ui.client.widget.Status;
|
||||
import com.extjs.gxt.ui.client.widget.Text;
|
||||
import com.extjs.gxt.ui.client.widget.grid.Grid;
|
||||
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
|
||||
/**
|
||||
* Here is a set of commands executed inside callbacks that involve
|
||||
* interactions with client-side widgets.
|
||||
* Additionally other commands are provided for general purpose functionalities
|
||||
* (e.g. refresh components, main components lookup, ...).m
|
||||
* @author Daniele Strollo (ISTI-CNR)
|
||||
*/
|
||||
public class Commands {
|
||||
|
||||
/**************************************************************************
|
||||
* COMMANDS FOR RPC REQUESTS TO THE SERVLET
|
||||
*************************************************************************/
|
||||
|
||||
public static final void refreshProgressBar() {
|
||||
final ProgressBar progress = (ProgressBar) WidgetsRegistry.getElem(UIIdentifiers.STATUS_PROGRESS_BAR_ID);
|
||||
|
||||
new DelayedOperation() {
|
||||
@Override
|
||||
public void doJob() {
|
||||
|
||||
}
|
||||
}.start(1000);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Navigation Tree for the resources in a given scope.
|
||||
* @param caller for logging reasons the caller must be passed as parameter
|
||||
* @param scope the scope for resources to retrieve
|
||||
*/
|
||||
public static final void doLoadResourceTree(final Object caller, final String scope) {
|
||||
StatusHandler.getStatus().setCurrentScope(scope);
|
||||
Commands.mask(
|
||||
"Loading Resource Tree",
|
||||
WidgetsRegistry.getPanel(UIIdentifiers.RESOURCE_NAVIGATION_PANEL).getContainer()
|
||||
);
|
||||
Commands.mask(null,
|
||||
UIIdentifiers.GLOBAL_STATUS_BAR_ID,
|
||||
UIIdentifiers.GLOBAL_MENUBAR_ID);
|
||||
ConsoleMessageBroker.info(caller, "Loading scope " + scope);
|
||||
ProxyRegistry.getProxyInstance().getResourceTypeTree(
|
||||
scope,
|
||||
Callbacks.handleLoadResourceTree);
|
||||
}
|
||||
|
||||
public static final void doLoadResourceDetailsGrid(final Object caller, final String scope, final String resourceType) {
|
||||
StatusHandler.getStatus().setCurrentScope(scope);
|
||||
StatusHandler.getStatus().setCurrentResourceType(resourceType);
|
||||
StatusHandler.getStatus().setCurrentResourceSubType(null);
|
||||
WidgetsRegistry.getPanel(UIIdentifiers.RESOURCE_DETAIL_GRID_PANEL).removeAll();
|
||||
Commands.mask(
|
||||
"Waiting for Resource Details",
|
||||
WidgetsRegistry.getPanel(UIIdentifiers.RESOURCE_NAVIGATION_PANEL).getContainer()
|
||||
);
|
||||
Commands.mask(
|
||||
"Loading Resource Details for type: " + resourceType + " in scope: " + scope,
|
||||
WidgetsRegistry.getPanel(UIIdentifiers.RESOURCE_DETAIL_GRID_PANEL).getContainer()
|
||||
);
|
||||
ProxyRegistry.getProxyInstance().getResourcesByType(
|
||||
scope,
|
||||
resourceType,
|
||||
Callbacks.handleLoadResourceDetailsGrid);
|
||||
}
|
||||
|
||||
public static final void doGetRelatedResources(final String type, final String id, final String scope) {
|
||||
ProxyRegistry.getProxyInstance().getRelatedResources(type, id, scope, new AsyncCallback<List<String>>() {
|
||||
|
||||
public void onSuccess(final List<String> result) {
|
||||
final Grid<ModelData> grid = ResourceGridFactory.createGrid(type + "Related", result, null);
|
||||
if (grid == null) {
|
||||
Commands.showPopup("Grid Creation",
|
||||
"The grid for related resource of " + type + " cannot be built",
|
||||
6000);
|
||||
}
|
||||
final Dialog dlg = new Dialog() {
|
||||
protected void onRender(final com.google.gwt.user.client.Element parent, final int pos) {
|
||||
super.onRender(parent, pos);
|
||||
this.setLayout(new FitLayout());
|
||||
this.add(grid);
|
||||
};
|
||||
};
|
||||
dlg.setSize(720, 250);
|
||||
dlg.setHideOnButtonClick(true);
|
||||
dlg.setHeading("Resource related to " + type + " " + id);
|
||||
dlg.show();
|
||||
}
|
||||
|
||||
public void onFailure(final Throwable caught) {
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public static final void doLoadWSResourceDetailsGrid(
|
||||
final Object caller,
|
||||
final String scope) {
|
||||
StatusHandler.getStatus().setCurrentScope(scope);
|
||||
StatusHandler.getStatus().setCurrentResourceType(ResourceTypeDecorator.WSResource.name());
|
||||
StatusHandler.getStatus().setCurrentResourceSubType(null);
|
||||
WidgetsRegistry.getPanel(UIIdentifiers.RESOURCE_DETAIL_GRID_PANEL).removeAll();
|
||||
Commands.mask(
|
||||
"Waiting for Resource Details",
|
||||
WidgetsRegistry.getPanel(UIIdentifiers.RESOURCE_NAVIGATION_PANEL).getContainer()
|
||||
);
|
||||
Commands.mask(
|
||||
"Loading Resource Details for type: " + ResourceTypeDecorator.WSResource.name() + " in scope: " + scope,
|
||||
WidgetsRegistry.getPanel(UIIdentifiers.RESOURCE_DETAIL_GRID_PANEL).getContainer()
|
||||
);
|
||||
ProxyRegistry.getProxyInstance().getWSResources(
|
||||
scope,
|
||||
Callbacks.handleLoadResourceDetailsGrid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters the result of resource detail grid by using its subtye.
|
||||
* @param caller
|
||||
* @param resourceSubType
|
||||
*/
|
||||
public static final void doFilterResourceDetailsGrid(
|
||||
final Object caller, final String scope, final String resourceType, final String resourceSubType) {
|
||||
StatusHandler.getStatus().setCurrentScope(scope);
|
||||
StatusHandler.getStatus().setCurrentResourceType(resourceType);
|
||||
StatusHandler.getStatus().setCurrentResourceSubType(resourceSubType);
|
||||
WidgetsRegistry.getPanel(UIIdentifiers.RESOURCE_DETAIL_GRID_PANEL).removeAll();
|
||||
Commands.mask(
|
||||
"Waiting for Resource Details",
|
||||
WidgetsRegistry.getPanel(UIIdentifiers.RESOURCE_NAVIGATION_PANEL).getContainer()
|
||||
);
|
||||
Commands.mask(
|
||||
"Filtering Resource Details for " + resourceType + "::" + resourceSubType,
|
||||
WidgetsRegistry.getPanel(UIIdentifiers.RESOURCE_DETAIL_GRID_PANEL).getContainer()
|
||||
);
|
||||
|
||||
ProxyRegistry.getProxyInstance().getResourcesBySubType(
|
||||
scope,
|
||||
resourceType,
|
||||
resourceSubType,
|
||||
Callbacks.handleFilterResourceDetailsGrid);
|
||||
}
|
||||
|
||||
public static final void doGetResourceProfileByID(final Object caller, final String scope, final String resourceID) {
|
||||
ProxyRegistry.getProxyInstance().getResourceByID(
|
||||
scope,
|
||||
null, // no type specified
|
||||
resourceID,
|
||||
Callbacks.handleGetResourceProfile);
|
||||
}
|
||||
|
||||
public static final void doGetResourceProfile(final Object caller, final String scope, String resourceType, final String resourceID) {
|
||||
/**
|
||||
* Patch (i know do not tell me about it)
|
||||
*/
|
||||
if (resourceType.compareTo("GenericResourceGenericResource") == 0) {
|
||||
resourceType = "GenericResource";
|
||||
GWT.log("resType changed to =" + resourceType);
|
||||
}
|
||||
StatusHandler.getStatus().setCurrentScope(scope);
|
||||
StatusHandler.getStatus().setCurrentResourceType(resourceType);
|
||||
Commands.mask(
|
||||
"Getting Profile details for " + FWSTranslate.getFWSNameFromLabel(resourceType) + ": " + resourceID,
|
||||
WidgetsRegistry.getPanel(UIIdentifiers.RESOURCE_DETAIL_GRID_PANEL).getContainer()
|
||||
);
|
||||
ProxyRegistry.getProxyInstance().getResourceByID(
|
||||
scope,
|
||||
resourceType,
|
||||
resourceID,
|
||||
Callbacks.handleGetResourceProfile);
|
||||
}
|
||||
|
||||
|
||||
public static final void doGetAvailableScopes(final Object caller) {
|
||||
Commands.mask("Loading scopes", UIIdentifiers.MAIN_CONTAINER_VIEWPORT_ID);
|
||||
ProxyRegistry.getProxyInstance().getAvailableScopes(Callbacks.handleGetAvailableScopes);
|
||||
}
|
||||
|
||||
public static final void buildAddToScopeReport(final Tuple<String> result) {
|
||||
if (result.size() < 4) {
|
||||
MessageBox.alert("Invalid Report Received", "Don't know why :(", null);
|
||||
Commands.unmask(UIIdentifiers.MAIN_CONTAINER_VIEWPORT_ID, UIIdentifiers.RESOURCE_DETAIL_GRID_PANEL);
|
||||
return;
|
||||
}
|
||||
|
||||
Dialog dlg = new Dialog();
|
||||
dlg.setLayout(new FitLayout());
|
||||
dlg.setHeading("XML Resource Profile");
|
||||
dlg.setModal(true);
|
||||
dlg.setWidth(800);
|
||||
dlg.setHeight(400);
|
||||
dlg.setHideOnButtonClick(true);
|
||||
// HtmlContainer htmlContainer = new HtmlContainer();
|
||||
try {
|
||||
|
||||
String reportID = result.get(0);
|
||||
// String resType = result.get(1);
|
||||
String xmlReport = result.get(2);
|
||||
String htmlReport = result.get(3);
|
||||
|
||||
//String resourceTitle = ResourceTypeDecorator.AddScopeReport.getLabel() + ": " + reportID;
|
||||
int repSoFar = TaskbarRegister.getCurrAddScopeReportsNumber() + 1;
|
||||
String resourceTitle = ResourceTypeDecorator.AddScopeReport.getLabel() + "("+repSoFar+")";
|
||||
|
||||
// This resource has already been opened
|
||||
if (TaskbarRegister.contains(reportID)) {
|
||||
TaskbarRegister.getTaskbarItem(reportID).destroy();
|
||||
Commands.showPopup("Retrieve Report", "Refreshing Report id: " +
|
||||
reportID, 3000);
|
||||
}
|
||||
MainPanel taskbarContainer = WidgetsRegistry.getPanel(UIIdentifiers.TASKBAR_PANEL);
|
||||
TaskbarItem tkItem = new TaskbarItem(
|
||||
StatusHandler.getStatus().getCurrentScope(),
|
||||
ResourceTypeDecorator.AddScopeReport,
|
||||
taskbarContainer,
|
||||
reportID,
|
||||
resourceTitle,
|
||||
"resource-profile-taskbar-item",
|
||||
ResourceTypeDecorator.DeployReport.getIcon());
|
||||
tkItem.getRelatedWindow().setMainWidget(
|
||||
new ResourceProfilePanel(
|
||||
ResourceTypeDecorator.AddScopeReport,
|
||||
xmlReport, htmlReport).getWidget());
|
||||
TaskbarRegister.registerTaskbarWidget(reportID, tkItem);
|
||||
} catch (Exception e) {
|
||||
GWT.log("During HTML conversion", e);
|
||||
} finally {
|
||||
Commands.unmask(UIIdentifiers.MAIN_CONTAINER_VIEWPORT_ID, UIIdentifiers.RESOURCE_DETAIL_GRID_PANEL);
|
||||
}
|
||||
}
|
||||
|
||||
public static final void buildRemoveFromScopeReport(final Tuple<String> result) {
|
||||
if (result.size() < 4) {
|
||||
MessageBox.alert("Invalid Report Received", "Don't know why :(", null);
|
||||
Commands.unmask(UIIdentifiers.MAIN_CONTAINER_VIEWPORT_ID, UIIdentifiers.RESOURCE_DETAIL_GRID_PANEL);
|
||||
return;
|
||||
}
|
||||
|
||||
Dialog dlg = new Dialog();
|
||||
dlg.setLayout(new FitLayout());
|
||||
dlg.setHeading("XML Resource Profile");
|
||||
dlg.setModal(true);
|
||||
dlg.setWidth(800);
|
||||
dlg.setHeight(400);
|
||||
dlg.setHideOnButtonClick(true);
|
||||
// HtmlContainer htmlContainer = new HtmlContainer();
|
||||
try {
|
||||
|
||||
String reportID = result.get(0);
|
||||
// String resType = result.get(1);
|
||||
String xmlReport = result.get(2);
|
||||
String htmlReport = result.get(3);
|
||||
|
||||
//String resourceTitle = ResourceTypeDecorator.AddScopeReport.getLabel() + ": " + reportID;
|
||||
int repSoFar = TaskbarRegister.getCurrAddScopeReportsNumber() + 1;
|
||||
String resourceTitle = ResourceTypeDecorator.RemoveScopeReport.getLabel() + "("+repSoFar+")";
|
||||
|
||||
// This resource has already been opened
|
||||
if (TaskbarRegister.contains(reportID)) {
|
||||
TaskbarRegister.getTaskbarItem(reportID).destroy();
|
||||
Commands.showPopup("Retrieve Report", "Refreshing Report id: " +
|
||||
reportID, 3000);
|
||||
}
|
||||
MainPanel taskbarContainer = WidgetsRegistry.getPanel(UIIdentifiers.TASKBAR_PANEL);
|
||||
TaskbarItem tkItem = new TaskbarItem(
|
||||
StatusHandler.getStatus().getCurrentScope(),
|
||||
ResourceTypeDecorator.RemoveScopeReport,
|
||||
taskbarContainer,
|
||||
reportID,
|
||||
resourceTitle,
|
||||
"resource-profile-taskbar-item",
|
||||
ResourceTypeDecorator.DeployReport.getIcon());
|
||||
tkItem.getRelatedWindow().setMainWidget(
|
||||
new ResourceProfilePanel(
|
||||
ResourceTypeDecorator.RemoveScopeReport,
|
||||
xmlReport, htmlReport).getWidget());
|
||||
TaskbarRegister.registerTaskbarWidget(reportID, tkItem);
|
||||
} catch (Exception e) {
|
||||
GWT.log("During HTML conversion", e);
|
||||
} finally {
|
||||
Commands.unmask(UIIdentifiers.MAIN_CONTAINER_VIEWPORT_ID, UIIdentifiers.RESOURCE_DETAIL_GRID_PANEL);
|
||||
}
|
||||
}
|
||||
|
||||
public static final void doSetSuperUser(final boolean state) {
|
||||
if (state) {
|
||||
StatusHandler.getStatus().setCredentials(UserGroup.ADMIN);
|
||||
} else {
|
||||
StatusHandler.getStatus().setCredentials(UserGroup.DEBUG);
|
||||
}
|
||||
ProxyRegistry.getProxyInstance().setSuperUser(state, new AsyncCallback<Void>() {
|
||||
public void onSuccess(final Void result) {
|
||||
ConsoleMessageBroker.info(this, "Currently super user");
|
||||
Commands.refreshResourceGrid();
|
||||
//Commands.refreshResourceTree();
|
||||
Commands.doGetAvailableScopes(Commands.class);
|
||||
}
|
||||
public void onFailure(final Throwable caught) {
|
||||
ConsoleMessageBroker.error(this, "Super user mode failed");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* GENERAL PURPOSE UTILITY COMMANDS
|
||||
*************************************************************************/
|
||||
|
||||
public static final void refreshResourceTree() {
|
||||
String scope = StatusHandler.getStatus().getCurrentScope();
|
||||
Commands.mask(
|
||||
"Loading Resource Tree",
|
||||
WidgetsRegistry.getPanel(UIIdentifiers.RESOURCE_NAVIGATION_PANEL).getContainer()
|
||||
);
|
||||
Commands.mask(null,
|
||||
UIIdentifiers.GLOBAL_STATUS_BAR_ID,
|
||||
UIIdentifiers.GLOBAL_MENUBAR_ID);
|
||||
ConsoleMessageBroker.info(Commands.class, "Loading scope " + scope);
|
||||
ProxyRegistry.getProxyInstance().getResourceTypeTree(
|
||||
scope,
|
||||
Callbacks.handleReloadResourceTree);
|
||||
}
|
||||
|
||||
public static final void refreshResourceGrid() {
|
||||
String scope = StatusHandler.getStatus().getCurrentScope();
|
||||
String resType = StatusHandler.getStatus().getCurrentResourceType();
|
||||
String resSubType = StatusHandler.getStatus().getCurrentResourceSubType();
|
||||
|
||||
if (scope != null && resType != null) {
|
||||
if (resSubType == null) {
|
||||
if (resType.equalsIgnoreCase(ResourceTypeDecorator.WSResource.name())) {
|
||||
doLoadWSResourceDetailsGrid(Commands.class.getName(),
|
||||
scope);
|
||||
} else {
|
||||
doLoadResourceDetailsGrid(Commands.class.getName(),
|
||||
scope,
|
||||
resType);
|
||||
}
|
||||
} else {
|
||||
// Has a subtype
|
||||
doFilterResourceDetailsGrid(Commands.class.getName(),
|
||||
scope,
|
||||
resType,
|
||||
resSubType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void clearResourceTreePanel() {
|
||||
MainPanel treePanel = WidgetsRegistry.getPanel(UIIdentifiers.RESOURCE_NAVIGATION_PANEL);
|
||||
Text widget = new Text();
|
||||
widget.setId("res-details-widget-fake");
|
||||
widget.setStyleName("x-panel-tree-background");
|
||||
ContentPanel cp = new ContentPanel();
|
||||
cp.setAnimCollapse(false);
|
||||
cp.setHeading("Resources");
|
||||
cp.setLayout(new FitLayout());
|
||||
cp.add(widget);
|
||||
treePanel.add(cp, true);
|
||||
}
|
||||
|
||||
public static void clearResourceGridPanel() {
|
||||
Component widget = new Text();
|
||||
widget.setId("res-details-widget-fake");
|
||||
widget.setStyleName("x-panel-cube-background");
|
||||
|
||||
WidgetsRegistry.getPanel(UIIdentifiers.RESOURCE_DETAIL_GRID_PANEL).add(widget, true);
|
||||
}
|
||||
|
||||
public static void showHideConsole() {
|
||||
Object elem = WidgetsRegistry.getElem(UIIdentifiers.CONSOLE_COMPONENT_ID);
|
||||
if (elem != null && elem instanceof Component) {
|
||||
Component console = (Component) elem;
|
||||
if (!console.isVisible()) {
|
||||
console.show();
|
||||
} else {
|
||||
console.hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static MainContainer getViewport() {
|
||||
return (MainContainer) WidgetsRegistry.getWidget(UIIdentifiers.MAIN_CONTAINER_VIEWPORT_ID);
|
||||
}
|
||||
|
||||
public static void refreshViewport() {
|
||||
MainContainer viewport = (MainContainer) WidgetsRegistry.getWidget(UIIdentifiers.MAIN_CONTAINER_VIEWPORT_ID);
|
||||
viewport.layout(true);
|
||||
}
|
||||
|
||||
public static void refreshConsole() {
|
||||
ConsolePanel console = WidgetsRegistry.getConsole();
|
||||
if (console != null) {
|
||||
console.refresh();
|
||||
}
|
||||
}
|
||||
|
||||
public static void refreshResourceDetails() {
|
||||
WidgetsRegistry.getPanel(UIIdentifiers.RESOURCE_DETAIL_GRID_PANEL).getContainer().layout(true);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static Grid<ModelData> getResourceDetailGrid() {
|
||||
Object retval = getResourceDetailPanel().getWidget();
|
||||
if (retval == null) {
|
||||
return null;
|
||||
}
|
||||
if (retval != null && retval instanceof Grid) {
|
||||
return (Grid<ModelData>) retval;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static ResourceDetailsPanel getResourceDetailPanel() {
|
||||
try {
|
||||
Object o = WidgetsRegistry.getElem(UIIdentifiers.RESOURCE_DETAIL_GRID_CONTAINER_ID, ResourceDetailsPanel.class);
|
||||
if (o != null && o instanceof ResourceDetailsPanel) {
|
||||
return (ResourceDetailsPanel) o;
|
||||
}
|
||||
return null;
|
||||
} catch (WidgetNotRegistered e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* In the status bar sets the currently selected scope.
|
||||
* @param scope
|
||||
*/
|
||||
public static void setStatusScope(final String scope) {
|
||||
try {
|
||||
Status scopeInfo = (Status) WidgetsRegistry.getWidget(UIIdentifiers.STATUS_SCOPE_INFO_ID);
|
||||
scopeInfo.setText(scope);
|
||||
|
||||
ProxyRegistry.getProxyInstance().setCurrentScope(scope, new AsyncCallback<Void>() {
|
||||
public void onSuccess(final Void result) {
|
||||
ConsoleMessageBroker.info(this, "The scope has been sent to server");
|
||||
}
|
||||
public void onFailure(final Throwable caught) {
|
||||
ConsoleMessageBroker.error(this, "The scope has not been sent to server");
|
||||
}
|
||||
});
|
||||
|
||||
} catch (Exception e) {
|
||||
ConsoleMessageBroker.error(Commands.class, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void setLoadedResources(final int number) {
|
||||
try {
|
||||
Status loadedResources = (Status) WidgetsRegistry.getWidget(UIIdentifiers.STATUS_LOADED_RESOURCES_ID);
|
||||
loadedResources.setText(String.valueOf(number));
|
||||
} catch (Exception e) {
|
||||
ConsoleMessageBroker.error(Commands.class, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* When masking the component show the rotating gear.
|
||||
* @param component the element to mask
|
||||
* @param message the message to show during loading
|
||||
*/
|
||||
public static void mask(final String message, final Component component) {
|
||||
if (component != null) {
|
||||
if (message != null) {
|
||||
component.mask(message, "loading-indicator");
|
||||
} else {
|
||||
component.mask();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void unmask(final Component component) {
|
||||
if (component != null) {
|
||||
component.unmask();
|
||||
}
|
||||
}
|
||||
|
||||
public static void mask(final String message, final String... componentIDs) {
|
||||
for (String componentID : componentIDs) {
|
||||
if (WidgetsRegistry.containsElem(componentID)) {
|
||||
try {
|
||||
if (message == null) {
|
||||
((Component) WidgetsRegistry.getWidget(componentID)).mask();
|
||||
} else {
|
||||
((Component) WidgetsRegistry.getWidget(componentID)).mask(message, "loading-indicator");
|
||||
}
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void unmask(final String... componentIDs) {
|
||||
for (String componentID : componentIDs) {
|
||||
if (WidgetsRegistry.containsElem(componentID)) {
|
||||
try {
|
||||
((Component) WidgetsRegistry.getWidget(componentID)).unmask();
|
||||
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void showPopup(final String title, final String text) {
|
||||
showPopup(title, text, Configuration.popupDelay);
|
||||
}
|
||||
|
||||
public static void showPopup(final String title, final String text, final int delayMills) {
|
||||
InfoConfig cfg = new InfoConfig(title, text);
|
||||
cfg.display = delayMills;
|
||||
Info.display(cfg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that a component is enabled for the current credentials.
|
||||
* If not it will be disabled and hidden.
|
||||
* @param w
|
||||
* @param args a list of enabled groups.
|
||||
*/
|
||||
public static final void evaluateCredentials(final Component w, final UserGroup... args) {
|
||||
if (StatusHandler.getStatus().getCredentials() == null) {
|
||||
w.setEnabled(false);
|
||||
w.hide();
|
||||
return;
|
||||
}
|
||||
for (UserGroup enabledGroup : args) {
|
||||
if (StatusHandler.getStatus().getCredentials() == enabledGroup) {
|
||||
w.setEnabled(true);
|
||||
w.show();
|
||||
return;
|
||||
}
|
||||
}
|
||||
w.setEnabled(false);
|
||||
w.hide();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package org.gcube.portlets.admin.resourcemanagement.client.utils;
|
||||
|
||||
import org.gcube.resourcemanagement.support.client.views.ResourceTypeDecorator;
|
||||
/**
|
||||
* Simply return the correspondant Feather Weight Stack label to the gCore Label
|
||||
* @author Massimiliano Assante (ISTI-CNR)
|
||||
*
|
||||
*/
|
||||
public class FWSTranslate {
|
||||
/**
|
||||
*
|
||||
* @param gCoreLabel
|
||||
* @return the Feather Weight Stack label if present, the same label otherwise
|
||||
*/
|
||||
public static String getFWSNameFromLabel(String gCoreLabel) {
|
||||
ResourceTypeDecorator[] toCheck = ResourceTypeDecorator.values();
|
||||
for (int i = 0; i < toCheck.length; i++) {
|
||||
if (gCoreLabel.compareTo(toCheck[i].name()) == 0)
|
||||
return toCheck[i].getFWSName();
|
||||
}
|
||||
return gCoreLabel;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
/****************************************************************************
|
||||
* This software is part of the gCube Project.
|
||||
* Site: http://www.gcube-system.org/
|
||||
****************************************************************************
|
||||
* The gCube/gCore software is licensed as Free Open Source software
|
||||
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
* The software and documentation is provided by its authors/distributors
|
||||
* "as is" and no expressed or
|
||||
* implied warranty is given for its use, quality or fitness for a
|
||||
* particular case.
|
||||
****************************************************************************
|
||||
* Filename: Messages.java
|
||||
****************************************************************************
|
||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
||||
***************************************************************************/
|
||||
|
||||
package org.gcube.portlets.admin.resourcemanagement.client.utils;
|
||||
|
||||
/**
|
||||
* @author Daniele Strollo (ISTI-CNR)
|
||||
*
|
||||
*/
|
||||
public class Messages {
|
||||
public static final String UPDATE_SW_REPOSITORY_FAILURE = "You are not allowed to require the Software Repository Upgrade.";
|
||||
public static final String UPDATE_SW_REPOSITORY_INSERT_URL = "Insert the URL for upgrade description.";
|
||||
public static final String NO_SCOPE_SELECTED = "No current scope selected.";
|
||||
}
|
|
@ -0,0 +1,346 @@
|
|||
/****************************************************************************
|
||||
* This software is part of the gCube Project.
|
||||
* Site: http://www.gcube-system.org/
|
||||
****************************************************************************
|
||||
* The gCube/gCore software is licensed as Free Open Source software
|
||||
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
* The software and documentation is provided by its authors/distributors
|
||||
* "as is" and no expressed or
|
||||
* implied warranty is given for its use, quality or fitness for a
|
||||
* particular case.
|
||||
****************************************************************************
|
||||
* Filename: CommonOperations.java
|
||||
****************************************************************************
|
||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
||||
***************************************************************************/
|
||||
|
||||
package org.gcube.portlets.admin.resourcemanagement.client.utils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.forms.genericresources.GenericResourceForm;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.remote.ProxyRegistry;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.console.ConsoleMessageBroker;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.registry.UIIdentifiers;
|
||||
import org.gcube.resourcemanagement.support.client.utils.StatusHandler;
|
||||
import org.gcube.resourcemanagement.support.client.views.ResourceTypeDecorator;
|
||||
import org.gcube.resourcemanagement.support.shared.exceptions.InvalidParameterException;
|
||||
import org.gcube.resourcemanagement.support.shared.operations.SupportedOperations;
|
||||
import org.gcube.resourcemanagement.support.shared.types.datamodel.ResourceDescriptor;
|
||||
import org.gcube.resourcemanagement.support.shared.util.DelayedOperation;
|
||||
|
||||
import com.extjs.gxt.ui.client.data.ModelData;
|
||||
import com.extjs.gxt.ui.client.event.Listener;
|
||||
import com.extjs.gxt.ui.client.event.MessageBoxEvent;
|
||||
import com.extjs.gxt.ui.client.widget.MessageBox;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
|
||||
|
||||
class OpCallBacks {
|
||||
|
||||
public static final AsyncCallback<Void> handleGenericOperation(final SupportedOperations op) {
|
||||
return new AsyncCallback<Void>() {
|
||||
public void onSuccess(final Void result) {
|
||||
MessageBox.info("Managing resources", "The operation " + op.name() + " has been <b>successfully</b> executed.", null);
|
||||
if (op == SupportedOperations.GENERIC_RESOURCE_DELETE ||
|
||||
op == SupportedOperations.COLLECTION_DELETE) {
|
||||
Commands.refreshResourceGrid();
|
||||
}
|
||||
}
|
||||
|
||||
public void onFailure(final Throwable caught) {
|
||||
MessageBox.info("Managing resources", "The operation " + op.name() + " has <b>failed</b>." +
|
||||
((caught != null) ? "<br/>" + caught.getMessage() : "") +
|
||||
"<br/>See server log for further details.", null);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Here the commands for operations on resources.
|
||||
* @author Daniele Strollo (ISTI-CNR)
|
||||
*
|
||||
*/
|
||||
public class OpCommands {
|
||||
|
||||
/*************************************************************
|
||||
* GHN
|
||||
************************************************************/
|
||||
|
||||
public static final void doShutdownGHNs(final List<ModelData> ghns) {
|
||||
List<ResourceDescriptor> toSend = new Vector<ResourceDescriptor>();
|
||||
for (ModelData rawData : ghns) {
|
||||
try {
|
||||
toSend.add(new ResourceDescriptor(
|
||||
((Object) rawData.get("Type")).toString(),
|
||||
null, // The subType is not required here
|
||||
((Object) rawData.get("ID")).toString(),
|
||||
((Object) rawData.get("Name")).toString()));
|
||||
} catch (InvalidParameterException e) {
|
||||
Commands.showPopup("Cannot shutdown GHN", e.getMessage());
|
||||
}
|
||||
}
|
||||
try {
|
||||
ProxyRegistry.getProxyInstance().doOperation(
|
||||
SupportedOperations.GHN_SHUTDOWN,
|
||||
StatusHandler.getStatus().getCurrentScope(),
|
||||
toSend,
|
||||
OpCallBacks.handleGenericOperation(SupportedOperations.GHN_SHUTDOWN)
|
||||
);
|
||||
} catch (Exception e) {
|
||||
ConsoleMessageBroker.error(OpCommands.class, e.getMessage());
|
||||
MessageBox.info(
|
||||
"Failure",
|
||||
"the GHNs cannot be shut down",
|
||||
null);
|
||||
}
|
||||
}
|
||||
|
||||
public static final void doRestartGHNs(final List<ModelData> ghns, final boolean clean) {
|
||||
List<ResourceDescriptor> toSend = new Vector<ResourceDescriptor>();
|
||||
for (ModelData rawData : ghns) {
|
||||
try {
|
||||
toSend.add(new ResourceDescriptor(
|
||||
((Object) rawData.get("Type")).toString(),
|
||||
null, // The subType is not required here
|
||||
((Object) rawData.get("ID")).toString(),
|
||||
((Object) rawData.get("Name")).toString()));
|
||||
} catch (InvalidParameterException e) {
|
||||
Commands.showPopup("Cannot restart GHN", e.getMessage());
|
||||
}
|
||||
}
|
||||
try {
|
||||
ProxyRegistry.getProxyInstance().doOperation(
|
||||
((clean) ? SupportedOperations.GHN_CLEAN_RESTART : SupportedOperations.GHN_RESTART),
|
||||
StatusHandler.getStatus().getCurrentScope(),
|
||||
toSend,
|
||||
OpCallBacks.handleGenericOperation(SupportedOperations.GHN_RESTART)
|
||||
);
|
||||
} catch (Exception e) {
|
||||
ConsoleMessageBroker.error(OpCommands.class, e.getMessage());
|
||||
MessageBox.info(
|
||||
"Failure",
|
||||
"the GHNs cannot be restarted",
|
||||
null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************
|
||||
* DELETE RESOURCE
|
||||
************************************************************/
|
||||
public static final void doDeleteItems(
|
||||
final ResourceTypeDecorator type,
|
||||
final List<ModelData> items,
|
||||
final SupportedOperations requiredPermissions) {
|
||||
List<ResourceDescriptor> toSend = new Vector<ResourceDescriptor>();
|
||||
for (ModelData rawData : items) {
|
||||
try {
|
||||
toSend.add(new ResourceDescriptor(
|
||||
((Object) rawData.get("Type")).toString(),
|
||||
null, // The subType is not required here
|
||||
((Object) rawData.get("ID")).toString(),
|
||||
((Object) rawData.get("Name")).toString()));
|
||||
} catch (InvalidParameterException e) {
|
||||
Commands.showPopup("Cannot delete " + type.name(), e.getMessage());
|
||||
}
|
||||
}
|
||||
try {
|
||||
ProxyRegistry.getProxyInstance().doOperation(
|
||||
requiredPermissions,
|
||||
StatusHandler.getStatus().getCurrentScope(),
|
||||
toSend,
|
||||
OpCallBacks.handleGenericOperation(requiredPermissions)
|
||||
);
|
||||
} catch (Exception e) {
|
||||
ConsoleMessageBroker.error(OpCommands.class, e.getMessage());
|
||||
MessageBox.info(
|
||||
"Failure",
|
||||
"the selected " + type.name() + "(s) cannot be deleted",
|
||||
null);
|
||||
}
|
||||
}
|
||||
|
||||
/*************************************************************
|
||||
* SERVICE ENDPOINT
|
||||
************************************************************/
|
||||
public static final void doOpenServiceEndpointForm() {
|
||||
if (SupportedOperations.GENERIC_RESOURCE_CREATE.isAllowed(StatusHandler.getStatus().getCredentials())) {
|
||||
loadServiceEndopointEditor(null);
|
||||
} else {
|
||||
MessageBox.alert("Service Endpoint Creation", "You are not allowed to execute this operation", null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************
|
||||
* GENERIC RESOURCE
|
||||
************************************************************/
|
||||
public static final void doOpenGenericResourceForm() {
|
||||
if (SupportedOperations.GENERIC_RESOURCE_CREATE.isAllowed(StatusHandler.getStatus().getCredentials())) {
|
||||
new GenericResourceForm().show();
|
||||
} else {
|
||||
MessageBox.alert("Generic Resource Creation", "You are not allowed to execute this operation", null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static final void doCreateGenericResource(
|
||||
final String id,
|
||||
final String name,
|
||||
final String description,
|
||||
final String body,
|
||||
final String subType) {
|
||||
if (SupportedOperations.GENERIC_RESOURCE_CREATE.isAllowed(StatusHandler.getStatus().getCredentials())) {
|
||||
ProxyRegistry.getProxyInstance().createGenericResource(id, name, description, body, subType,
|
||||
new AsyncCallback<String>() {
|
||||
public void onSuccess(final String result) {
|
||||
MessageBox.info("Generic Resouce Creation",
|
||||
"The generic resource " + name + " has been created with ID: <br/>" + result,
|
||||
null);
|
||||
new DelayedOperation() {
|
||||
@Override
|
||||
public void doJob() {
|
||||
Commands.refreshResourceGrid();
|
||||
}
|
||||
}
|
||||
.start(3000);
|
||||
|
||||
}
|
||||
public void onFailure(final Throwable caught) {
|
||||
MessageBox.alert("Generic Resouce Creation",
|
||||
"Generic Resource Creation failure: <br/>" +
|
||||
((caught != null && caught.getMessage() != null) ?
|
||||
caught.getMessage() :
|
||||
"See server log for further details."),
|
||||
null);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
MessageBox.alert("Generic Resource Creation", "You are not allowed to execute this operation", null);
|
||||
}
|
||||
}
|
||||
|
||||
public static final void doEditGenericResource(
|
||||
final String id,
|
||||
final String name,
|
||||
final String description,
|
||||
final String body,
|
||||
final String subType) {
|
||||
if (SupportedOperations.GENERIC_RESOURCE_EDIT.isAllowed(StatusHandler.getStatus().getCredentials())) {
|
||||
ProxyRegistry.getProxyInstance().updateGenericResource(id, name, description, body, subType,
|
||||
new AsyncCallback<Void>() {
|
||||
public void onSuccess(final Void result) {
|
||||
MessageBox.info("Generic Resouce Creation",
|
||||
"The generic resource " + name + " has been updated",
|
||||
null);
|
||||
Commands.refreshResourceGrid();
|
||||
}
|
||||
public void onFailure(final Throwable caught) {
|
||||
MessageBox.alert("Generic Resouce Creation",
|
||||
"Generic Resource Creation failure: <br/>" +
|
||||
((caught != null && caught.getMessage() != null) ?
|
||||
caught.getMessage() :
|
||||
"See server log for further details."),
|
||||
null);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
MessageBox.alert("Generic Resource Creation", "You are not allowed to execute this operation", null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************
|
||||
* SERVICE
|
||||
************************************************************/
|
||||
public static final void doOpenServiceForm() {
|
||||
if (SupportedOperations.SERVICE_CREATE.isAllowed(StatusHandler.getStatus().getCredentials())) {
|
||||
MessageBox.alert("Service Creation", "To implement", null);
|
||||
} else {
|
||||
MessageBox.alert("Service Creation", "You are not allowed to execute this operation", null);
|
||||
}
|
||||
}
|
||||
|
||||
public static final void doGetDeployReport() {
|
||||
if (SupportedOperations.SERVICE_GET_REPORT.isAllowed(StatusHandler.getStatus().getCredentials())) {
|
||||
Commands.mask("Requesting deployment report", UIIdentifiers.MAIN_CONTAINER_VIEWPORT_ID);
|
||||
MessageBox.prompt("Deployment Report Request", "Insert Report ID", false, new Listener<MessageBoxEvent>() {
|
||||
public void handleEvent(final MessageBoxEvent be) {
|
||||
String reportID = be.getValue();
|
||||
if (reportID != null && reportID.trim().length() > 0) {
|
||||
ProxyRegistry.getProxyInstance().checkDeployStatus(
|
||||
reportID.trim(),
|
||||
StatusHandler.getStatus().getCurrentScope(),
|
||||
Callbacks.handleGetDeploymentReport);
|
||||
} else {
|
||||
Commands.unmask(UIIdentifiers.MAIN_CONTAINER_VIEWPORT_ID);
|
||||
Commands.showPopup("Wrong input", "Invalid input.", 4000);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public static final void doGetResourceByID() {
|
||||
if (SupportedOperations.SERVICE_GET_REPORT.isAllowed(StatusHandler.getStatus().getCredentials())) {
|
||||
MessageBox.prompt("Lookup Resource", "Insert Resource ID", false, new Listener<MessageBoxEvent>() {
|
||||
public void handleEvent(final MessageBoxEvent be) {
|
||||
String reportID = be.getValue();
|
||||
if (reportID != null && reportID.trim().length() > 0) {
|
||||
Commands.doGetResourceProfileByID(this, StatusHandler.getStatus().getCurrentScope(), reportID.trim());
|
||||
} else {
|
||||
Commands.unmask(UIIdentifiers.MAIN_CONTAINER_VIEWPORT_ID);
|
||||
Commands.showPopup("Wrong input", "Invalid input.", 4000);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Redirect to Service Endpoint Editor
|
||||
* @param idToEdit
|
||||
*/
|
||||
public static void loadServiceEndopointEditor(String idToEdit) {
|
||||
|
||||
String location = Window.Location.getHref();
|
||||
String res2EditParam = "";
|
||||
if (idToEdit != null) {
|
||||
res2EditParam = "&rid=" + idToEdit;
|
||||
}
|
||||
|
||||
if (location.endsWith("/") || location.endsWith("#")) { //standalone
|
||||
location = location.substring(0, location.length()-2);
|
||||
}
|
||||
|
||||
location += "/../runtime-resource?pid=126&lifecycle=0&state=maximized&modes=view&doAsId=10136&refererPlid=10139&authzToken=101334249"
|
||||
+ "&curscope="+StatusHandler.getStatus().getCurrentScope()+res2EditParam;
|
||||
|
||||
//Window.open(location, "_blank", "");
|
||||
openNewWindow("Service Endpoint Editor", location);
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens a new windows with a specified URL..
|
||||
*
|
||||
* @param name String with the name of the window.
|
||||
* @param url String with your URL.
|
||||
*/
|
||||
public static void openNewWindow(String name, String url) {
|
||||
com.google.gwt.user.client.Window.open(url, name.replace(" ", "_"),
|
||||
"menubar=no," +
|
||||
"location=false," +
|
||||
"resizable=yes," +
|
||||
"scrollbars=yes," +
|
||||
"status=no," +
|
||||
"dependent=true");
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
/****************************************************************************
|
||||
* This software is part of the gCube Project.
|
||||
* Site: http://www.gcube-system.org/
|
||||
****************************************************************************
|
||||
* The gCube/gCore software is licensed as Free Open Source software
|
||||
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
* The software and documentation is provided by its authors/distributors
|
||||
* "as is" and no expressed or
|
||||
* implied warranty is given for its use, quality or fitness for a
|
||||
* particular case.
|
||||
****************************************************************************
|
||||
* Filename: ResourceProfilePanel.java
|
||||
****************************************************************************
|
||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
||||
***************************************************************************/
|
||||
|
||||
package org.gcube.portlets.admin.resourcemanagement.client.views.profile;
|
||||
|
||||
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.panels.GenericTreePanel;
|
||||
import org.gcube.resourcemanagement.support.client.views.ResourceTypeDecorator;
|
||||
|
||||
import com.extjs.gxt.ui.client.Style.Scroll;
|
||||
import com.extjs.gxt.ui.client.data.ModelData;
|
||||
import com.extjs.gxt.ui.client.widget.Component;
|
||||
import com.extjs.gxt.ui.client.widget.Html;
|
||||
import com.extjs.gxt.ui.client.widget.TabItem;
|
||||
import com.extjs.gxt.ui.client.widget.TabPanel;
|
||||
import com.extjs.gxt.ui.client.widget.treepanel.TreePanel;
|
||||
|
||||
/**
|
||||
* @author Daniele Strollo (ISTI-CNR)
|
||||
*
|
||||
*/
|
||||
public class ResourceProfilePanel extends TabPanel {
|
||||
private String htmlProfile = null;
|
||||
private String xmlProfile = null;
|
||||
private static int counter = 0;
|
||||
private ResourceTypeDecorator type = null;
|
||||
|
||||
public ResourceProfilePanel(final ResourceTypeDecorator type, final String xmlProfile, final String htmlProfile) {
|
||||
super();
|
||||
this.xmlProfile = xmlProfile;
|
||||
this.htmlProfile = htmlProfile;
|
||||
this.type = type;
|
||||
this.init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
this.setId("resource-profile-panel-" + counter++);
|
||||
|
||||
this.setPlain(true);
|
||||
this.setHeight("100%");
|
||||
|
||||
TabItem xmlProfilePanel = new TabItem("XML Profile");
|
||||
//xmlProfilePanel.setScrollMode(Scroll.AUTO);
|
||||
|
||||
TreePanel<ModelData> treepanel = null;
|
||||
// depending on the resource to show the root node will be declared
|
||||
if (this.type == ResourceTypeDecorator.WSResource) {
|
||||
treepanel = new GenericTreePanel(xmlProfile, "Document").getWidget();
|
||||
}
|
||||
else if (this.type == ResourceTypeDecorator.DeployReport) {
|
||||
treepanel = new GenericTreePanel(xmlProfile, "ResourceReport").getWidget();
|
||||
}
|
||||
else if (this.type == ResourceTypeDecorator.AddScopeReport) {
|
||||
treepanel = new GenericTreePanel(xmlProfile, "ResourceReport").getWidget();
|
||||
}
|
||||
else {
|
||||
treepanel = new GenericTreePanel(xmlProfile, "Resource").getWidget();
|
||||
}
|
||||
xmlProfilePanel.add(treepanel);
|
||||
xmlProfilePanel.layout(true);
|
||||
|
||||
xmlProfilePanel.setScrollMode(Scroll.AUTO);
|
||||
|
||||
this.add(xmlProfilePanel);
|
||||
|
||||
TabItem htmlProfilePanel = new TabItem("Source");
|
||||
//xmlProfilePanel.setScrollMode(Scroll.AUTO);
|
||||
|
||||
Html htmlContainer = new Html();
|
||||
htmlContainer.setId("xml-container-" + counter);
|
||||
htmlContainer.setHtml(htmlProfile);
|
||||
htmlContainer.setAutoHeight(true);
|
||||
|
||||
htmlProfilePanel.add(htmlContainer);
|
||||
htmlProfilePanel.layout(true);
|
||||
htmlProfilePanel.setScrollMode(Scroll.AUTO);
|
||||
|
||||
this.add(htmlProfilePanel);
|
||||
}
|
||||
|
||||
public final Component getWidget() {
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,696 @@
|
|||
/****************************************************************************
|
||||
* This software is part of the gCube Project.
|
||||
* Site: http://www.gcube-system.org/
|
||||
****************************************************************************
|
||||
* The gCube/gCore software is licensed as Free Open Source software
|
||||
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
* The software and documentation is provided by its authors/distributors
|
||||
* "as is" and no expressed or
|
||||
* implied warranty is given for its use, quality or fitness for a
|
||||
* particular case.
|
||||
****************************************************************************
|
||||
* Filename: ContextMenuFactory.java
|
||||
****************************************************************************
|
||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
||||
***************************************************************************/
|
||||
|
||||
package org.gcube.portlets.admin.resourcemanagement.client.views.resourcedetails;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.forms.genericresources.GenericResourceForm;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.remote.ProxyRegistry;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.utils.Commands;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.utils.OpCommands;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.console.ConsoleMessageBroker;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.registry.UIIdentifiers;
|
||||
import org.gcube.resourcemanagement.support.client.utils.StatusHandler;
|
||||
import org.gcube.resourcemanagement.support.client.views.ResourceTypeDecorator;
|
||||
import org.gcube.resourcemanagement.support.shared.operations.SupportedOperations;
|
||||
import org.gcube.resourcemanagement.support.shared.types.Tuple;
|
||||
import org.gcube.resourcemanagement.support.shared.types.datamodel.ResourceDescriptor;
|
||||
import org.gcube.resourcemanagement.support.shared.types.datamodel.ResourceDetailModel;
|
||||
|
||||
import com.extjs.gxt.ui.client.data.ModelData;
|
||||
import com.extjs.gxt.ui.client.event.ComponentEvent;
|
||||
import com.extjs.gxt.ui.client.event.Listener;
|
||||
import com.extjs.gxt.ui.client.event.MessageBoxEvent;
|
||||
import com.extjs.gxt.ui.client.widget.MessageBox;
|
||||
import com.extjs.gxt.ui.client.widget.menu.Menu;
|
||||
import com.extjs.gxt.ui.client.widget.menu.MenuItem;
|
||||
import com.extjs.gxt.ui.client.widget.menu.SeparatorMenuItem;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
|
||||
/**
|
||||
* @author Daniele Strollo
|
||||
* @author Massimiliano Assante (ISTI-CNR)
|
||||
* @version 2.0 Feb 2012
|
||||
*/
|
||||
public class ContextMenuFactory {
|
||||
private static final ContextMenuFactory INSTANCE = new ContextMenuFactory();
|
||||
|
||||
public static ContextMenuFactory getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public final synchronized Menu buildContextMenu(final String resType, final ResourceDetailsPanel container) {
|
||||
|
||||
Menu menu = new Menu();
|
||||
/*************************************************************
|
||||
* FOR ALL RESOURCES
|
||||
************************************************************/
|
||||
|
||||
MenuItem getProfile = new MenuItem("Retrieve Profile") {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent be) {
|
||||
super.onClick(be);
|
||||
List<ModelData> selectedElems = container.getSelection();
|
||||
for (ModelData selectedElem : selectedElems) {
|
||||
String type = ((Object) selectedElem.get("Type")).toString();
|
||||
String resID = ((Object) selectedElem.get("ID")).toString();
|
||||
String scope = StatusHandler.getStatus().getCurrentScope();
|
||||
Commands.doGetResourceProfile(this, scope, type, resID);
|
||||
}
|
||||
}
|
||||
};
|
||||
getProfile.setIconStyle("profile-icon");
|
||||
menu.add(getProfile);
|
||||
|
||||
MenuItem getErrors = new MenuItem("Validate") {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent be) {
|
||||
super.onClick(be);
|
||||
List<ModelData> selectedElems = container.getSelection();
|
||||
for (ModelData selectedElem : selectedElems) {
|
||||
boolean isValid = true;
|
||||
String[] reqs = ResourceDetailModel.getRequiredFields(((Object) selectedElem.get("Type")).toString());
|
||||
|
||||
for (String req : reqs) {
|
||||
if (selectedElem.get(req) == null || ((Object) selectedElem.get(req)).toString().trim().length() == 0) {
|
||||
isValid = false;
|
||||
// Adds to the model with problems the error code
|
||||
Commands.showPopup("Validation: Failure", "The value for field <b><i>" + req + "</i></b> is invalid");
|
||||
}
|
||||
}
|
||||
|
||||
if (isValid) {
|
||||
Commands.showPopup("Validation: Success", "The current element is valid", 6000);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
getErrors.setIconStyle("validate-icon");
|
||||
menu.add(getErrors);
|
||||
|
||||
|
||||
|
||||
MenuItem addToScope = new MenuItem("Add To Scope");
|
||||
final Menu addToScopeSub = new Menu();
|
||||
final Menu removeFromScopeSub = new Menu();
|
||||
|
||||
ProxyRegistry.getProxyInstance().getAvailableAddScopes(new AsyncCallback<List<String>>() {
|
||||
|
||||
public void onSuccess(final List<String> result) {
|
||||
for (final String scope : result) {
|
||||
/*
|
||||
* REMOVE FROM SCOPE RPC
|
||||
*/
|
||||
removeFromScopeSub.add(new MenuItem(scope) {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent be) {
|
||||
super.onClick(be);
|
||||
Commands.mask("Applying remove scope", UIIdentifiers.MAIN_CONTAINER_VIEWPORT_ID);
|
||||
List<ModelData> selectedElems = container.getSelection();
|
||||
String resType = null;
|
||||
List<String> resourceIDs = new Vector<String>();
|
||||
|
||||
// Builds the list of IDs to add to scope
|
||||
for (ModelData selectedElem : selectedElems) {
|
||||
if (resType == null) {
|
||||
resType = ((Object) selectedElem.get("Type")).toString();
|
||||
}
|
||||
resourceIDs.add(((Object) selectedElem.get("ID")).toString());
|
||||
|
||||
ConsoleMessageBroker.info(this,
|
||||
"Removing ID: " + ((Object) selectedElem.get("ID")).toString() +
|
||||
" type: " + ((Object) selectedElem.get("Type")).toString() +
|
||||
" to scope: " + scope
|
||||
);
|
||||
}
|
||||
|
||||
ProxyRegistry.getProxyInstance().removeResourcesFromScope(resType, resourceIDs, scope,
|
||||
new AsyncCallback<Tuple<String>>() {
|
||||
public void onSuccess(final Tuple<String> result) {
|
||||
Commands.unmask(UIIdentifiers.MAIN_CONTAINER_VIEWPORT_ID);
|
||||
if (result != null) {
|
||||
MessageBox.info("Remove from Scope",
|
||||
"The required remove from scope operation has been applied.<br/>" +
|
||||
"The generated report ID is:<br/>" +
|
||||
"<b>" + result.get(0) + "</b>",
|
||||
null);
|
||||
Commands.buildRemoveFromScopeReport(result);
|
||||
}
|
||||
else {
|
||||
MessageBox.alert("Remove from Scope",
|
||||
"The required remove from scope operation has NOT been applied.<br/>" +
|
||||
"",
|
||||
null);
|
||||
}
|
||||
|
||||
}
|
||||
public void onFailure(final Throwable caught) {
|
||||
Commands.unmask(UIIdentifiers.MAIN_CONTAINER_VIEWPORT_ID);
|
||||
MessageBox.alert(
|
||||
"Remove form Scope error",
|
||||
"The required operation has not been applied due to server error: <br/>" + caught.getMessage(),
|
||||
null);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
/*
|
||||
* ADD TO SCOPE RPC
|
||||
*/
|
||||
|
||||
addToScopeSub.add(new MenuItem(scope) {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent be) {
|
||||
super.onClick(be);
|
||||
Commands.mask("Applying add scope", UIIdentifiers.MAIN_CONTAINER_VIEWPORT_ID);
|
||||
List<ModelData> selectedElems = container.getSelection();
|
||||
String resType = null;
|
||||
List<String> resourceIDs = new Vector<String>();
|
||||
|
||||
// Builds the list of IDs to add to scope
|
||||
for (ModelData selectedElem : selectedElems) {
|
||||
if (resType == null) {
|
||||
resType = ((Object) selectedElem.get("Type")).toString();
|
||||
}
|
||||
resourceIDs.add(((Object) selectedElem.get("ID")).toString());
|
||||
|
||||
ConsoleMessageBroker.info(this,
|
||||
"Adding ID: " + ((Object) selectedElem.get("ID")).toString() +
|
||||
" type: " + ((Object) selectedElem.get("Type")).toString() +
|
||||
" to scope: " + scope
|
||||
);
|
||||
}
|
||||
|
||||
ProxyRegistry.getProxyInstance().addResourcesToScope(resType, resourceIDs, scope,
|
||||
new AsyncCallback<Tuple<String>>() {
|
||||
public void onSuccess(final Tuple<String> result) {
|
||||
Commands.unmask(UIIdentifiers.MAIN_CONTAINER_VIEWPORT_ID);
|
||||
if (result != null) {
|
||||
MessageBox.info("Add to Scope",
|
||||
"The required add to scope operation has been applied.<br/>" +
|
||||
"The generated report ID is:<br/>" +
|
||||
"<b>" + result.get(0) + "</b>",
|
||||
null);
|
||||
Commands.buildAddToScopeReport(result);
|
||||
} else {
|
||||
MessageBox.alert("Add to Scope",
|
||||
"The required add to scope operation has been applied.<br/>" +
|
||||
"But the resulting report ID is null or invalid.",
|
||||
null);
|
||||
}
|
||||
}
|
||||
public void onFailure(final Throwable caught) {
|
||||
Commands.unmask(UIIdentifiers.MAIN_CONTAINER_VIEWPORT_ID);
|
||||
MessageBox.alert(
|
||||
"Add to Scope error",
|
||||
"The required operation has not been applied: <br/>" + caught.getMessage(),
|
||||
null);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void onFailure(final Throwable caught) {
|
||||
Commands.unmask(UIIdentifiers.MAIN_CONTAINER_VIEWPORT_ID, UIIdentifiers.RESOURCE_DETAIL_GRID_PANEL);
|
||||
}
|
||||
});
|
||||
addToScope.setSubMenu(addToScopeSub);
|
||||
Commands.evaluateCredentials(
|
||||
addToScope,
|
||||
SupportedOperations.ADD_TO_SCOPE.getPermissions());
|
||||
addToScope.setIconStyle("addtoscope-icon");
|
||||
menu.add(addToScope);
|
||||
|
||||
/*************************************************************
|
||||
* REMOVE FROM SCOPE
|
||||
************************************************************/
|
||||
MenuItem removeFromScope = new MenuItem("Remove From Scope");
|
||||
removeFromScope.setSubMenu(removeFromScopeSub);
|
||||
Commands.evaluateCredentials(
|
||||
removeFromScope,
|
||||
SupportedOperations.ADD_TO_SCOPE.getPermissions());
|
||||
removeFromScope.setIconStyle("removefromscope-icon");
|
||||
menu.add(removeFromScope);
|
||||
|
||||
/*************************************************************
|
||||
* GHN
|
||||
************************************************************/
|
||||
if (resType.equals(ResourceTypeDecorator.GHN.name())) {
|
||||
|
||||
// 0 - GETRELATED button
|
||||
MenuItem getRelated = new MenuItem("Get Related") {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent be) {
|
||||
super.onClick(be);
|
||||
Commands.doGetRelatedResources(ResourceTypeDecorator.GHN.name(),
|
||||
((Object) container.getSelection().get(0).get("ID")).toString(),
|
||||
StatusHandler.getStatus().getCurrentScope());
|
||||
}
|
||||
};
|
||||
getRelated.setIconStyle("link-icon");
|
||||
menu.add(getRelated);
|
||||
|
||||
// 0 - DELETE button
|
||||
menu.add(this.createSeparator(SupportedOperations.GHN_DELETE));
|
||||
menu.add(this.createDeleteButton(
|
||||
container,
|
||||
ResourceTypeDecorator.GHN,
|
||||
SupportedOperations.GHN_DELETE));
|
||||
|
||||
// 1 - Force DELETE button
|
||||
menu.add(this.createForceDeleteButton(
|
||||
container,
|
||||
ResourceTypeDecorator.GHN,
|
||||
SupportedOperations.GHN_FORCE_DELETE));
|
||||
|
||||
// 1 - RESTART
|
||||
menu.add(this.createSeparator(SupportedOperations.GHN_RESTART));
|
||||
|
||||
MenuItem restart = new MenuItem("Restart") {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent be) {
|
||||
super.onClick(be);
|
||||
MessageBox.confirm("GHN Restart", "Are you sure you want to restart the selected GHN(s)?",
|
||||
new Listener<MessageBoxEvent>() {
|
||||
public void handleEvent(final MessageBoxEvent be) {
|
||||
|
||||
if (be.getButtonClicked().getItemId().equalsIgnoreCase("yes")) {
|
||||
// - THE OPERATION IF CONFIRMED
|
||||
for (ModelData e : container.getSelection()) {
|
||||
ConsoleMessageBroker.info(this, "Required restart for: " + e.get("Name") + " " + e.get("ID"));
|
||||
}
|
||||
OpCommands.doRestartGHNs(container.getSelection(), false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
Commands.evaluateCredentials(
|
||||
restart,
|
||||
SupportedOperations.GHN_RESTART.getPermissions());
|
||||
restart.setIconStyle("restart-icon");
|
||||
menu.add(restart);
|
||||
|
||||
// 2 - CLEAN RESTART
|
||||
MenuItem cleanRestart = new MenuItem("Clean & Restart") {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent be) {
|
||||
super.onClick(be);
|
||||
MessageBox.confirm("GHN Restart", "Are you sure you want to clean and restart the selected GHN(s)?",
|
||||
new Listener<MessageBoxEvent>() {
|
||||
public void handleEvent(final MessageBoxEvent be) {
|
||||
|
||||
if (be.getButtonClicked().getItemId().equalsIgnoreCase("yes")) {
|
||||
// - THE OPERATION IF CONFIRMED
|
||||
for (ModelData e : container.getSelection()) {
|
||||
ConsoleMessageBroker.info(this, "Required restart for: " + e.get("Name") + " " + e.get("ID"));
|
||||
}
|
||||
OpCommands.doRestartGHNs(container.getSelection(), true);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
Commands.evaluateCredentials(
|
||||
cleanRestart,
|
||||
SupportedOperations.GHN_CLEAN_RESTART.getPermissions());
|
||||
cleanRestart.setIconStyle("clean-restart-icon");
|
||||
menu.add(cleanRestart);
|
||||
|
||||
// 3 - SHUTDOWN
|
||||
MenuItem shutdown = new MenuItem("Shutdown") {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent be) {
|
||||
super.onClick(be);
|
||||
MessageBox.confirm("GHN Shutdown", "Are you sure you want to shut down the selected GHN(s)?",
|
||||
new Listener<MessageBoxEvent>() {
|
||||
public void handleEvent(final MessageBoxEvent be) {
|
||||
|
||||
if (be.getButtonClicked().getItemId().equalsIgnoreCase("yes")) {
|
||||
// - THE OPERATION IF CONFIRMED
|
||||
for (ModelData e : container.getSelection()) {
|
||||
ConsoleMessageBroker.info(this, "Required shutdown for: " + e.get("Name") + " " + e.get("ID"));
|
||||
}
|
||||
OpCommands.doShutdownGHNs(container.getSelection());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
Commands.evaluateCredentials(
|
||||
shutdown,
|
||||
SupportedOperations.GHN_SHUTDOWN.getPermissions());
|
||||
shutdown.setIconStyle("shutdown-icon");
|
||||
menu.add(shutdown);
|
||||
} // - ENDOF GHN
|
||||
|
||||
|
||||
/*************************************************************
|
||||
* RUNNING INSTANCE
|
||||
************************************************************/
|
||||
if (resType.equals(ResourceTypeDecorator.RunningInstance.name())) {
|
||||
// 0 - GETRELATED button
|
||||
MenuItem getRelated = new MenuItem("Get Related") {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent be) {
|
||||
super.onClick(be);
|
||||
Commands.doGetRelatedResources(ResourceTypeDecorator.RunningInstance.name(),
|
||||
((Object) container.getSelection().get(0).get("ID")).toString(),
|
||||
StatusHandler.getStatus().getCurrentScope());
|
||||
}
|
||||
};
|
||||
getRelated.setIconStyle("link-icon");
|
||||
menu.add(getRelated);
|
||||
|
||||
// 1 - undeploy
|
||||
MenuItem undeploy = new MenuItem("Undeploy") {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent be) {
|
||||
super.onClick(be);
|
||||
MessageBox.confirm("Running Instance Undeploy", "Are you sure you want to undeploy the selected RI(s)?",
|
||||
new Listener<MessageBoxEvent>() {
|
||||
public void handleEvent(final MessageBoxEvent be) {
|
||||
|
||||
if (be.getButtonClicked().getItemId().equalsIgnoreCase("yes")) {
|
||||
Vector<ResourceDescriptor> resources = new Vector<ResourceDescriptor>();
|
||||
// - THE OPERATION IF CONFIRMED
|
||||
for (ModelData e : container.getSelection()) {
|
||||
ConsoleMessageBroker.info(this, "Required undeploy for: " + e.get("Name") + " " + e.get("ID"));
|
||||
try {
|
||||
resources.add(new ResourceDescriptor(
|
||||
ResourceTypeDecorator.RunningInstance.name(),
|
||||
null,
|
||||
((Object) e.get("ID")).toString(),
|
||||
((Object) e.get("Name")).toString()));
|
||||
} catch (Exception ex) {
|
||||
MessageBox.alert(
|
||||
"Generic Resource Edit",
|
||||
"Failure<br/>" + ex.getMessage(),
|
||||
null);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
ProxyRegistry.getProxyInstance().doOperation(
|
||||
SupportedOperations.RUNNING_INSTANCE_UNDEPLOY,
|
||||
StatusHandler.getStatus().getCurrentScope(),
|
||||
resources, //lista id risorse selzionati
|
||||
new AsyncCallback<Void>() {
|
||||
@Override
|
||||
public void onSuccess(final Void result) {
|
||||
Commands.showPopup("Undeployment", "success");
|
||||
}
|
||||
@Override
|
||||
public void onFailure(
|
||||
final Throwable caught) {
|
||||
Commands.showPopup("Undeployment", "failure");
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
MessageBox.alert(
|
||||
"Generic Resource Edit",
|
||||
"Failure<br/>" + e.getMessage(),
|
||||
null);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
Commands.evaluateCredentials(
|
||||
undeploy,
|
||||
SupportedOperations.RUNNING_INSTANCE_UNDEPLOY.getPermissions());
|
||||
undeploy.setIconStyle("delete-icon");
|
||||
menu.add(undeploy);
|
||||
}
|
||||
|
||||
/*************************************************************
|
||||
* SERVICE
|
||||
************************************************************/
|
||||
if (resType.equals(ResourceTypeDecorator.Service.name())) {
|
||||
// 0 - GETRELATED button
|
||||
MenuItem getRelated = new MenuItem("Get Related") {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent be) {
|
||||
super.onClick(be);
|
||||
Commands.doGetRelatedResources(ResourceTypeDecorator.Service.name(),
|
||||
((Object) container.getSelection().get(0).get("ID")).toString(),
|
||||
StatusHandler.getStatus().getCurrentScope());
|
||||
}
|
||||
};
|
||||
getRelated.setIconStyle("link-icon");
|
||||
menu.add(getRelated);
|
||||
}
|
||||
|
||||
/*************************************************************
|
||||
* GENERIC RESOURCE
|
||||
************************************************************/
|
||||
if (resType.equals(ResourceTypeDecorator.GenericResource.name())) {
|
||||
|
||||
// 0 - EDIT
|
||||
MenuItem edit = new MenuItem("Edit") {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent be) {
|
||||
final List<ModelData> selection = container.getSelection();
|
||||
if (selection != null && selection.size() == 1) {
|
||||
ProxyRegistry.getProxyInstance().getGenericResourceDescriptor(
|
||||
StatusHandler.getStatus().getCurrentScope(),
|
||||
((Object) selection.get(0).get("ID")).toString(),
|
||||
new AsyncCallback<ResourceDescriptor>() {
|
||||
public void onSuccess(final ResourceDescriptor result) {
|
||||
new GenericResourceForm(result).show();
|
||||
}
|
||||
public void onFailure(final Throwable caught) {
|
||||
MessageBox.alert(
|
||||
"Generic Resource Edit",
|
||||
"Failure<br/>" + caught.getMessage(),
|
||||
null);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
MessageBox.info("Editing resource", "The editing is allowed on a single selected item", null);
|
||||
}
|
||||
}
|
||||
};
|
||||
Commands.evaluateCredentials(
|
||||
edit,
|
||||
SupportedOperations.GHN_SHUTDOWN.getPermissions());
|
||||
edit.setIconStyle("edit-icon");
|
||||
menu.add(edit);
|
||||
|
||||
|
||||
// 1 - DELETE button
|
||||
menu.add(this.createSeparator(SupportedOperations.GENERIC_RESOURCE_DELETE));
|
||||
menu.add(this.createDeleteButton(
|
||||
container,
|
||||
ResourceTypeDecorator.GenericResource,
|
||||
SupportedOperations.GENERIC_RESOURCE_DELETE));
|
||||
|
||||
// 2 - Force DELETE button
|
||||
menu.add(this.createForceDeleteButton(
|
||||
container,
|
||||
ResourceTypeDecorator.GenericResource,
|
||||
SupportedOperations.GENERIC_RESOURCE_FORCE_DELETE));
|
||||
} // - ENDOF generic resource
|
||||
|
||||
|
||||
/*************************************************************
|
||||
* RUNTIME RESOURCE
|
||||
************************************************************/
|
||||
|
||||
if (resType.equals(ResourceTypeDecorator.RuntimeResource.name())) {
|
||||
// 0 - EDIT button
|
||||
menu.add(this.createSeparator(SupportedOperations.RUNTIME_RESOURCE_DELETE));
|
||||
menu.add(this.createEditButton(
|
||||
container,
|
||||
ResourceTypeDecorator.RuntimeResource,
|
||||
SupportedOperations.RUNTIME_RESOURCE_DELETE));
|
||||
|
||||
// 1 - DELETE button
|
||||
menu.add(this.createSeparator(SupportedOperations.RUNTIME_RESOURCE_DELETE));
|
||||
menu.add(this.createDeleteButton(
|
||||
container,
|
||||
ResourceTypeDecorator.RuntimeResource,
|
||||
SupportedOperations.RUNTIME_RESOURCE_DELETE));
|
||||
|
||||
// 2 - Force DELETE button
|
||||
menu.add(this.createForceDeleteButton(
|
||||
container,
|
||||
ResourceTypeDecorator.RuntimeResource,
|
||||
SupportedOperations.RUNTIME_RESOURCE_FORCE_DELETE));
|
||||
}
|
||||
|
||||
/*************************************************************
|
||||
* COLLECTION
|
||||
************************************************************/
|
||||
if (resType.equals(ResourceTypeDecorator.Collection.name())) {
|
||||
// 0 - DELETE button
|
||||
menu.add(this.createSeparator(SupportedOperations.COLLECTION_DELETE));
|
||||
menu.add(this.createDeleteButton(
|
||||
container,
|
||||
ResourceTypeDecorator.Collection,
|
||||
SupportedOperations.COLLECTION_DELETE));
|
||||
|
||||
// 1 - Force DELETE button
|
||||
menu.add(this.createForceDeleteButton(
|
||||
container,
|
||||
ResourceTypeDecorator.Collection,
|
||||
SupportedOperations.COLLECTION_FORCE_DELETE));
|
||||
} // - ENDOF Collection
|
||||
|
||||
/*************************************************************
|
||||
* METADATA COLLECTION
|
||||
************************************************************/
|
||||
if (resType.equals(ResourceTypeDecorator.VIEW.name())) {
|
||||
// 0 - DELETE button
|
||||
menu.add(this.createSeparator(SupportedOperations.VIEW_DELETE));
|
||||
menu.add(this.createDeleteButton(
|
||||
container,
|
||||
ResourceTypeDecorator.VIEW,
|
||||
SupportedOperations.VIEW_DELETE));
|
||||
|
||||
// 1 - Force DELETE button
|
||||
menu.add(this.createForceDeleteButton(
|
||||
container,
|
||||
ResourceTypeDecorator.VIEW,
|
||||
SupportedOperations.VIEW_FORCE_DELETE));
|
||||
} // - ENDOF Metadata Collection
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
||||
private SeparatorMenuItem createSeparator(final SupportedOperations operationID) {
|
||||
// Builds the separator
|
||||
SeparatorMenuItem separator = new SeparatorMenuItem();
|
||||
if (operationID != null) {
|
||||
Commands.evaluateCredentials(
|
||||
separator,
|
||||
operationID.getPermissions());
|
||||
}
|
||||
return separator;
|
||||
}
|
||||
|
||||
private MenuItem createDeleteButton(
|
||||
final ResourceDetailsPanel container,
|
||||
final ResourceTypeDecorator resType,
|
||||
final SupportedOperations operationID) {
|
||||
|
||||
// Builds the delete button
|
||||
MenuItem delete = new MenuItem("Delete") {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent be) {
|
||||
super.onClick(be);
|
||||
MessageBox.confirm(resType.getLabel() + " Delete",
|
||||
"Are you sure you want to delete the selected " + resType.getLabel() + "(s)?",
|
||||
new Listener<MessageBoxEvent>() {
|
||||
public void handleEvent(final MessageBoxEvent be) {
|
||||
if (be.getButtonClicked().getItemId().equalsIgnoreCase("yes")) {
|
||||
// - THE OPERATION IF CONFIRMED
|
||||
try {
|
||||
for (ModelData e : container.getSelection()) {
|
||||
ConsoleMessageBroker.info(this, "Required force delete for: " + e.get("Name") + " " + e.get("ID"));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ConsoleMessageBroker.error(this, e.getMessage());
|
||||
}
|
||||
OpCommands.doDeleteItems(resType, container.getSelection(), operationID);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
// Checks the permissions on the operation
|
||||
Commands.evaluateCredentials(
|
||||
delete,
|
||||
operationID.getPermissions());
|
||||
delete.setIconStyle("delete-icon");
|
||||
return delete;
|
||||
}
|
||||
|
||||
private MenuItem createEditButton(
|
||||
final ResourceDetailsPanel container,
|
||||
final ResourceTypeDecorator resType,
|
||||
final SupportedOperations operationID) {
|
||||
|
||||
// Builds the delete button
|
||||
MenuItem edit = new MenuItem("Edit Runtime Resource") {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent be) {
|
||||
String idToEdit = "";
|
||||
for (ModelData e : container.getSelection()) {
|
||||
idToEdit = e.get("ID");
|
||||
}
|
||||
OpCommands.loadServiceEndopointEditor(idToEdit);
|
||||
}
|
||||
};
|
||||
// Checks the permissions on the operation
|
||||
Commands.evaluateCredentials(
|
||||
edit,
|
||||
operationID.getPermissions());
|
||||
edit.setIconStyle("edit-icon");
|
||||
return edit;
|
||||
}
|
||||
|
||||
private MenuItem createForceDeleteButton(
|
||||
final ResourceDetailsPanel container,
|
||||
final ResourceTypeDecorator resType,
|
||||
final SupportedOperations operationID) {
|
||||
|
||||
// Builds the delete button
|
||||
MenuItem delete = new MenuItem("Force Delete") {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent be) {
|
||||
super.onClick(be);
|
||||
MessageBox.confirm(resType.getLabel() + " Force Delete",
|
||||
"Are you sure you want to delete the selected " + resType.getLabel() + "(s)?",
|
||||
new Listener<MessageBoxEvent>() {
|
||||
public void handleEvent(final MessageBoxEvent be) {
|
||||
if (be.getButtonClicked().getItemId().equalsIgnoreCase("yes")) {
|
||||
// - THE OPERATION IF CONFIRMED
|
||||
try {
|
||||
for (ModelData e : container.getSelection()) {
|
||||
ConsoleMessageBroker.info(this, "Required force delete for: " + e.get("Name") + " " + e.get("ID"));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ConsoleMessageBroker.error(this, e.getMessage());
|
||||
}
|
||||
OpCommands.doDeleteItems(resType, container.getSelection(), operationID);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
// Checks the permissions on the operation
|
||||
Commands.evaluateCredentials(
|
||||
delete,
|
||||
operationID.getPermissions());
|
||||
delete.setIconStyle("force-delete-icon");
|
||||
return delete;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
package org.gcube.portlets.admin.resourcemanagement.client.views.resourcedetails;
|
||||
|
||||
import com.extjs.gxt.ui.client.data.ModelData;
|
||||
import com.extjs.gxt.ui.client.store.Store;
|
||||
import com.extjs.gxt.ui.client.store.StoreSorter;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
|
||||
public class CustomSorter extends StoreSorter<ModelData> {
|
||||
/**
|
||||
* need to recalculate the percentage as the returned value is not what the render returns
|
||||
*/
|
||||
@Override
|
||||
public int compare(Store<ModelData> store, ModelData m1, ModelData m2, String property) {
|
||||
if (property != null) {
|
||||
if (property.equals("VirtualAvailable")) {
|
||||
String s1 = m1.get(property);
|
||||
String s2 = m2.get(property);
|
||||
int val1 = Integer.parseInt(s1);
|
||||
int val2 = Integer.parseInt(s2);
|
||||
|
||||
int tot1 = Integer.parseInt((String) m1.get("VirtualSize"));
|
||||
int tot2 = Integer.parseInt((String) m2.get("VirtualSize"));
|
||||
|
||||
int percentage1 = (val1 * 100) / tot1;
|
||||
int percentage2 = (val2 * 100) / tot2;
|
||||
|
||||
//GWT.log(val1 +"-"+val2);
|
||||
GWT.log(""+percentage1);
|
||||
if (percentage1 == percentage2) return 0;
|
||||
if (percentage1 > percentage2)
|
||||
return 1;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
else if (property.equals("LocalAvailableSpace")) {
|
||||
String s1 = m1.get(property);
|
||||
String s2 = m2.get(property);
|
||||
int val1 = Integer.parseInt(s1);
|
||||
int val2 = Integer.parseInt(s2);
|
||||
|
||||
if (val1 == val2) return 0;
|
||||
if (val1 > val2)
|
||||
return 1;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
else if (property.equals("NumberOfMembers") || property.equals("Cardinality")) {
|
||||
String s1 = m1.get(property);
|
||||
String s2 = m2.get(property);
|
||||
int val1 = Integer.parseInt(s1);
|
||||
int val2 = Integer.parseInt(s2);
|
||||
|
||||
if (val1 == val2) return 0;
|
||||
if (val1 > val2)
|
||||
return 1;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
Object v1 = m1.get(property);
|
||||
Object v2 = m2.get(property);
|
||||
return comparator.compare(v1, v2);
|
||||
}
|
||||
return comparator.compare(m1, m2);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,387 @@
|
|||
/****************************************************************************
|
||||
* This software is part of the gCube Project.
|
||||
* Site: http://www.gcube-system.org/
|
||||
****************************************************************************
|
||||
* The gCube/gCore software is licensed as Free Open Source software
|
||||
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
* The software and documentation is provided by its authors/distributors
|
||||
* "as is" and no expressed or
|
||||
* implied warranty is given for its use, quality or fitness for a
|
||||
* particular case.
|
||||
****************************************************************************
|
||||
* Filename: ResourceDetailsPanel.java
|
||||
****************************************************************************
|
||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
||||
***************************************************************************/
|
||||
|
||||
package org.gcube.portlets.admin.resourcemanagement.client.views.resourcedetails;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.forms.DeployServicesForm;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.utils.Commands;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.utils.OpCommands;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.console.ConsoleMessageBroker;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.registry.UIIdentifiers;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.registry.WidgetsRegistry;
|
||||
import org.gcube.resourcemanagement.support.client.utils.StatusHandler;
|
||||
import org.gcube.resourcemanagement.support.client.views.ResourceTypeDecorator;
|
||||
import org.gcube.resourcemanagement.support.shared.operations.SupportedOperations;
|
||||
import org.gcube.resourcemanagement.support.shared.types.datamodel.ResourceDetailModel;
|
||||
|
||||
import com.extjs.gxt.ui.client.data.ModelData;
|
||||
import com.extjs.gxt.ui.client.event.BaseEvent;
|
||||
import com.extjs.gxt.ui.client.event.ComponentEvent;
|
||||
import com.extjs.gxt.ui.client.event.Events;
|
||||
import com.extjs.gxt.ui.client.event.Listener;
|
||||
import com.extjs.gxt.ui.client.store.GroupingStore;
|
||||
import com.extjs.gxt.ui.client.store.ListStore;
|
||||
import com.extjs.gxt.ui.client.widget.Component;
|
||||
import com.extjs.gxt.ui.client.widget.ContentPanel;
|
||||
import com.extjs.gxt.ui.client.widget.Text;
|
||||
import com.extjs.gxt.ui.client.widget.button.Button;
|
||||
import com.extjs.gxt.ui.client.widget.button.ToolButton;
|
||||
import com.extjs.gxt.ui.client.widget.grid.Grid;
|
||||
import com.extjs.gxt.ui.client.widget.grid.GridViewConfig;
|
||||
import com.extjs.gxt.ui.client.widget.grid.GroupingView;
|
||||
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
||||
import com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem;
|
||||
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.core.client.RunAsyncCallback;
|
||||
import com.google.gwt.user.client.Window;
|
||||
|
||||
/**
|
||||
* @author Massimiliano Assante (ISTI-CNR)
|
||||
* @author Daniele Strollo
|
||||
* @version 2.1 APR 2012
|
||||
*/
|
||||
public class ResourceDetailsPanel {
|
||||
private ContentPanel rootPanel = null;
|
||||
private Component widget = null;
|
||||
private boolean groupingEnabled = true;
|
||||
private String collapsibleColumn = "SubType";
|
||||
private ToolBar toolBar = new ToolBar();
|
||||
private final static String btnGroupID = "btn-grid-group";
|
||||
private final static String btnRefreshID = "btn-grid-refresh";
|
||||
private boolean highlightInvalidFields = false;
|
||||
|
||||
public ResourceDetailsPanel() {
|
||||
this.widget = new Text();
|
||||
this.init();
|
||||
}
|
||||
|
||||
private ListStore<ModelData> getStore() {
|
||||
return this.getGrid().getStore();
|
||||
}
|
||||
|
||||
public final List<ModelData> getElemsForInstall() {
|
||||
List<ModelData> retval = new Vector<ModelData>();
|
||||
for (ModelData r : this.getStore().getModels()) {
|
||||
if (r.getProperties().containsKey(ResourceDetailModel.SERVICE_INSTALL_KEY) &&
|
||||
Boolean.parseBoolean(((Object) r.get(ResourceDetailModel.SERVICE_INSTALL_KEY)).toString())) {
|
||||
retval.add(r);
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
public final void refreshModel() {
|
||||
for (ModelData s : this.getSelection()) {
|
||||
this.getStore().update(s);
|
||||
}
|
||||
}
|
||||
|
||||
public final List<ModelData> getSelection() {
|
||||
if (this.getGrid() == null || this.getGrid().getSelectionModel().getSelection() == null) {
|
||||
return null;
|
||||
}
|
||||
return this.getGrid().getSelectionModel().getSelection();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method called at initialization phase (Constructor).
|
||||
*/
|
||||
public final void init() {
|
||||
this.rootPanel = new ContentPanel(new FitLayout());
|
||||
// this.rootPanel.setHeading("Resource Details");
|
||||
this.rootPanel.setHeaderVisible(false);
|
||||
this.widget.setId("res-details-widget-fake");
|
||||
this.widget.setStyleName("x-panel-cube-background");
|
||||
|
||||
// The first creation of button
|
||||
Button groupButton = new Button() {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent ce) {
|
||||
super.onClick(ce);
|
||||
if (groupingEnabled) {
|
||||
disableGrouping();
|
||||
} else {
|
||||
enableGrouping();
|
||||
}
|
||||
}
|
||||
};
|
||||
groupButton.setId(btnGroupID);
|
||||
groupButton.setIconStyle("grid-icon");
|
||||
groupButton.setToolTip("Categorize");
|
||||
this.toolBar.add(new SeparatorToolItem());
|
||||
this.toolBar.add(groupButton);
|
||||
|
||||
// The first creation of button
|
||||
Button refreshButton = new Button() {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent ce) {
|
||||
Commands.refreshResourceGrid();
|
||||
}
|
||||
};
|
||||
refreshButton.setId(btnRefreshID);
|
||||
refreshButton.setIconStyle("refresh-icon");
|
||||
refreshButton.setToolTip("Refresh");
|
||||
this.toolBar.add(refreshButton);
|
||||
|
||||
this.rootPanel.setTopComponent(this.toolBar);
|
||||
}
|
||||
|
||||
public final void toggleHighlightInvalidFields() {
|
||||
this.highlightInvalidFields = !this.highlightInvalidFields;
|
||||
if (this.getGridView() != null) {
|
||||
this.getGridView().refresh(true);
|
||||
}
|
||||
}
|
||||
|
||||
public final ToolBar getToolBar() {
|
||||
return this.toolBar;
|
||||
}
|
||||
|
||||
public final Component getWidget() {
|
||||
return this.widget;
|
||||
}
|
||||
|
||||
private void disableGrouping() {
|
||||
GroupingStore<ModelData> groupingStore = null;
|
||||
if (this.getStore() instanceof GroupingStore) {
|
||||
groupingStore = (GroupingStore<ModelData>) this.getStore();
|
||||
if (groupingStore != null) {
|
||||
groupingStore.clearGrouping();
|
||||
}
|
||||
this.groupingEnabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void enableGrouping() {
|
||||
GroupingStore<ModelData> groupingStore = null;
|
||||
if (this.getStore() instanceof GroupingStore) {
|
||||
groupingStore = (GroupingStore<ModelData>) this.getStore();
|
||||
if (groupingStore != null) {
|
||||
groupingStore.groupBy(collapsibleColumn);
|
||||
}
|
||||
this.groupingEnabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public final Grid<ModelData> getGrid() {
|
||||
if (this.getWidget() != null && this.getWidget() instanceof Grid) {
|
||||
return (Grid<ModelData>) this.getWidget();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private GroupingView getGridView() {
|
||||
if (this.getGrid() != null && this.getGrid().getView() instanceof GroupingView) {
|
||||
return (GroupingView) this.getGrid().getView();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public final void setWidget(final Component widget, final boolean enableGrouping) {
|
||||
this.rootPanel.removeAll();
|
||||
this.widget = widget;
|
||||
rootPanel.add(this.widget);
|
||||
|
||||
Button groupButton = null;
|
||||
try {
|
||||
groupButton = (Button) this.toolBar.getItemByItemId(ResourceDetailsPanel.btnGroupID);
|
||||
groupButton.setEnabled(enableGrouping);
|
||||
} catch (Exception e) {
|
||||
ConsoleMessageBroker.error(this, "During set widget. " + e.getMessage());
|
||||
}
|
||||
|
||||
// FIXME check if needed --- Commands.refreshResourceDetails();
|
||||
}
|
||||
|
||||
public final ContentPanel getContainer() {
|
||||
return this.rootPanel;
|
||||
}
|
||||
|
||||
private void resetToolBar() {
|
||||
List<Component> buttons = this.getToolBar().getItems();
|
||||
List<Component> toRemove = new Vector<Component>();
|
||||
if (buttons.size() > 3) {
|
||||
for (int i = 3; i < buttons.size(); i++) {
|
||||
toRemove.add(buttons.get(i));
|
||||
}
|
||||
}
|
||||
if (toRemove.size() > 0) {
|
||||
for (Component c : toRemove) {
|
||||
this.getToolBar().remove(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public final void initToolbar() {
|
||||
String resType = StatusHandler.getStatus().getCurrentResourceType();
|
||||
|
||||
// Removes from the toolbar specific buttons
|
||||
resetToolBar();
|
||||
|
||||
/************************************************
|
||||
* GENERIC RESOURCE - customized toolbar
|
||||
***********************************************/
|
||||
|
||||
// Adds toolbar buttons for Generic Resources
|
||||
if (resType.equals(ResourceTypeDecorator.GenericResource.name()) &&
|
||||
SupportedOperations.GENERIC_RESOURCE_CREATE.isAllowed(StatusHandler.getStatus().getCredentials())) {
|
||||
this.getToolBar().add(new SeparatorToolItem());
|
||||
ToolButton createNew = new ToolButton("new-icon") {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent ce) {
|
||||
super.onClick(ce);
|
||||
OpCommands.doOpenGenericResourceForm();
|
||||
}
|
||||
};
|
||||
createNew.setToolTip("Create new Generic Resource");
|
||||
this.getToolBar().add(createNew);
|
||||
}
|
||||
|
||||
/************************************************
|
||||
* SERVICES - customized toolbar
|
||||
***********************************************/
|
||||
|
||||
// Adds toolbar buttons for Services
|
||||
//TODO: To be implemented in the future
|
||||
// if (resType.equals(ResourceTypeDecorator.Service.name()) &&
|
||||
// SupportedOperations.SERVICE_CREATE.isAllowed(StatusHandler.getStatus().getCredentials())) {
|
||||
// this.getToolBar().add(new SeparatorToolItem());
|
||||
// ToolButton createNew = new ToolButton("new-icon") {
|
||||
// @Override
|
||||
// protected void onClick(final ComponentEvent ce) {
|
||||
// super.onClick(ce);
|
||||
// CommonOperations.doOpenServiceForm();
|
||||
// }
|
||||
// };
|
||||
// createNew.setToolTip("Create new Software");
|
||||
// this.getToolBar().add(createNew);
|
||||
// }
|
||||
|
||||
// Adds toolbar buttons for Services
|
||||
if (resType.equals(ResourceTypeDecorator.Service.name()) &&
|
||||
SupportedOperations.SERVICE_DEPLOY.isAllowed(StatusHandler.getStatus().getCredentials())) {
|
||||
this.getToolBar().add(new SeparatorToolItem());
|
||||
ToolButton doDeploy = new ToolButton("deploy-icon") {
|
||||
protected void onClick(final ComponentEvent be) {
|
||||
super.onClick(be);
|
||||
GWT.runAsync(DeployServicesForm.class, new RunAsyncCallback() {
|
||||
@Override
|
||||
public void onFailure(Throwable reason) {
|
||||
Window.alert("Could not load the deploy form.");
|
||||
}
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
new DeployServicesForm().show();
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
};
|
||||
doDeploy.setToolTip("Prepare a deployment plan");
|
||||
this.getToolBar().add(doDeploy);
|
||||
}
|
||||
|
||||
|
||||
// Adds toolbar buttons for Services
|
||||
if (resType.equals(ResourceTypeDecorator.Service.name()) &&
|
||||
SupportedOperations.SERVICE_GET_REPORT.isAllowed(StatusHandler.getStatus().getCredentials())) {
|
||||
this.getToolBar().add(new SeparatorToolItem());
|
||||
ToolButton doDeploy = new ToolButton("getreport-icon") {
|
||||
protected void onClick(final ComponentEvent be) {
|
||||
super.onClick(be);
|
||||
OpCommands.doGetDeployReport();
|
||||
};
|
||||
};
|
||||
doDeploy.setToolTip("Get report for submitted deployment");
|
||||
this.getToolBar().add(doDeploy);
|
||||
}
|
||||
}
|
||||
|
||||
public final void setGrid(final Grid<ModelData> grid, final boolean groupingEnabled) {
|
||||
// Sets the grid container title
|
||||
//this.rootPanel.setHeading("Resource Details (" + StatusHandler.getStatus().getCurrentResourceType() + ")");
|
||||
|
||||
this.initToolbar();
|
||||
|
||||
// adds highlighting support
|
||||
// Annotates invalid cells
|
||||
grid.getView().setViewConfig(new GridViewConfig() {
|
||||
@Override
|
||||
public String getRowStyle(
|
||||
final ModelData model,
|
||||
final int rowIndex,
|
||||
final ListStore<ModelData> ds) {
|
||||
try {
|
||||
if (!highlightInvalidFields) {
|
||||
return super.getRowStyle(model, rowIndex, ds);
|
||||
}
|
||||
|
||||
// NOTE this strange cast to object is due to:
|
||||
// compilation error in jdk bug: java.lang.Object cannot be dereferenced
|
||||
|
||||
// if no requirements expressed for this type, return the default style
|
||||
if (ResourceDetailModel.getRequiredFields(((Object) model.get("Type")).toString()) == null) {
|
||||
return super.getRowStyle(model, rowIndex, ds);
|
||||
}
|
||||
String[] reqs = ResourceDetailModel.getRequiredFields(((Object) model.get("Type")).toString());
|
||||
|
||||
for (String req : reqs) {
|
||||
if (model.get(req) == null || ((Object) model.get(req)).toString().trim().length() == 0) {
|
||||
// Adds to the model with problems the error code
|
||||
return "x-grid-invalid-row";
|
||||
}
|
||||
}
|
||||
return super.getRowStyle(model, rowIndex, ds);
|
||||
} catch (Exception e) {
|
||||
GWT.log("getting required fields", e);
|
||||
return super.getRowStyle(model, rowIndex, ds);
|
||||
}
|
||||
}
|
||||
});
|
||||
/*
|
||||
* add the row click listener by default open the profile
|
||||
*/
|
||||
grid.addListener(Events.RowClick, new Listener<BaseEvent>(){
|
||||
public void handleEvent(BaseEvent be) {
|
||||
//GridEvent ge = (GridEvent)be;
|
||||
openProfileInPinnedResources();
|
||||
}
|
||||
});
|
||||
|
||||
grid.setContextMenu(ContextMenuFactory.getInstance().buildContextMenu(
|
||||
StatusHandler.getStatus().getCurrentResourceType(), this));
|
||||
|
||||
this.setWidget(grid, groupingEnabled);
|
||||
|
||||
// Add the new created widget inside the container
|
||||
WidgetsRegistry.getPanel(UIIdentifiers.RESOURCE_DETAIL_GRID_PANEL).add(this.getContainer(), true);
|
||||
}
|
||||
|
||||
private void openProfileInPinnedResources() {
|
||||
List<ModelData> selectedElems = this.getSelection();
|
||||
for (ModelData selectedElem : selectedElems) {
|
||||
String type = ((Object) selectedElem.get("Type")).toString();
|
||||
String resID = ((Object) selectedElem.get("ID")).toString();
|
||||
String scope = StatusHandler.getStatus().getCurrentScope();
|
||||
Commands.doGetResourceProfile(this, scope, type, resID);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,141 @@
|
|||
/****************************************************************************
|
||||
* This software is part of the gCube Project.
|
||||
* Site: http://www.gcube-system.org/
|
||||
****************************************************************************
|
||||
* The gCube/gCore software is licensed as Free Open Source software
|
||||
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
* The software and documentation is provided by its authors/distributors
|
||||
* "as is" and no expressed or
|
||||
* implied warranty is given for its use, quality or fitness for a
|
||||
* particular case.
|
||||
****************************************************************************
|
||||
* Filename: ResourceGridFactory.java
|
||||
****************************************************************************
|
||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
||||
***************************************************************************/
|
||||
|
||||
package org.gcube.portlets.admin.resourcemanagement.client.views.resourcedetails;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.utils.Commands;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.console.ConsoleMessageBroker;
|
||||
import org.gcube.resourcemanagement.support.shared.types.datamodel.ResourceDetailModel;
|
||||
|
||||
import com.extjs.gxt.ui.client.Style.SortDir;
|
||||
import com.extjs.gxt.ui.client.data.BaseListLoader;
|
||||
import com.extjs.gxt.ui.client.data.ListLoadResult;
|
||||
import com.extjs.gxt.ui.client.data.MemoryProxy;
|
||||
import com.extjs.gxt.ui.client.data.ModelData;
|
||||
import com.extjs.gxt.ui.client.data.ModelType;
|
||||
import com.extjs.gxt.ui.client.data.XmlLoadResultReader;
|
||||
import com.extjs.gxt.ui.client.store.GroupingStore;
|
||||
import com.extjs.gxt.ui.client.store.ListStore;
|
||||
import com.extjs.gxt.ui.client.widget.MessageBox;
|
||||
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
|
||||
import com.extjs.gxt.ui.client.widget.grid.Grid;
|
||||
import com.extjs.gxt.ui.client.widget.grid.GridGroupRenderer;
|
||||
import com.extjs.gxt.ui.client.widget.grid.GroupColumnData;
|
||||
import com.extjs.gxt.ui.client.widget.grid.GroupingView;
|
||||
|
||||
/**
|
||||
* @author Daniele Strollo (ISTI-CNR)
|
||||
*
|
||||
*/
|
||||
public class ResourceGridFactory {
|
||||
public static final synchronized Grid<ModelData> createGrid(
|
||||
final String resourceType,
|
||||
final List<String> result,
|
||||
final String groupingColumn) {
|
||||
return createGrid(resourceType, result, groupingColumn, true);
|
||||
}
|
||||
|
||||
public static final synchronized Grid<ModelData> createGrid(
|
||||
final String resourceType,
|
||||
final List<String> result,
|
||||
final String groupingColumn,
|
||||
final boolean autoExpand) {
|
||||
try {
|
||||
|
||||
if (result == null || result.size() == 0) {
|
||||
Commands.showPopup(
|
||||
"Failure",
|
||||
"the retrieved result set for required resource is null or empty",
|
||||
6000);
|
||||
return null;
|
||||
}
|
||||
|
||||
// The the XML reader
|
||||
ModelType type = ResourceDetailModel.getXMLMapping(resourceType);
|
||||
// For the grid representation
|
||||
final ColumnModel cm = ResourceDetailModel.getRecordDefinition(resourceType);
|
||||
|
||||
if (type == null || cm == null) {
|
||||
MessageBox.alert("Failure", "the model representation has not been found", null);
|
||||
return null;
|
||||
}
|
||||
|
||||
// need a loader, proxy, and reader
|
||||
XmlLoadResultReader<ListLoadResult<ModelData>> reader =
|
||||
new XmlLoadResultReader<ListLoadResult<ModelData>>(type);
|
||||
|
||||
StringBuilder toParse = new StringBuilder().append("<Resources>\n");
|
||||
for (String elem : result) {
|
||||
toParse.append(elem.toString());
|
||||
}
|
||||
toParse.append("\n</Resources>");
|
||||
|
||||
MemoryProxy<String> proxy = new MemoryProxy<String>(toParse.toString());
|
||||
|
||||
final BaseListLoader<ListLoadResult<ModelData>> loader =
|
||||
new BaseListLoader<ListLoadResult<ModelData>>(proxy, reader);
|
||||
|
||||
ListStore<ModelData> store = null;
|
||||
|
||||
if (groupingColumn != null) {
|
||||
store = new GroupingStore<ModelData>(loader);
|
||||
} else {
|
||||
store = new ListStore<ModelData>(loader);
|
||||
}
|
||||
//apply the custom sorter
|
||||
store.setStoreSorter(new CustomSorter());
|
||||
|
||||
final Grid<ModelData> grid = new Grid<ModelData>(store, cm);
|
||||
|
||||
if (groupingColumn != null) {
|
||||
((GroupingStore<ModelData>) store).groupBy(groupingColumn);
|
||||
|
||||
// GROUPING
|
||||
// Builds the grouping structure to collapse elements
|
||||
// having the same type (log severity).
|
||||
GroupingView groupingView = new GroupingView();
|
||||
groupingView.setGroupRenderer(new GridGroupRenderer() {
|
||||
public String render(final GroupColumnData data) {
|
||||
int s = data.models.size();
|
||||
String f = cm.getColumnById(data.field).getHeader();
|
||||
String l = s == 1 ? "Item" : "Items";
|
||||
return f + ": " + ((data.group != null && data.group.trim().length() > 0) ? data.group : "<i>Undefined</i>") + " (" + s + " " + l + ")";
|
||||
}
|
||||
});
|
||||
|
||||
groupingView.setAutoFill(true);
|
||||
groupingView.setForceFit(false);
|
||||
grid.setView(groupingView);
|
||||
}
|
||||
|
||||
if (autoExpand) {
|
||||
// The first visible column will be considered auto-expand
|
||||
grid.setAutoExpandColumn(cm.getColumn(0).getId());
|
||||
}
|
||||
|
||||
loader.setSortField("ID");
|
||||
loader.setSortDir(SortDir.ASC);
|
||||
loader.load();
|
||||
|
||||
return grid;
|
||||
} catch (RuntimeException e) {
|
||||
ConsoleMessageBroker.error(ResourceGridFactory.class, "During resourceDetailGrid creation");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,219 @@
|
|||
/****************************************************************************
|
||||
* This software is part of the gCube Project.
|
||||
* Site: http://www.gcube-system.org/
|
||||
****************************************************************************
|
||||
* The gCube/gCore software is licensed as Free Open Source software
|
||||
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
* The software and documentation is provided by its authors/distributors
|
||||
* "as is" and no expressed or
|
||||
* implied warranty is given for its use, quality or fitness for a
|
||||
* particular case.
|
||||
****************************************************************************
|
||||
* Filename: ResourcesTreePanel.java
|
||||
****************************************************************************
|
||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
||||
***************************************************************************/
|
||||
|
||||
package org.gcube.portlets.admin.resourcemanagement.client.views.resourcetree;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.utils.Commands;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.console.ConsoleMessageBroker;
|
||||
import org.gcube.resourcemanagement.support.client.utils.StatusHandler;
|
||||
import org.gcube.resourcemanagement.support.client.views.ResourceTypeDecorator;
|
||||
import org.gcube.resourcemanagement.support.shared.types.datamodel.AtomicTreeNode;
|
||||
|
||||
import com.extjs.gxt.ui.client.Style.SelectionMode;
|
||||
import com.extjs.gxt.ui.client.Style.SortDir;
|
||||
import com.extjs.gxt.ui.client.data.ModelData;
|
||||
import com.extjs.gxt.ui.client.data.ModelIconProvider;
|
||||
import com.extjs.gxt.ui.client.event.ComponentEvent;
|
||||
import com.extjs.gxt.ui.client.event.Events;
|
||||
import com.extjs.gxt.ui.client.event.Listener;
|
||||
import com.extjs.gxt.ui.client.event.TreePanelEvent;
|
||||
import com.extjs.gxt.ui.client.store.TreeStore;
|
||||
import com.extjs.gxt.ui.client.util.IconHelper;
|
||||
import com.extjs.gxt.ui.client.widget.menu.Menu;
|
||||
import com.extjs.gxt.ui.client.widget.menu.MenuItem;
|
||||
import com.extjs.gxt.ui.client.widget.treepanel.TreePanel;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.user.client.Timer;
|
||||
import com.google.gwt.user.client.ui.AbstractImagePrototype;
|
||||
|
||||
|
||||
class TreeSelectionListener implements Listener<TreePanelEvent<ModelData>> {
|
||||
private boolean doExpand = false;
|
||||
|
||||
public void handleEvent(final TreePanelEvent<ModelData> be) {
|
||||
if (be.getType() == Events.Expand) {
|
||||
be.cancelBubble();
|
||||
doExpand = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (be.getType() == Events.Collapse) {
|
||||
be.cancelBubble();
|
||||
doExpand = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (be.getType() == Events.OnClick &&
|
||||
!be.isRightClick() && be.getItem() != null &&
|
||||
be.getItem() instanceof AtomicTreeNode) {
|
||||
if (!doExpand) {
|
||||
// do you stuff, right click detected for a click event
|
||||
AtomicTreeNode selectedModel = (AtomicTreeNode) be.getItem();
|
||||
// -- SELECTED A LEAF
|
||||
if (selectedModel != null && selectedModel.isLeaf()) {
|
||||
ConsoleMessageBroker.trace(this, "Selected leaf: " + ((AtomicTreeNode) selectedModel.getParent()).getNode() + "::" + selectedModel.getName());
|
||||
Commands.doFilterResourceDetailsGrid(this,
|
||||
StatusHandler.getStatus().getCurrentScope(),
|
||||
((AtomicTreeNode) selectedModel.getParent()).getNode(),
|
||||
selectedModel.getSubType());
|
||||
}
|
||||
// -- SELECTED A NOT LEAF NODE
|
||||
if (selectedModel != null && !selectedModel.isLeaf()) {
|
||||
ConsoleMessageBroker.trace(this, "Selected node: " + selectedModel.getNode());
|
||||
Commands.doLoadResourceDetailsGrid(this, StatusHandler.getStatus().getCurrentScope(), selectedModel.getNode());
|
||||
}
|
||||
}
|
||||
doExpand = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author Daniele Strollo
|
||||
* @author Massimiliano Assante (ISTI-CNR)
|
||||
*/
|
||||
public class ResourcesTreePanel {
|
||||
private TreePanel<ModelData> tree = null;
|
||||
|
||||
private boolean isOn = false;
|
||||
private Timer t;
|
||||
private int counter;
|
||||
private ModelData gHN = null;
|
||||
|
||||
public ResourcesTreePanel(final HashMap<String, ArrayList<String>> rawmodel) {
|
||||
AtomicTreeNode model = new AtomicTreeNode("Resource", null);
|
||||
String icon = null;
|
||||
String label = null;
|
||||
counter = 0;
|
||||
if (rawmodel == null) {
|
||||
model.add(new AtomicTreeNode(ResourceTypeDecorator.Empty.getLabel(), null, ResourceTypeDecorator.Empty.getIcon()));
|
||||
} else {
|
||||
for (Entry<String, ArrayList<String>> elems : rawmodel.entrySet()) {
|
||||
String type = elems.getKey();
|
||||
List<String> subtypes = elems.getValue();
|
||||
|
||||
try {
|
||||
icon = ResourceTypeDecorator.valueOf(type).getIcon();
|
||||
label = ResourceTypeDecorator.valueOf(type).getFWSName();
|
||||
//label = ResourceTypeDecorator.valueOf(type).getLabel();
|
||||
} catch (java.lang.IllegalArgumentException e) {
|
||||
label = type;
|
||||
icon = null;
|
||||
}
|
||||
|
||||
AtomicTreeNode currType = new AtomicTreeNode(type, label, icon);
|
||||
|
||||
for (String subtype : subtypes) {
|
||||
currType.add(new AtomicTreeNode(subtype, null, icon));
|
||||
}
|
||||
model.add(currType);
|
||||
}
|
||||
}
|
||||
|
||||
final TreeStore<ModelData> store = new TreeStore<ModelData>();
|
||||
// The root node will not be shown
|
||||
store.add(model.getChildren(), true);
|
||||
// FIXME store.sort("sortIdx", SortDir.ASC);
|
||||
store.sort("name", SortDir.ASC);
|
||||
|
||||
this.tree = new TreePanel<ModelData>(store);
|
||||
this.tree.setWidth(300);
|
||||
this.tree.setDisplayProperty("name");
|
||||
|
||||
Menu contextMenu = new Menu();
|
||||
MenuItem refresh = new MenuItem("Refresh Tree") {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent be) {
|
||||
super.onClick(be);
|
||||
Commands.refreshResourceTree();
|
||||
}
|
||||
};
|
||||
refresh.setIconStyle("refresh-icon");
|
||||
contextMenu.add(refresh);
|
||||
this.tree.setContextMenu(contextMenu);
|
||||
|
||||
|
||||
// The icon decorator
|
||||
this.tree.setIconProvider(
|
||||
new ModelIconProvider<ModelData>() {
|
||||
public AbstractImagePrototype getIcon(final ModelData model) {
|
||||
if (model.get("node") != null && model.get("icon") != null) {
|
||||
return IconHelper.createStyle((String) model.get("icon"));
|
||||
}
|
||||
return IconHelper.createStyle("defaultleaf-icon");
|
||||
}
|
||||
});
|
||||
|
||||
// Handles the selection
|
||||
tree.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
|
||||
|
||||
TreeSelectionListener handler = new TreeSelectionListener();
|
||||
|
||||
tree.addListener(Events.Expand, handler);
|
||||
tree.addListener(Events.Collapse, handler);
|
||||
tree.addListener(Events.OnClick, handler);
|
||||
|
||||
/**
|
||||
* show gHN list if the configuration says so.
|
||||
*/
|
||||
if (StatusHandler.getStatus().isLoadGHNatStartup()) {
|
||||
GWT.log(""+StatusHandler.getStatus().isLoadGHNatStartup());
|
||||
|
||||
Commands.doLoadResourceDetailsGrid(this,
|
||||
StatusHandler.getStatus().getCurrentScope(),
|
||||
"GHN");
|
||||
|
||||
//select the GHN
|
||||
for (ModelData md: store.getAllItems()) {
|
||||
if (md.get("node").toString().compareTo("GHN") == 0)
|
||||
gHN = md;
|
||||
}
|
||||
|
||||
if (gHN != null) {
|
||||
tree.getSelectionModel().select(false, gHN);
|
||||
t = new Timer() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (isOn)
|
||||
tree.getSelectionModel().deselectAll();
|
||||
else
|
||||
tree.getSelectionModel().select(false, gHN);
|
||||
t.schedule(80);
|
||||
isOn = !isOn;
|
||||
counter++;
|
||||
if (counter > 10)
|
||||
t.cancel();
|
||||
}
|
||||
};
|
||||
t.schedule(100);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public final TreePanel<ModelData> getWidget() {
|
||||
return this.tree;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,112 @@
|
|||
/****************************************************************************
|
||||
* This software is part of the gCube Project.
|
||||
* Site: http://www.gcube-system.org/
|
||||
****************************************************************************
|
||||
* The gCube/gCore software is licensed as Free Open Source software
|
||||
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
* The software and documentation is provided by its authors/distributors
|
||||
* "as is" and no expressed or
|
||||
* implied warranty is given for its use, quality or fitness for a
|
||||
* particular case.
|
||||
****************************************************************************
|
||||
* Filename: WSResourcesTreePanel.java
|
||||
****************************************************************************
|
||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
||||
***************************************************************************/
|
||||
|
||||
package org.gcube.portlets.admin.resourcemanagement.client.views.resourcetree;
|
||||
|
||||
import java.util.List;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.utils.Commands;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.console.ConsoleMessageBroker;
|
||||
import org.gcube.resourcemanagement.support.client.utils.StatusHandler;
|
||||
import org.gcube.resourcemanagement.support.client.views.ResourceTypeDecorator;
|
||||
import org.gcube.resourcemanagement.support.shared.types.datamodel.AtomicTreeNode;
|
||||
|
||||
import com.extjs.gxt.ui.client.Style.SelectionMode;
|
||||
import com.extjs.gxt.ui.client.Style.SortDir;
|
||||
import com.extjs.gxt.ui.client.data.ModelData;
|
||||
import com.extjs.gxt.ui.client.data.ModelIconProvider;
|
||||
import com.extjs.gxt.ui.client.event.Events;
|
||||
import com.extjs.gxt.ui.client.event.Listener;
|
||||
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
|
||||
import com.extjs.gxt.ui.client.store.TreeStore;
|
||||
import com.extjs.gxt.ui.client.util.IconHelper;
|
||||
import com.extjs.gxt.ui.client.widget.treepanel.TreePanel;
|
||||
import com.google.gwt.user.client.ui.AbstractImagePrototype;
|
||||
|
||||
/**
|
||||
* @author Daniele Strollo (ISTI-CNR)
|
||||
*
|
||||
*/
|
||||
public class WSResourcesTreePanel {
|
||||
private TreePanel<ModelData> tree = null;
|
||||
|
||||
|
||||
public WSResourcesTreePanel(final List<String> types) {
|
||||
AtomicTreeNode model = new AtomicTreeNode(ResourceTypeDecorator.WSResource.name(), null);
|
||||
|
||||
if (types != null && types.size() > 0) {
|
||||
String elem = ResourceTypeDecorator.WSResource.name();
|
||||
String icon = ResourceTypeDecorator.valueOf(elem).getIcon();
|
||||
String label = ResourceTypeDecorator.valueOf(elem).getLabel();
|
||||
|
||||
AtomicTreeNode currType = new AtomicTreeNode(elem, label, icon);
|
||||
|
||||
for (String subtype : types) {
|
||||
currType.add(new AtomicTreeNode(subtype, null, icon));
|
||||
}
|
||||
model.add(currType);
|
||||
}
|
||||
|
||||
TreeStore<ModelData> store = new TreeStore<ModelData>();
|
||||
// The root node will not be shown
|
||||
store.add(model.getChildren(), true);
|
||||
store.sort("name", SortDir.ASC);
|
||||
|
||||
this.tree = new TreePanel<ModelData>(store);
|
||||
this.tree.setWidth(300);
|
||||
this.tree.setDisplayProperty("name");
|
||||
|
||||
// The icon decorator
|
||||
this.tree.setIconProvider(
|
||||
new ModelIconProvider<ModelData>() {
|
||||
public AbstractImagePrototype getIcon(final ModelData model) {
|
||||
if (model.get("node") != null && model.get("icon") != null) {
|
||||
return IconHelper.createStyle((String) model.get("icon"));
|
||||
}
|
||||
return IconHelper.createStyle("defaultleaf-icon");
|
||||
}
|
||||
});
|
||||
|
||||
// Handles the selection
|
||||
tree.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
|
||||
tree.getSelectionModel().addListener(Events.SelectionChange, new Listener<SelectionChangedEvent<AtomicTreeNode>>() {
|
||||
public void handleEvent(final SelectionChangedEvent<AtomicTreeNode> be) {
|
||||
AtomicTreeNode selectedModel = be.getSelectedItem();
|
||||
// -- SELECTED A LEAF
|
||||
if (selectedModel != null && selectedModel.isLeaf()) {
|
||||
ConsoleMessageBroker.trace(this, "Selected leaf of WS-Resource: " + ((AtomicTreeNode) selectedModel.getParent()).getNode() + "::" + selectedModel.getName());
|
||||
// FIXME the AtomicTreeNode does not contain a subtype information
|
||||
Commands.doFilterResourceDetailsGrid(this,
|
||||
StatusHandler.getStatus().getCurrentScope(),
|
||||
((AtomicTreeNode) selectedModel.getParent()).getNode(),
|
||||
selectedModel.getSubType());
|
||||
}
|
||||
// -- SELECTED A NOT LEAF NODE
|
||||
if (selectedModel != null && !selectedModel.isLeaf()) {
|
||||
ConsoleMessageBroker.trace(this, "Selected node: " + selectedModel.getNode());
|
||||
Commands.doLoadWSResourceDetailsGrid(this, StatusHandler.getStatus().getCurrentScope());
|
||||
}
|
||||
|
||||
be.setCancelled(true);
|
||||
// Removes the selection so that it can be easily refreshed.
|
||||
tree.getSelectionModel().deselectAll();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public final TreePanel<ModelData> getWidget() {
|
||||
return this.tree;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
/****************************************************************************
|
||||
* This software is part of the gCube Project.
|
||||
* Site: http://www.gcube-system.org/
|
||||
****************************************************************************
|
||||
* The gCube/gCore software is licensed as Free Open Source software
|
||||
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
* The software and documentation is provided by its authors/distributors
|
||||
* "as is" and no expressed or
|
||||
* implied warranty is given for its use, quality or fitness for a
|
||||
* particular case.
|
||||
****************************************************************************
|
||||
* Filename: ConsoleLogSeverity.java
|
||||
****************************************************************************
|
||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
||||
***************************************************************************/
|
||||
|
||||
package org.gcube.portlets.admin.resourcemanagement.client.widgets.console;
|
||||
|
||||
public enum ConsoleLogSeverity {
|
||||
INFO,
|
||||
LOG,
|
||||
TRACE,
|
||||
DEBUG,
|
||||
WARNING,
|
||||
ERROR,
|
||||
FATAL;
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
/****************************************************************************
|
||||
* This software is part of the gCube Project.
|
||||
* Site: http://www.gcube-system.org/
|
||||
****************************************************************************
|
||||
* The gCube/gCore software is licensed as Free Open Source software
|
||||
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
* The software and documentation is provided by its authors/distributors
|
||||
* "as is" and no expressed or
|
||||
* implied warranty is given for its use, quality or fitness for a
|
||||
* particular case.
|
||||
****************************************************************************
|
||||
* Filename: ConsoleMessage.java
|
||||
****************************************************************************
|
||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
||||
***************************************************************************/
|
||||
|
||||
package org.gcube.portlets.admin.resourcemanagement.client.widgets.console;
|
||||
|
||||
import java.util.Date;
|
||||
import com.extjs.gxt.ui.client.data.BaseModelData;
|
||||
import com.google.gwt.i18n.client.DateTimeFormat;
|
||||
|
||||
public class ConsoleMessage extends BaseModelData {
|
||||
|
||||
private static final long serialVersionUID = 1422116123911146319L;
|
||||
|
||||
public ConsoleMessage(final Object caller, final ConsoleLogSeverity type, final String message) {
|
||||
this(caller.getClass(), type, message);
|
||||
}
|
||||
|
||||
public ConsoleMessage(final Class<?> invoker, final ConsoleLogSeverity type, final String message) {
|
||||
this(invoker.getName(), type, message);
|
||||
}
|
||||
|
||||
public ConsoleMessage(final String invoker, final ConsoleLogSeverity type, final String message) {
|
||||
super();
|
||||
DateTimeFormat timeFormatter = DateTimeFormat.getFormat("dd-MM-yy hh:mm:ss");
|
||||
String timestamp = timeFormatter.format(new Date());
|
||||
set("timestamp", timestamp);
|
||||
set("invoker", invoker);
|
||||
set("type", type);
|
||||
set("message", message);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
/****************************************************************************
|
||||
* This software is part of the gCube Project.
|
||||
* Site: http://www.gcube-system.org/
|
||||
****************************************************************************
|
||||
* The gCube/gCore software is licensed as Free Open Source software
|
||||
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
* The software and documentation is provided by its authors/distributors
|
||||
* "as is" and no expressed or
|
||||
* implied warranty is given for its use, quality or fitness for a
|
||||
* particular case.
|
||||
****************************************************************************
|
||||
* Filename: ConsoleMessageBroker.java
|
||||
****************************************************************************
|
||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
||||
***************************************************************************/
|
||||
|
||||
package org.gcube.portlets.admin.resourcemanagement.client.widgets.console;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.registry.WidgetsRegistry;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
|
||||
public class ConsoleMessageBroker {
|
||||
|
||||
private static void printMessage(final ConsoleLogSeverity severity, final Object caller, final String message) {
|
||||
ConsolePanel console = WidgetsRegistry.getConsole();
|
||||
if (console != null) {
|
||||
console.handle(new ConsoleMessage(caller, severity, message));
|
||||
} else {
|
||||
GWT.log(message);
|
||||
}
|
||||
}
|
||||
|
||||
private static void printMessage(final ConsoleLogSeverity severity, final Class<?> caller, final String message) {
|
||||
ConsolePanel console = WidgetsRegistry.getConsole();
|
||||
if (console != null) {
|
||||
console.handle(new ConsoleMessage(caller.getName(), severity, message));
|
||||
} else {
|
||||
GWT.log(message);
|
||||
}
|
||||
}
|
||||
|
||||
public static void log(final Object caller, final String message) {
|
||||
printMessage(ConsoleLogSeverity.LOG, caller, message);
|
||||
}
|
||||
public static void info(final Object caller, final String message) {
|
||||
printMessage(ConsoleLogSeverity.INFO, caller, message);
|
||||
}
|
||||
public static void trace(final Object caller, final String message) {
|
||||
printMessage(ConsoleLogSeverity.TRACE, caller, message);
|
||||
}
|
||||
public static void debug(final Object caller, final String message) {
|
||||
printMessage(ConsoleLogSeverity.DEBUG, caller, message);
|
||||
}
|
||||
public static void warning(final Object caller, final String message) {
|
||||
printMessage(ConsoleLogSeverity.WARNING, caller, message);
|
||||
}
|
||||
public static void error(final Object caller, final String message) {
|
||||
printMessage(ConsoleLogSeverity.ERROR, caller, message);
|
||||
}
|
||||
|
||||
|
||||
public static void log(final Class<?> caller, final String message) {
|
||||
printMessage(ConsoleLogSeverity.LOG, caller, message);
|
||||
}
|
||||
public static void info(final Class<?> caller, final String message) {
|
||||
printMessage(ConsoleLogSeverity.INFO, caller, message);
|
||||
}
|
||||
public static void trace(final Class<?> caller, final String message) {
|
||||
printMessage(ConsoleLogSeverity.TRACE, caller, message);
|
||||
}
|
||||
public static void debug(final Class<?> caller, final String message) {
|
||||
printMessage(ConsoleLogSeverity.DEBUG, caller, message);
|
||||
}
|
||||
public static void warning(final Class<?> caller, final String message) {
|
||||
printMessage(ConsoleLogSeverity.WARNING, caller, message);
|
||||
}
|
||||
public static void error(final Class<?> caller, final String message) {
|
||||
printMessage(ConsoleLogSeverity.ERROR, caller, message);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,214 @@
|
|||
/****************************************************************************
|
||||
* This software is part of the gCube Project.
|
||||
* Site: http://www.gcube-system.org/
|
||||
****************************************************************************
|
||||
* The gCube/gCore software is licensed as Free Open Source software
|
||||
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
* The software and documentation is provided by its authors/distributors
|
||||
* "as is" and no expressed or
|
||||
* implied warranty is given for its use, quality or fitness for a
|
||||
* particular case.
|
||||
****************************************************************************
|
||||
* Filename: ConsolePanel.java
|
||||
****************************************************************************
|
||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
||||
***************************************************************************/
|
||||
|
||||
package org.gcube.portlets.admin.resourcemanagement.client.widgets.console;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.panels.DetachablePanel;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.panels.DetachablePanel.DetachablePanelHandler;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.panels.ScrollablePanel;
|
||||
|
||||
import com.extjs.gxt.ui.client.Style.SortDir;
|
||||
import com.extjs.gxt.ui.client.event.ComponentEvent;
|
||||
import com.extjs.gxt.ui.client.store.GroupingStore;
|
||||
import com.extjs.gxt.ui.client.store.ListStore;
|
||||
import com.extjs.gxt.ui.client.widget.Component;
|
||||
import com.extjs.gxt.ui.client.widget.button.Button;
|
||||
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
|
||||
import com.extjs.gxt.ui.client.widget.grid.ColumnData;
|
||||
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
|
||||
import com.extjs.gxt.ui.client.widget.grid.Grid;
|
||||
import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer;
|
||||
import com.extjs.gxt.ui.client.widget.grid.GridGroupRenderer;
|
||||
import com.extjs.gxt.ui.client.widget.grid.GroupColumnData;
|
||||
import com.extjs.gxt.ui.client.widget.grid.GroupingView;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
/**
|
||||
* Consists of a widgets containing a grid with
|
||||
* all the {@link ConsoleMessage} raised in the system.
|
||||
* @author Daniele Strollo (ISTI-CNR)
|
||||
*/
|
||||
public class ConsolePanel implements DetachablePanelHandler {
|
||||
private GroupingStore<ConsoleMessage> store;
|
||||
private DetachablePanel rootPanel = null;
|
||||
private boolean enableGrouping = false;
|
||||
private Grid<ConsoleMessage> grid = null;
|
||||
// The column on which the grouping is applied
|
||||
private final static String collapsibleColumn = "type";
|
||||
|
||||
public ConsolePanel(final DetachablePanel rootPanel) {
|
||||
super();
|
||||
this.rootPanel = rootPanel;
|
||||
this.rootPanel.addHandler(this);
|
||||
|
||||
store = new GroupingStore<ConsoleMessage>();
|
||||
if (enableGrouping) {
|
||||
store.groupBy(collapsibleColumn);
|
||||
}
|
||||
store.sort("timestamp", SortDir.DESC);
|
||||
this.onLoad();
|
||||
}
|
||||
|
||||
private void onLoad() {
|
||||
this.grid = createGrid();
|
||||
ScrollablePanel gridContainer = new ScrollablePanel("console-grid-container", grid);
|
||||
rootPanel.insertMainWidget(gridContainer);
|
||||
//rootPanel.getToolBar().
|
||||
Button groupButton = new Button("Group/Ungroup") {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent ce) {
|
||||
super.onClick(ce);
|
||||
if (enableGrouping) {
|
||||
store.clearGrouping();
|
||||
} else {
|
||||
store.groupBy(collapsibleColumn);
|
||||
}
|
||||
enableGrouping = !enableGrouping;
|
||||
}
|
||||
};
|
||||
groupButton.setIconStyle("grid-icon");
|
||||
rootPanel.getToolBar().add(groupButton);
|
||||
|
||||
Button clearButton = new Button("Clear") {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent ce) {
|
||||
super.onClick(ce);
|
||||
store.removeAll();
|
||||
}
|
||||
};
|
||||
clearButton.setIconStyle("clear-icon");
|
||||
rootPanel.getToolBar().add(clearButton);
|
||||
}
|
||||
|
||||
private Grid<ConsoleMessage> createGrid() {
|
||||
List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
|
||||
|
||||
ColumnConfig column = new ColumnConfig();
|
||||
column.setId("timestamp");
|
||||
column.setHeader("Time");
|
||||
column.setWidth(105);
|
||||
configs.add(column);
|
||||
|
||||
column = new ColumnConfig();
|
||||
column.setId("invoker");
|
||||
column.setHeader("Invoker");
|
||||
column.setWidth(420);
|
||||
configs.add(column);
|
||||
|
||||
column = new ColumnConfig();
|
||||
column.setId("type");
|
||||
column.setHeader("Type");
|
||||
column.setWidth(75);
|
||||
|
||||
column.setRenderer(new GridCellRenderer<ConsoleMessage>() {
|
||||
public Object render(
|
||||
final ConsoleMessage model,
|
||||
final String property,
|
||||
final ColumnData config,
|
||||
final int rowIndex,
|
||||
final int colIndex,
|
||||
final ListStore<ConsoleMessage> store,
|
||||
final Grid<ConsoleMessage> grid
|
||||
) {
|
||||
if (model.get("type") == ConsoleLogSeverity.WARNING) {
|
||||
return "<img src=\"/rm/images/icons/warning.png\" width=\"10\"><font color=\"#F88017\">" + model.get("type") + "</font>";
|
||||
}
|
||||
if (model.get("type") == ConsoleLogSeverity.ERROR) {
|
||||
return "<img src=\"/rm/images/icons/error.png\" width=\"10\"><font color=\"red\">" + model.get("type") + "</font>";
|
||||
}
|
||||
return "<img src=\"/rm/images/icons/log.png\" width=\"10\">" + model.get("type");
|
||||
}
|
||||
});
|
||||
|
||||
configs.add(column);
|
||||
|
||||
column = new ColumnConfig();
|
||||
column.setId("message");
|
||||
column.setHeader("Message");
|
||||
configs.add(column);
|
||||
|
||||
final ColumnModel cm = new ColumnModel(configs);
|
||||
|
||||
// Builds the grouping structure to collapse elements
|
||||
// having the same type (log severity).
|
||||
GroupingView view = new GroupingView();
|
||||
view.setGroupRenderer(new GridGroupRenderer() {
|
||||
public String render(final GroupColumnData data) {
|
||||
int s = data.models.size();
|
||||
String f = cm.getColumnById(data.field).getHeader();
|
||||
String l = s == 1 ? "Item" : "Items";
|
||||
return f + ": " + data.group + " (" + s + " " + l + ")";
|
||||
}
|
||||
});
|
||||
view.setShowGroupedColumn(false);
|
||||
|
||||
Grid<ConsoleMessage> grid = new Grid<ConsoleMessage>(store, cm);
|
||||
grid.setView(view);
|
||||
grid.setStyleAttribute("borderTop", "none");
|
||||
grid.setAutoExpandColumn("message");
|
||||
grid.setId("console-internal-grid");
|
||||
return grid;
|
||||
}
|
||||
|
||||
public final boolean handle(final ConsoleMessage event) {
|
||||
try {
|
||||
store.add(event);
|
||||
store.commitChanges();
|
||||
//this.rootPanel.layout(true);
|
||||
//this.refresh();
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
GWT.log("During console handle", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Is invoked by the time renderer on client side.
|
||||
* It forces the row to refresh after it has received from
|
||||
* the server side the required data.
|
||||
* @see ConsoleMessage
|
||||
*/
|
||||
public final void refresh() {
|
||||
this.rootPanel.layout(true);
|
||||
this.rootPanel.getRootPanel().sync(true);
|
||||
this.grid.sync(true);
|
||||
this.grid.getView().refresh(true);
|
||||
this.store.commitChanges();
|
||||
// Reapplies the sorting
|
||||
this.store.sort(this.store.getSortField(), this.store.getSortDir());
|
||||
}
|
||||
|
||||
public final DetachablePanel getContainer() {
|
||||
return this.rootPanel;
|
||||
}
|
||||
|
||||
public final Widget getWidget() {
|
||||
return this.grid;
|
||||
}
|
||||
|
||||
public final void onDetachEvent(final DetachablePanel container, final Component content) {
|
||||
this.grid.getView().refresh(true);
|
||||
}
|
||||
|
||||
public final void onEmbedEvent(final DetachablePanel container, final Component content) {
|
||||
this.grid.getView().refresh(true);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,139 @@
|
|||
/****************************************************************************
|
||||
* This software is part of the gCube Project.
|
||||
* Site: http://www.gcube-system.org/
|
||||
****************************************************************************
|
||||
* The gCube/gCore software is licensed as Free Open Source software
|
||||
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
* The software and documentation is provided by its authors/distributors
|
||||
* "as is" and no expressed or
|
||||
* implied warranty is given for its use, quality or fitness for a
|
||||
* particular case.
|
||||
****************************************************************************
|
||||
* Filename: ExtendedMessageBox.java
|
||||
****************************************************************************
|
||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
||||
***************************************************************************/
|
||||
|
||||
package org.gcube.portlets.admin.resourcemanagement.client.widgets.dialogs;
|
||||
|
||||
import com.extjs.gxt.ui.client.event.ComponentEvent;
|
||||
import com.extjs.gxt.ui.client.event.EventType;
|
||||
import com.extjs.gxt.ui.client.event.Events;
|
||||
import com.extjs.gxt.ui.client.event.KeyListener;
|
||||
import com.extjs.gxt.ui.client.event.KeyboardEvents;
|
||||
import com.extjs.gxt.ui.client.event.Listener;
|
||||
import com.extjs.gxt.ui.client.event.MessageBoxEvent;
|
||||
import com.extjs.gxt.ui.client.event.WindowEvent;
|
||||
import com.extjs.gxt.ui.client.widget.Dialog;
|
||||
import com.extjs.gxt.ui.client.widget.Label;
|
||||
import com.extjs.gxt.ui.client.widget.LayoutContainer;
|
||||
import com.extjs.gxt.ui.client.widget.form.TextField;
|
||||
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
||||
import com.extjs.gxt.ui.client.widget.layout.HBoxLayout;
|
||||
import com.extjs.gxt.ui.client.widget.layout.HBoxLayout.HBoxLayoutAlign;
|
||||
import com.google.gwt.event.dom.client.KeyDownEvent;
|
||||
import com.google.gwt.event.dom.client.KeyDownHandler;
|
||||
import com.google.gwt.user.client.Timer;
|
||||
import com.google.gwt.user.client.ui.HasAlignment;
|
||||
import com.google.gwt.user.client.ui.HasVerticalAlignment;
|
||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||
import com.google.gwt.user.client.ui.PasswordTextBox;
|
||||
import com.google.gwt.user.client.ui.SimplePanel;
|
||||
import com.google.gwt.user.client.ui.TextBox;
|
||||
|
||||
/**
|
||||
* @author Daniele Strollo (ISTI-CNR)
|
||||
*
|
||||
*/
|
||||
public class ExtendedMessageBox {
|
||||
private Dialog dialog = null;
|
||||
|
||||
PasswordTextBox pwdField = new PasswordTextBox();
|
||||
|
||||
public static ExtendedMessageBox password(
|
||||
final String title,
|
||||
final Listener<MessageBoxEvent> callback) {
|
||||
ExtendedMessageBox box = new ExtendedMessageBox();
|
||||
|
||||
if (callback != null) {
|
||||
box.addCallback(callback);
|
||||
}
|
||||
|
||||
box.setTitle(title);
|
||||
box.show();
|
||||
return box;
|
||||
}
|
||||
|
||||
public ExtendedMessageBox() {
|
||||
this.initDialog();
|
||||
}
|
||||
|
||||
public final void setTitle(final String text) {
|
||||
this.dialog.setHeading(text);
|
||||
}
|
||||
|
||||
|
||||
public final void addCallback(final Listener<MessageBoxEvent> listener) {
|
||||
dialog.addListener(Events.Hide, listener);
|
||||
}
|
||||
|
||||
private void initDialog() {
|
||||
this.dialog = new Dialog() {
|
||||
@Override
|
||||
protected ComponentEvent previewEvent(final EventType type, final ComponentEvent ce) {
|
||||
if (ce instanceof WindowEvent) {
|
||||
WindowEvent we = (WindowEvent) ce;
|
||||
MessageBoxEvent e = new MessageBoxEvent(null, this, we.getButtonClicked());
|
||||
if (type == Events.Hide || type == Events.BeforeHide) {
|
||||
if (pwdField != null) {
|
||||
e.setValue(pwdField.getValue());
|
||||
}
|
||||
}
|
||||
return e;
|
||||
}
|
||||
return super.previewEvent(type, ce);
|
||||
}
|
||||
};
|
||||
|
||||
dialog.setHideOnButtonClick(true);
|
||||
|
||||
dialog.setLayout(new FitLayout());
|
||||
dialog.setWidth(280);
|
||||
dialog.setHeight(120);
|
||||
dialog.setResizable(false);
|
||||
|
||||
pwdField.addKeyDownHandler(new KeyDownHandler() {
|
||||
|
||||
@Override
|
||||
public void onKeyDown(KeyDownEvent event) {
|
||||
if (event.getNativeKeyCode() == KeyboardEvents.Enter.getEventCode())
|
||||
dialog.hide();
|
||||
|
||||
}
|
||||
});
|
||||
pwdField.setStyleName("wizardTextBox");
|
||||
HorizontalPanel sp = new HorizontalPanel();
|
||||
sp.setHeight("120px");
|
||||
sp.setHorizontalAlignment(HasAlignment.ALIGN_CENTER);
|
||||
sp.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
|
||||
sp.setWidth("100%");
|
||||
|
||||
pwdField.setWidth("250px");
|
||||
sp.add(pwdField);
|
||||
this.dialog.add(sp);
|
||||
}
|
||||
|
||||
public final void show() {
|
||||
this.dialog.show();
|
||||
Timer t = new Timer() {
|
||||
@Override
|
||||
public void run() {
|
||||
focusPassword();
|
||||
}
|
||||
};
|
||||
t.schedule(500);
|
||||
}
|
||||
void focusPassword() {
|
||||
this.pwdField.setFocus(true);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,282 @@
|
|||
/****************************************************************************
|
||||
* This software is part of the gCube Project.
|
||||
* Site: http://www.gcube-system.org/
|
||||
****************************************************************************
|
||||
* The gCube/gCore software is licensed as Free Open Source software
|
||||
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
* The software and documentation is provided by its authors/distributors
|
||||
* "as is" and no expressed or
|
||||
* implied warranty is given for its use, quality or fitness for a
|
||||
* particular case.
|
||||
****************************************************************************
|
||||
* Filename: DetachablePanel.java
|
||||
****************************************************************************
|
||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
||||
***************************************************************************/
|
||||
|
||||
package org.gcube.portlets.admin.resourcemanagement.client.widgets.panels;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.utils.Commands;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.registry.WidgetsRegistry;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.viewport.MainContainer;
|
||||
import org.gcube.resourcemanagement.support.shared.util.Assertion;
|
||||
import org.gcube.resourcemanagement.support.shared.exceptions.InvalidParameterException;
|
||||
|
||||
import com.extjs.gxt.ui.client.event.ComponentEvent;
|
||||
import com.extjs.gxt.ui.client.widget.Component;
|
||||
import com.extjs.gxt.ui.client.widget.ContentPanel;
|
||||
import com.extjs.gxt.ui.client.widget.Dialog;
|
||||
import com.extjs.gxt.ui.client.widget.LayoutContainer;
|
||||
import com.extjs.gxt.ui.client.widget.button.Button;
|
||||
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
||||
import com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem;
|
||||
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
/**
|
||||
* Consists of a panel that can be inserted inside a container and
|
||||
* provides a functionality to be detached (and attached to it again).
|
||||
*
|
||||
* The detach button is executed in toggle mode.
|
||||
*
|
||||
* Once detached a dialog window is created to contain it.
|
||||
*
|
||||
* @author Daniele Strollo (ISTI-CNR)
|
||||
*
|
||||
*/
|
||||
public class DetachablePanel {
|
||||
|
||||
public interface DetachablePanelHandler {
|
||||
void onDetachEvent(DetachablePanel container, Component content);
|
||||
void onEmbedEvent(DetachablePanel container, Component content);
|
||||
}
|
||||
|
||||
private ToolBar toolBar = new ToolBar();
|
||||
private LayoutContainer parent = null;
|
||||
private boolean modal = true;
|
||||
private boolean isDetached = false;
|
||||
private ContentPanel rootPanel = null;
|
||||
private Button detachButton = null;
|
||||
private String title = "";
|
||||
private Component mainWidget = null;
|
||||
private final List<DetachablePanelHandler> handlers = new Vector<DetachablePanelHandler>();
|
||||
|
||||
/**
|
||||
* Depending on the status of detached panel, the
|
||||
* actual container can be the container in which it is
|
||||
* embedded or a dialog window.
|
||||
*/
|
||||
private LayoutContainer actualContainer = null;
|
||||
|
||||
/**
|
||||
* A detachable panel is created by specifying the widget
|
||||
* suitable to contain it.
|
||||
* Once detached the panel will be inserted in an ad-hoc dialog
|
||||
* window.
|
||||
* @param container the widget that will embed the panel
|
||||
* @param modal if the detached window must be modal
|
||||
*/
|
||||
public DetachablePanel(
|
||||
final LayoutContainer container,
|
||||
final String title,
|
||||
final String id,
|
||||
final boolean modal)
|
||||
throws InvalidParameterException {
|
||||
super();
|
||||
Assertion<InvalidParameterException> checker = new Assertion<InvalidParameterException>();
|
||||
checker.validate(container != null, new InvalidParameterException("The container parameter is null"));
|
||||
this.parent = container;
|
||||
this.parent.setLayout(new FitLayout());
|
||||
this.modal = modal;
|
||||
this.title = title;
|
||||
this.onLoad();
|
||||
this.rootPanel.setId(id);
|
||||
this.rootPanel.setHeaderVisible(false);
|
||||
this.rootPanel.getHeader().setStyleName("x-hide-panel-header");
|
||||
WidgetsRegistry.registerWidget(id, this.rootPanel);
|
||||
this.embedWindow();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the panel toolbar.
|
||||
* <p>
|
||||
* <b>Notice</b> that the button for detaching the panel from its parent
|
||||
* must not be removed to keep its functionality.
|
||||
* </p>
|
||||
* @return
|
||||
*/
|
||||
public final ToolBar getToolBar() {
|
||||
return this.toolBar;
|
||||
}
|
||||
|
||||
private void onLoad() {
|
||||
this.rootPanel = new ContentPanel() {
|
||||
@Override
|
||||
public void hide() {
|
||||
super.hide();
|
||||
if (actualContainer != null) {
|
||||
actualContainer.hide();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void show() {
|
||||
super.show();
|
||||
if (actualContainer != null) {
|
||||
actualContainer.show();
|
||||
}
|
||||
}
|
||||
};
|
||||
this.initToolBar();
|
||||
this.rootPanel.setId("detachable-panel-root");
|
||||
this.rootPanel.setTopComponent(this.toolBar);
|
||||
this.rootPanel.setLayout(new FitLayout());
|
||||
//this.rootPanel.setAutoHeight(true);
|
||||
this.rootPanel.setHeight("100%");
|
||||
this.rootPanel.remove(this.rootPanel.getHeader());
|
||||
this.rootPanel.layout();
|
||||
}
|
||||
|
||||
private void initToolBar() {
|
||||
this.detachButton = new Button() {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent ce) {
|
||||
toggleDetachWindow();
|
||||
}
|
||||
};
|
||||
detachButton.setToolTip("Embeds/Detaches the dialog");
|
||||
detachButton.setIconStyle("detach-icon");
|
||||
detachButton.setEnabled(true);
|
||||
toolBar.add(detachButton);
|
||||
toolBar.add(new SeparatorToolItem());
|
||||
}
|
||||
|
||||
/**
|
||||
* Detaches the console from the main panel and inserts it
|
||||
* inside a new dialog window.
|
||||
* This happens in toggle mode. So further detach will
|
||||
* attach again the console inside the main panel.
|
||||
*/
|
||||
private void toggleDetachWindow() {
|
||||
// Console will be detached and inserted inside
|
||||
// a newly created dialog.
|
||||
if (!isDetached) {
|
||||
this.detachWindow();
|
||||
this.onDetach();
|
||||
} else {
|
||||
this.embedWindow();
|
||||
this.onEmbed();
|
||||
}
|
||||
|
||||
isDetached = !isDetached;
|
||||
}
|
||||
|
||||
/**
|
||||
* Here is implemented the detaching of the panel from its
|
||||
* parent.
|
||||
*/
|
||||
private void detachWindow() {
|
||||
GWT.log("Detaching panel " + this.title);
|
||||
this.rootPanel.removeFromParent();
|
||||
|
||||
// The new window that will contain the detached panel
|
||||
Dialog dlg = new Dialog();
|
||||
|
||||
// Closes the widgets that initially contained the panel
|
||||
parent.disable();
|
||||
parent.removeFromParent();
|
||||
|
||||
dlg.setLayout(new FitLayout());
|
||||
// Setup the dialog window
|
||||
dlg.setHeading(this.title);
|
||||
dlg.setClosable(false);
|
||||
dlg.setModal(this.modal);
|
||||
dlg.setWidth(800);
|
||||
dlg.setHeight(500);
|
||||
dlg.setResizable(true);
|
||||
dlg.getButtonBar().removeAll();
|
||||
dlg.add(this.rootPanel);
|
||||
//dlg.setScrollMode(Scroll.AUTO);
|
||||
|
||||
actualContainer = dlg;
|
||||
|
||||
// Registers the dialog window
|
||||
WidgetsRegistry.registerWidget(this.rootPanel.getId() + "-dlg-detached", dlg);
|
||||
dlg.show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Embeds the panel inside its parent and closes the detached window.
|
||||
*/
|
||||
private void embedWindow() {
|
||||
GWT.log("Embedding panel " + this.title);
|
||||
parent.add(this.rootPanel);
|
||||
parent.enable();
|
||||
parent.layout(true);
|
||||
|
||||
actualContainer = parent;
|
||||
|
||||
Widget elem = WidgetsRegistry.getWidget(this.rootPanel.getId() + "-dlg-detached");
|
||||
if (elem != null) {
|
||||
elem.removeFromParent();
|
||||
}
|
||||
WidgetsRegistry.unregisterWidget(this.rootPanel.getId() + "-dlg-detached");
|
||||
}
|
||||
|
||||
public final ContentPanel getRootPanel() {
|
||||
return this.rootPanel;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called every time the panel is detached
|
||||
* from its parent.
|
||||
*
|
||||
* The custom behavior when detached must be defined here.
|
||||
*/
|
||||
protected final void onDetach() {
|
||||
// Forces the refresh of main container
|
||||
Commands.refreshViewport();
|
||||
this.rootPanel.layout(true);
|
||||
|
||||
for (DetachablePanelHandler handler : this.handlers) {
|
||||
handler.onDetachEvent(this, this.mainWidget);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called once the detached panel is embedded
|
||||
* inside its container.
|
||||
*/
|
||||
protected final void onEmbed() {
|
||||
MainContainer viewport = Commands.getViewport();
|
||||
// Re-insert the component inside the viewport
|
||||
viewport.add(this.parent);
|
||||
|
||||
// Forces the refresh of main container
|
||||
Commands.refreshViewport();
|
||||
this.rootPanel.layout(true);
|
||||
|
||||
for (DetachablePanelHandler handler : this.handlers) {
|
||||
handler.onEmbedEvent(this, this.mainWidget);
|
||||
}
|
||||
}
|
||||
|
||||
public final void insertMainWidget(final Component widget) {
|
||||
this.mainWidget = widget;
|
||||
this.getRootPanel().add(widget);
|
||||
}
|
||||
|
||||
public final void layout(final boolean force) {
|
||||
this.rootPanel.layout(force);
|
||||
}
|
||||
|
||||
public final void addHandler(final DetachablePanelHandler handler) {
|
||||
this.handlers.add(handler);
|
||||
}
|
||||
|
||||
public final void removeHandler(final DetachablePanelHandler handler) {
|
||||
this.handlers.remove(handler);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,113 @@
|
|||
/****************************************************************************
|
||||
* This software is part of the gCube Project.
|
||||
* Site: http://www.gcube-system.org/
|
||||
****************************************************************************
|
||||
* The gCube/gCore software is licensed as Free Open Source software
|
||||
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
* The software and documentation is provided by its authors/distributors
|
||||
* "as is" and no expressed or
|
||||
* implied warranty is given for its use, quality or fitness for a
|
||||
* particular case.
|
||||
****************************************************************************
|
||||
* Filename: GenericTreePanel.java
|
||||
****************************************************************************
|
||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
||||
***************************************************************************/
|
||||
|
||||
package org.gcube.portlets.admin.resourcemanagement.client.widgets.panels;
|
||||
|
||||
import org.gcube.portlets.admin.resourcemanagement.shared.utils.XMLUtil;
|
||||
import org.gcube.resourcemanagement.support.shared.types.datamodel.AtomicTreeNode;
|
||||
|
||||
import com.extjs.gxt.ui.client.Style.SortDir;
|
||||
import com.extjs.gxt.ui.client.data.ModelData;
|
||||
import com.extjs.gxt.ui.client.data.ModelIconProvider;
|
||||
import com.extjs.gxt.ui.client.event.ComponentEvent;
|
||||
import com.extjs.gxt.ui.client.store.TreeStore;
|
||||
import com.extjs.gxt.ui.client.util.IconHelper;
|
||||
import com.extjs.gxt.ui.client.widget.menu.Menu;
|
||||
import com.extjs.gxt.ui.client.widget.menu.MenuItem;
|
||||
import com.extjs.gxt.ui.client.widget.treepanel.TreePanel;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.user.client.ui.AbstractImagePrototype;
|
||||
|
||||
/**
|
||||
* @author Daniele Strollo (ISTI-CNR)
|
||||
*
|
||||
*/
|
||||
public class GenericTreePanel {
|
||||
private TreePanel<ModelData> tree = null;
|
||||
|
||||
public GenericTreePanel(final String xml, final String rootNode) {
|
||||
AtomicTreeNode model = new AtomicTreeNode(rootNode, null);
|
||||
|
||||
try {
|
||||
model.add(XMLUtil.XMLToTree(xml, rootNode));
|
||||
} catch (Exception e) {
|
||||
GWT.log("During profile conversion", e);
|
||||
}
|
||||
|
||||
TreeStore<ModelData> store = new TreeStore<ModelData>();
|
||||
// The root node will not be shown
|
||||
store.add(model.getChildren(), true);
|
||||
|
||||
store.sort("name", SortDir.ASC);
|
||||
|
||||
this.tree = new TreePanel<ModelData>(store) {
|
||||
private boolean loaded = false;
|
||||
@Override
|
||||
protected void onLoad() {
|
||||
super.onLoad();
|
||||
if (loaded) {
|
||||
return;
|
||||
}
|
||||
// Expands the first level only
|
||||
this.setExpanded(this.getStore().getRootItems().get(0), true, false);
|
||||
this.loaded = true;
|
||||
}
|
||||
};
|
||||
this.tree.setWidth(300);
|
||||
this.tree.setDisplayProperty("name");
|
||||
|
||||
this.tree.setHeight("100%");
|
||||
this.tree.setWidth("100%");
|
||||
|
||||
Menu subMenu = new Menu();
|
||||
subMenu.add(new MenuItem("Expand All") {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent be) {
|
||||
super.onClick(be);
|
||||
tree.expandAll();
|
||||
}
|
||||
});
|
||||
subMenu.add(new MenuItem("Collapse All") {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent be) {
|
||||
super.onClick(be);
|
||||
tree.collapseAll();
|
||||
}
|
||||
});
|
||||
this.tree.setContextMenu(subMenu);
|
||||
|
||||
// The icon decorator
|
||||
this.tree.setIconProvider(
|
||||
new ModelIconProvider<ModelData>() {
|
||||
public AbstractImagePrototype getIcon(final ModelData model) {
|
||||
if (model instanceof AtomicTreeNode) {
|
||||
AtomicTreeNode m = (AtomicTreeNode) model;
|
||||
if (m.isLeaf()) {
|
||||
return IconHelper.createStyle("console-log-icon");
|
||||
} else {
|
||||
return IconHelper.createStyle("profile-folder-icon");
|
||||
}
|
||||
}
|
||||
return IconHelper.createStyle("defaultleaf-icon");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public final TreePanel<ModelData> getWidget() {
|
||||
return this.tree;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,119 @@
|
|||
/****************************************************************************
|
||||
* This software is part of the gCube Project.
|
||||
* Site: http://www.gcube-system.org/
|
||||
****************************************************************************
|
||||
* The gCube/gCore software is licensed as Free Open Source software
|
||||
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
* The software and documentation is provided by its authors/distributors
|
||||
* "as is" and no expressed or
|
||||
* implied warranty is given for its use, quality or fitness for a
|
||||
* particular case.
|
||||
****************************************************************************
|
||||
* Filename: MainPanel.java
|
||||
****************************************************************************
|
||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
||||
***************************************************************************/
|
||||
|
||||
package org.gcube.portlets.admin.resourcemanagement.client.widgets.panels;
|
||||
|
||||
import com.extjs.gxt.ui.client.Style.LayoutRegion;
|
||||
import com.extjs.gxt.ui.client.util.Margins;
|
||||
import com.extjs.gxt.ui.client.widget.Component;
|
||||
import com.extjs.gxt.ui.client.widget.ContentPanel;
|
||||
import com.extjs.gxt.ui.client.widget.LayoutContainer;
|
||||
import com.extjs.gxt.ui.client.widget.layout.BorderLayoutData;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
public abstract class MainPanel {
|
||||
private BorderLayoutData layout = null;
|
||||
private ContentPanel container = null;
|
||||
|
||||
public MainPanel(final LayoutRegion position) {
|
||||
this.layout = new BorderLayoutData(position);
|
||||
this.container = new ContentPanel() {
|
||||
protected void onRender(final com.google.gwt.user.client.Element parent, final int pos) {
|
||||
super.onRender(parent, pos);
|
||||
init();
|
||||
};
|
||||
};
|
||||
this.setSplit(true);
|
||||
container.setHeaderVisible(false);
|
||||
}
|
||||
|
||||
public MainPanel(final int size, final LayoutRegion position) {
|
||||
this(position);
|
||||
this.layout.setSize(size);
|
||||
}
|
||||
|
||||
public MainPanel(final int size, final String title, final LayoutRegion position) {
|
||||
this(size, position);
|
||||
if (title != null) {
|
||||
this.container.setHeading(title);
|
||||
}
|
||||
}
|
||||
|
||||
public final BorderLayoutData getLayout() {
|
||||
return this.layout;
|
||||
}
|
||||
|
||||
public final void showHeader(final boolean showHeader) {
|
||||
this.container.setHeaderVisible(showHeader);
|
||||
}
|
||||
|
||||
public final LayoutContainer getContainer() {
|
||||
return this.container;
|
||||
}
|
||||
|
||||
public final void setMargins(final Margins margins) {
|
||||
this.layout.setMargins(margins);
|
||||
}
|
||||
|
||||
public final void setCollapsible(final boolean collapsible) {
|
||||
this.layout.setCollapsible(collapsible);
|
||||
}
|
||||
|
||||
public final void setFloatable(final boolean floatable) {
|
||||
this.layout.setFloatable(floatable);
|
||||
}
|
||||
|
||||
public final void setSplit(final boolean split) {
|
||||
this.layout.setSplit(split);
|
||||
}
|
||||
|
||||
|
||||
public final void add(final Widget w, final boolean removeOthers) {
|
||||
if (removeOthers) {
|
||||
this.container.removeAll();
|
||||
}
|
||||
this.container.add(w);
|
||||
this.container.layout();
|
||||
}
|
||||
|
||||
public final void setTopComponent(final Component component) {
|
||||
this.container.setTopComponent(component);
|
||||
}
|
||||
|
||||
public final void setBottomComponent(final Component component) {
|
||||
this.container.setBottomComponent(component);
|
||||
}
|
||||
|
||||
|
||||
public final void removeAll() {
|
||||
this.container.removeAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the following lines in the .css
|
||||
* <pre>
|
||||
* .x-hide-panel-header {
|
||||
* display:none !important;
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
public final void hideHeader() {
|
||||
this.container.setHeaderVisible(false);
|
||||
this.container.getHeader().setStyleName("x-hide-panel-header");
|
||||
}
|
||||
|
||||
public abstract void init();
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
/****************************************************************************
|
||||
* This software is part of the gCube Project.
|
||||
* Site: http://www.gcube-system.org/
|
||||
****************************************************************************
|
||||
* The gCube/gCore software is licensed as Free Open Source software
|
||||
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
* The software and documentation is provided by its authors/distributors
|
||||
* "as is" and no expressed or
|
||||
* implied warranty is given for its use, quality or fitness for a
|
||||
* particular case.
|
||||
****************************************************************************
|
||||
* Filename: ScrollablePanel.java
|
||||
****************************************************************************
|
||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
||||
***************************************************************************/
|
||||
|
||||
package org.gcube.portlets.admin.resourcemanagement.client.widgets.panels;
|
||||
|
||||
import com.extjs.gxt.ui.client.Style.Scroll;
|
||||
import com.extjs.gxt.ui.client.widget.Component;
|
||||
import com.extjs.gxt.ui.client.widget.ContentPanel;
|
||||
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
||||
import com.google.gwt.user.client.Element;
|
||||
|
||||
/**
|
||||
* @author Daniele Strollo (ISTI-CNR)
|
||||
*
|
||||
*/
|
||||
public class ScrollablePanel extends ContentPanel {
|
||||
|
||||
public ScrollablePanel() {
|
||||
super();
|
||||
this.setLayout(new FitLayout());
|
||||
this.setScrollMode(Scroll.AUTO);
|
||||
this.setHeaderVisible(false);
|
||||
this.setWidth("100%");
|
||||
this.setHeight("100%");
|
||||
this.setLayoutOnChange(true);
|
||||
|
||||
this.getHeader().setStyleName("x-hide-panel-header");
|
||||
}
|
||||
|
||||
public ScrollablePanel(final String id) {
|
||||
this();
|
||||
this.setId(id);
|
||||
}
|
||||
|
||||
public ScrollablePanel(final Component widget) {
|
||||
this();
|
||||
this.setScrollableWidget(widget);
|
||||
}
|
||||
|
||||
public ScrollablePanel(final String id, final Component widget) {
|
||||
this(id);
|
||||
this.setScrollableWidget(widget);
|
||||
}
|
||||
|
||||
public final void setScrollableWidget(final Component widget) {
|
||||
this.removeAll();
|
||||
widget.setWidth("100%");
|
||||
widget.setHeight("100%");
|
||||
this.add(widget);
|
||||
this.layout(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void onRender(final Element parent, final int pos) {
|
||||
super.onRender(parent, pos);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
/****************************************************************************
|
||||
* This software is part of the gCube Project.
|
||||
* Site: http://www.gcube-system.org/
|
||||
****************************************************************************
|
||||
* The gCube/gCore software is licensed as Free Open Source software
|
||||
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
* The software and documentation is provided by its authors/distributors
|
||||
* "as is" and no expressed or
|
||||
* implied warranty is given for its use, quality or fitness for a
|
||||
* particular case.
|
||||
****************************************************************************
|
||||
* Filename: UIIdentifiers.java
|
||||
****************************************************************************
|
||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
||||
***************************************************************************/
|
||||
|
||||
package org.gcube.portlets.admin.resourcemanagement.client.widgets.registry;
|
||||
|
||||
/**
|
||||
* @author Daniele Strollo (ISTI-CNR)
|
||||
*
|
||||
*/
|
||||
public class UIIdentifiers {
|
||||
// The panel containing the console
|
||||
public static final String CONSOLE_COMPONENT_ID = "console-panel";
|
||||
// The widget that will be used to send notification messages to the
|
||||
// console.
|
||||
public static final String CONSOLE_WIDGET_ID = "console-widget";
|
||||
// The main panel that will contain the console
|
||||
public static final String CONSOLE_PANEL_ID = "panel-south";
|
||||
// The ID of west panel (resource navigation)
|
||||
public static final String RESOURCE_NAVIGATION_PANEL = "panel-west";
|
||||
// The main panel containing the resource detail grid
|
||||
public static final String RESOURCE_DETAIL_GRID_PANEL = "resource-detail-grid-panel";
|
||||
// The wrapper of resource detail grid (getWidget will return the contained grid).
|
||||
public static final String RESOURCE_DETAIL_GRID_CONTAINER_ID = "resource-detail-grid";
|
||||
|
||||
// The tool bar in the main menu panel
|
||||
public static final String GLOBAL_STATUS_BAR_ID = "global-status-bar";
|
||||
public static final String STATUS_SCOPE_INFO_ID = "scope-info-status-bar";
|
||||
public static final String STATUS_LOADED_RESOURCES_ID = "loaded-resources-status-bar";
|
||||
public static final String STATUS_PROGRESS_BAR_ID = "progress-status-bar";
|
||||
|
||||
public static final String GLOBAL_MENUBAR_ID = "global-menu-bar";
|
||||
|
||||
public static final String BUTTON_AVAILABLE_SCOPES_ID = "btn-available-scopes";
|
||||
|
||||
public static final String MAIN_CONTAINER_VIEWPORT_ID = "main-container-viewport";
|
||||
|
||||
public static final String GLOBAL_MENU_CONTAINER_PANEL = "panel-north";
|
||||
public static final String TASKBAR_PANEL = "panel-est";
|
||||
}
|
|
@ -0,0 +1,96 @@
|
|||
/****************************************************************************
|
||||
* This software is part of the gCube Project.
|
||||
* Site: http://www.gcube-system.org/
|
||||
****************************************************************************
|
||||
* The gCube/gCore software is licensed as Free Open Source software
|
||||
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
* The software and documentation is provided by its authors/distributors
|
||||
* "as is" and no expressed or
|
||||
* implied warranty is given for its use, quality or fitness for a
|
||||
* particular case.
|
||||
****************************************************************************
|
||||
* Filename: WidgetsRegistry.java
|
||||
****************************************************************************
|
||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
||||
***************************************************************************/
|
||||
|
||||
package org.gcube.portlets.admin.resourcemanagement.client.widgets.registry;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.console.ConsolePanel;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.panels.MainPanel;
|
||||
import org.gcube.portlets.admin.resourcemanagement.shared.exceptions.WidgetNotRegistered;
|
||||
import org.gcube.resourcemanagement.support.shared.util.Assertion;
|
||||
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
public class WidgetsRegistry {
|
||||
private static final HashMap<String, Object> registeredWidgets = new HashMap<String, Object>();
|
||||
|
||||
public static synchronized void registerWidget(final String ID, final Widget widget) {
|
||||
registeredWidgets.put(ID, widget);
|
||||
}
|
||||
|
||||
public static synchronized void registerPanel(final String ID, final MainPanel widget) {
|
||||
registeredWidgets.put(ID, widget);
|
||||
}
|
||||
|
||||
public static synchronized MainPanel getPanel(final String ID) {
|
||||
if (!registeredWidgets.containsKey(ID) || !(registeredWidgets.get(ID) instanceof MainPanel)) {
|
||||
return null;
|
||||
}
|
||||
return (MainPanel) registeredWidgets.get(ID);
|
||||
}
|
||||
|
||||
public static synchronized Widget getWidget(final String ID) {
|
||||
if (!registeredWidgets.containsKey(ID) || !(registeredWidgets.get(ID) instanceof Widget)) {
|
||||
return null;
|
||||
}
|
||||
return (Widget) registeredWidgets.get(ID);
|
||||
}
|
||||
public static synchronized boolean containsElem(final String ID) {
|
||||
return registeredWidgets.containsKey(ID);
|
||||
}
|
||||
|
||||
public static synchronized Object getElem(final String key){
|
||||
return registeredWidgets.get(key);
|
||||
}
|
||||
|
||||
public static synchronized void unregisterWidget(final String key) {
|
||||
if (registeredWidgets.containsKey(key)) {
|
||||
registeredWidgets.remove(key);
|
||||
}
|
||||
}
|
||||
|
||||
public static synchronized void registerElem(final String ID, final Object widget) {
|
||||
registeredWidgets.put(ID, widget);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static final synchronized <T> Object getElem(final String key, final Class<T> elemType)
|
||||
throws WidgetNotRegistered {
|
||||
Assertion<WidgetNotRegistered> checker = new Assertion<WidgetNotRegistered>();
|
||||
checker.validate(registeredWidgets.containsKey(key), new WidgetNotRegistered("The widget " + key + " has not be registered"));
|
||||
Object retval = registeredWidgets.get(key);
|
||||
|
||||
try {
|
||||
return (T) retval;
|
||||
} catch (ClassCastException e) {
|
||||
throw new WidgetNotRegistered("The registered element is not of declared type");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility that returns the singleton instance of console panel.
|
||||
* @return null if the console has not been registered
|
||||
*/
|
||||
public static ConsolePanel getConsole() {
|
||||
try {
|
||||
return (ConsolePanel) WidgetsRegistry.getElem(UIIdentifiers.CONSOLE_WIDGET_ID, ConsolePanel.class);
|
||||
} catch (WidgetNotRegistered e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,202 @@
|
|||
/****************************************************************************
|
||||
* This software is part of the gCube Project.
|
||||
* Site: http://www.gcube-system.org/
|
||||
****************************************************************************
|
||||
* The gCube/gCore software is licensed as Free Open Source software
|
||||
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
* The software and documentation is provided by its authors/distributors
|
||||
* "as is" and no expressed or
|
||||
* implied warranty is given for its use, quality or fitness for a
|
||||
* particular case.
|
||||
****************************************************************************
|
||||
* Filename: TaskbarButton.java
|
||||
****************************************************************************
|
||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
||||
***************************************************************************/
|
||||
|
||||
package org.gcube.portlets.admin.resourcemanagement.client.widgets.taskbar;
|
||||
import static com.google.gwt.query.client.GQuery.$;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.utils.FWSTranslate;
|
||||
import org.gcube.resourcemanagement.support.client.views.ResourceTypeDecorator;
|
||||
|
||||
import com.extjs.gxt.ui.client.core.El;
|
||||
import com.extjs.gxt.ui.client.event.ComponentEvent;
|
||||
import com.extjs.gxt.ui.client.event.Events;
|
||||
import com.extjs.gxt.ui.client.event.SelectionListener;
|
||||
import com.extjs.gxt.ui.client.util.IconHelper;
|
||||
import com.extjs.gxt.ui.client.widget.Component;
|
||||
import com.extjs.gxt.ui.client.widget.IconSupport;
|
||||
import com.google.gwt.user.client.DOM;
|
||||
import com.google.gwt.user.client.Element;
|
||||
import com.google.gwt.user.client.Event;
|
||||
import com.google.gwt.user.client.Random;
|
||||
import com.google.gwt.user.client.Timer;
|
||||
import com.google.gwt.user.client.ui.AbstractImagePrototype;
|
||||
|
||||
/**
|
||||
* @author Massimiliano Assante (ISTI-CNR)
|
||||
*
|
||||
* A selectable icon (post-it styled) and text added to the pinned resources (TaskbarWindow).
|
||||
*/
|
||||
public class TaskbarButton extends Component implements IconSupport {
|
||||
private ResourceTypeDecorator type;
|
||||
private String text;
|
||||
private AbstractImagePrototype icon;
|
||||
private El iconEl;
|
||||
|
||||
/**
|
||||
* Creates a new shortcut.
|
||||
*/
|
||||
public TaskbarButton() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new shortcut.
|
||||
*
|
||||
* @param id the shortcut id
|
||||
* @param text the shortcut text
|
||||
*/
|
||||
public TaskbarButton(final String id, final ResourceTypeDecorator type, final String text) {
|
||||
setId(id);
|
||||
setText(text);
|
||||
this.type = type;
|
||||
|
||||
//for IE
|
||||
final Timer t2 = new Timer() {
|
||||
@Override
|
||||
public void run() {
|
||||
getElement().getFirstChildElement().getStyle().setOpacity(0.8);
|
||||
|
||||
}
|
||||
};
|
||||
//need to make sure the element is attached to the DOM
|
||||
Timer t = new Timer() {
|
||||
@Override
|
||||
public void run() {
|
||||
$(getElement().getFirstChildElement()).animate("opacity:'0.8'", 500);
|
||||
t2.schedule(500);
|
||||
}
|
||||
};
|
||||
|
||||
t.schedule(100);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a selection listener.
|
||||
*
|
||||
* @param listener the listener to add
|
||||
*/
|
||||
public final void addSelectionListener(final SelectionListener<? extends ComponentEvent> listener) {
|
||||
addListener(Events.Select, listener);
|
||||
}
|
||||
|
||||
public final AbstractImagePrototype getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the shortcuts text.
|
||||
*
|
||||
* @return the text
|
||||
*/
|
||||
public final String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void onComponentEvent(final ComponentEvent ce) {
|
||||
super.onComponentEvent(ce);
|
||||
if (ce.getEventTypeInt() == Event.ONCLICK) {
|
||||
onClick(ce);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a previously added listener.
|
||||
*
|
||||
* @param listener the listener to be removed
|
||||
*/
|
||||
public final void removeSelectionListener(final SelectionListener<? extends ComponentEvent> listener) {
|
||||
removeListener(Events.Select, listener);
|
||||
}
|
||||
|
||||
public final void setIcon(final AbstractImagePrototype icon) {
|
||||
if (rendered) {
|
||||
iconEl.setInnerHtml("");
|
||||
iconEl.appendChild((Element) icon.createElement().cast());
|
||||
}
|
||||
this.icon = icon;
|
||||
|
||||
}
|
||||
|
||||
public final void setIconStyle(final String icon) {
|
||||
setIcon(IconHelper.create(icon, 48, 48));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the shortcuts text.
|
||||
*
|
||||
* @param text the text
|
||||
*/
|
||||
public final void setText(final String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
protected void onClick(final ComponentEvent ce) {
|
||||
ce.stopEvent();
|
||||
fireEvent(Events.Select, ce);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void onRender(final Element target, final int index) {
|
||||
super.onRender(target, index);
|
||||
|
||||
|
||||
|
||||
String fontStyle = "font-size:12px; font-weight: 300; margin-top: 5px; padding: 5px; word-wrap: break-word;";
|
||||
setElement(DOM.createElement("dt"), target, index);
|
||||
|
||||
|
||||
|
||||
|
||||
final El a = el().createChild("<div class=\"iosItem\" style=\"background-color: "+ getExaBackgroundColor(type) + "; opacity: 0;\"><a href='#'></a></div>");
|
||||
iconEl = a.createChild(FWSTranslate.getFWSNameFromLabel(type.toString()));
|
||||
El txt = a.createChild("<div style=\""+fontStyle+"\" align=\"center\"></div>");
|
||||
|
||||
if (txt != null) {
|
||||
txt.setInnerHtml(text);
|
||||
}
|
||||
|
||||
el().updateZIndex(0);
|
||||
sinkEvents(Event.ONCLICK);
|
||||
if (icon != null) {
|
||||
setIcon(icon);
|
||||
}
|
||||
}
|
||||
|
||||
private String getExaBackgroundColor(ResourceTypeDecorator type) {
|
||||
switch (type) {
|
||||
case Collection:
|
||||
return "#aa84c1"; //violet
|
||||
case RunningInstance:
|
||||
return "#8aacd2"; //blue
|
||||
case GenericResource:
|
||||
return "#79bd84"; //green
|
||||
case GHN:
|
||||
return "#a4d03b"; //ramarro
|
||||
case RuntimeResource:
|
||||
return "#e4df00"; //yellow
|
||||
case Service:
|
||||
return "#fea500"; //orange
|
||||
case WSResource:
|
||||
return "#f6634f"; //red
|
||||
default:
|
||||
return "#CAEBFA"; //azur
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,174 @@
|
|||
/****************************************************************************
|
||||
* This software is part of the gCube Project.
|
||||
* Site: http://www.gcube-system.org/
|
||||
****************************************************************************
|
||||
* The gCube/gCore software is licensed as Free Open Source software
|
||||
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
* The software and documentation is provided by its authors/distributors
|
||||
* "as is" and no expressed or
|
||||
* implied warranty is given for its use, quality or fitness for a
|
||||
* particular case.
|
||||
****************************************************************************
|
||||
* Filename: IconizablePanel.java
|
||||
****************************************************************************
|
||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
||||
***************************************************************************/
|
||||
|
||||
package org.gcube.portlets.admin.resourcemanagement.client.widgets.taskbar;
|
||||
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.remote.ProxyRegistry;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.utils.Callbacks;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.utils.Commands;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.panels.MainPanel;
|
||||
import org.gcube.resourcemanagement.support.client.views.ResourceTypeDecorator;
|
||||
import org.gcube.resourcemanagement.support.shared.util.Configuration;
|
||||
|
||||
import com.extjs.gxt.ui.client.event.ComponentEvent;
|
||||
import com.extjs.gxt.ui.client.widget.menu.Menu;
|
||||
import com.extjs.gxt.ui.client.widget.menu.MenuItem;
|
||||
|
||||
/**
|
||||
* @author Massimiliano Assante (ISTI-CNR)
|
||||
* @author Daniele Strollo
|
||||
*
|
||||
*/
|
||||
public class TaskbarItem {
|
||||
private MainPanel parent = null;
|
||||
private TaskbarButton detachButton = null;
|
||||
private TaskbarWindow relatedWidget = null;
|
||||
private String resourceID = null;
|
||||
private ResourceTypeDecorator type = null;
|
||||
|
||||
|
||||
private String scope = null;
|
||||
|
||||
public TaskbarItem(
|
||||
final String scope,
|
||||
final ResourceTypeDecorator type, // optional
|
||||
final MainPanel container,
|
||||
final String resourceID,
|
||||
final String title,
|
||||
final String uiComponentID,
|
||||
final String buttonIcon) {
|
||||
this.parent = container;
|
||||
this.type = type;
|
||||
this.initUI(title, uiComponentID, buttonIcon);
|
||||
this.resourceID = resourceID;
|
||||
this.scope = scope;
|
||||
}
|
||||
|
||||
private String getScope() {
|
||||
return this.scope;
|
||||
}
|
||||
|
||||
private void initUI(final String title, final String id,final String buttonIcon) {
|
||||
|
||||
this.detachButton = new TaskbarButton("btn" + id, type, title) {
|
||||
protected void onClick(final com.extjs.gxt.ui.client.event.ComponentEvent ce) {
|
||||
relatedWidget.doMinimize();
|
||||
}
|
||||
};
|
||||
this.detachButton.setStyleName("taskbar-button");
|
||||
|
||||
this.detachButton.setIconStyle(buttonIcon);
|
||||
this.parent.add(this.detachButton, false);
|
||||
|
||||
this.relatedWidget = new TaskbarWindow(this);
|
||||
this.relatedWidget.setHeading(title);
|
||||
|
||||
if (Configuration.openProfileOnLoad) {
|
||||
this.activate();
|
||||
} else {
|
||||
this.relatedWidget.setIsMinimized(true);
|
||||
}
|
||||
|
||||
Menu mnu = new Menu();
|
||||
MenuItem close = new MenuItem("Close") {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent be) {
|
||||
super.onClick(be);
|
||||
relatedWidget.doClose();
|
||||
}
|
||||
};
|
||||
close.setIconStyle("close-icon");
|
||||
mnu.add(close);
|
||||
|
||||
MenuItem closeAll = new MenuItem("CloseAll") {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent be) {
|
||||
super.onClick(be);
|
||||
TaskbarRegister.closeAll();
|
||||
}
|
||||
};
|
||||
closeAll.setIconStyle("closeall-icon");
|
||||
mnu.add(closeAll);
|
||||
|
||||
if (type != null && type == ResourceTypeDecorator.DeployReport) {
|
||||
MenuItem refresh = new MenuItem("Refresh") {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent be) {
|
||||
super.onClick(be);
|
||||
ProxyRegistry.getProxyInstance().checkDeployStatus(
|
||||
getScope(),
|
||||
resourceID.trim(),
|
||||
Callbacks.handleGetDeploymentReport);
|
||||
}
|
||||
};
|
||||
refresh.setIconStyle("refresh-icon");
|
||||
mnu.add(refresh);
|
||||
}
|
||||
|
||||
if (type != null &&
|
||||
(type == ResourceTypeDecorator.GHN ||
|
||||
type == ResourceTypeDecorator.VIEW ||
|
||||
type == ResourceTypeDecorator.Collection ||
|
||||
type == ResourceTypeDecorator.GenericResource ||
|
||||
type == ResourceTypeDecorator.RunningInstance ||
|
||||
type == ResourceTypeDecorator.Service)
|
||||
) {
|
||||
MenuItem refresh = new MenuItem("Refresh") {
|
||||
@Override
|
||||
protected void onClick(final ComponentEvent be) {
|
||||
super.onClick(be);
|
||||
Commands.doGetResourceProfileByID(
|
||||
this,
|
||||
getScope(),
|
||||
resourceID.trim());
|
||||
}
|
||||
};
|
||||
refresh.setIconStyle("refresh-icon");
|
||||
mnu.add(refresh);
|
||||
}
|
||||
|
||||
this.detachButton.setContextMenu(mnu);
|
||||
}
|
||||
|
||||
public final String getResourceID() {
|
||||
return this.resourceID;
|
||||
}
|
||||
|
||||
public final void destroy() {
|
||||
try {
|
||||
TaskbarRegister.unregisterTaskbarWidget(this.resourceID);
|
||||
this.parent.getContainer().remove(this.detachButton);
|
||||
this.relatedWidget.hide();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
protected final void disactivate() {
|
||||
this.detachButton.setStyleName("taskbar-button");
|
||||
}
|
||||
|
||||
protected final void activate() {
|
||||
this.detachButton.setStyleName("taskbar-button-active");
|
||||
}
|
||||
|
||||
public final TaskbarWindow getRelatedWindow() {
|
||||
return this.relatedWidget;
|
||||
}
|
||||
|
||||
public ResourceTypeDecorator getType() {
|
||||
return type;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,114 @@
|
|||
/****************************************************************************
|
||||
* This software is part of the gCube Project.
|
||||
* Site: http://www.gcube-system.org/
|
||||
****************************************************************************
|
||||
* The gCube/gCore software is licensed as Free Open Source software
|
||||
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
* The software and documentation is provided by its authors/distributors
|
||||
* "as is" and no expressed or
|
||||
* implied warranty is given for its use, quality or fitness for a
|
||||
* particular case.
|
||||
****************************************************************************
|
||||
* Filename: TaskbarRegister.java
|
||||
****************************************************************************
|
||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
||||
***************************************************************************/
|
||||
|
||||
package org.gcube.portlets.admin.resourcemanagement.client.widgets.taskbar;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.console.ConsoleMessageBroker;
|
||||
import org.gcube.resourcemanagement.support.client.views.ResourceTypeDecorator;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
|
||||
/**
|
||||
* Manages the widgets registered in the taskbar.
|
||||
* Useful to implement the "close all" and to avoid
|
||||
* duplicates.
|
||||
* @author Daniele Strollo (ISTI-CNR)
|
||||
*
|
||||
*/
|
||||
public class TaskbarRegister {
|
||||
final static HashMap<String, TaskbarItem> registeredItems = new HashMap<String, TaskbarItem>();
|
||||
static TaskbarWindow lastOpenedWindow = null;
|
||||
|
||||
public static int getCurrAddScopeReportsNumber() {
|
||||
int count = 0;
|
||||
for (String item : registeredItems.keySet()) {
|
||||
GWT.log(item);
|
||||
if (registeredItems.get(item).getType() == ResourceTypeDecorator.AddScopeReport )
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
public static synchronized void setLastOpenedWindow(TaskbarWindow lastOpenedWindow) {
|
||||
TaskbarRegister.lastOpenedWindow = lastOpenedWindow;
|
||||
}
|
||||
|
||||
public static synchronized TaskbarWindow getLastOpenedWindow() {
|
||||
return TaskbarRegister.lastOpenedWindow;
|
||||
}
|
||||
|
||||
public static synchronized void registerTaskbarWidget(final String id, final TaskbarItem item) {
|
||||
ConsoleMessageBroker.info(TaskbarRegister.class, "Registering res: " + id);
|
||||
registeredItems.put(id, item);
|
||||
}
|
||||
|
||||
public static synchronized void unregisterTaskbarWidget(final String id) {
|
||||
ConsoleMessageBroker.info(TaskbarRegister.class, "Unregistering res: " + id);
|
||||
registeredItems.remove(id);
|
||||
}
|
||||
|
||||
public static synchronized TaskbarItem getTaskbarItem(final String id) {
|
||||
if (registeredItems.containsKey(id)) {
|
||||
return registeredItems.get(id);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static synchronized boolean contains(final String key) {
|
||||
return registeredItems.containsKey(key);
|
||||
}
|
||||
|
||||
public static synchronized void minimizeAll() {
|
||||
Object[] items = registeredItems.values().toArray();
|
||||
ConsoleMessageBroker.trace(TaskbarRegister.class, "Elems to remove: " + items.length);
|
||||
TaskbarItem curItem = null;
|
||||
for (Object elem : items){
|
||||
try {
|
||||
if (elem != null) {
|
||||
curItem = ((TaskbarItem)elem);
|
||||
if (!curItem.getRelatedWindow().isMinimized()) {
|
||||
curItem.getRelatedWindow().doMinimize();
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
GWT.log("During remove all profiles", e);
|
||||
ConsoleMessageBroker.error(TaskbarRegister.class, e.getMessage());
|
||||
}
|
||||
}
|
||||
ConsoleMessageBroker.info(TaskbarRegister.class, "Unregistering all resources");
|
||||
}
|
||||
|
||||
public static synchronized void closeAll() {
|
||||
Object[] items = registeredItems.values().toArray();
|
||||
ConsoleMessageBroker.trace(TaskbarRegister.class, "Elems to remove: " + items.length);
|
||||
for (Object elem : items){
|
||||
try {
|
||||
if (elem != null) {
|
||||
((TaskbarItem)elem).getRelatedWindow().doClose();
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
GWT.log("During remove all profiles", e);
|
||||
ConsoleMessageBroker.error(TaskbarRegister.class, e.getMessage());
|
||||
}
|
||||
}
|
||||
ConsoleMessageBroker.info(TaskbarRegister.class, "Unregistering all resources");
|
||||
registeredItems.clear();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,103 @@
|
|||
/****************************************************************************
|
||||
* This software is part of the gCube Project.
|
||||
* Site: http://www.gcube-system.org/
|
||||
****************************************************************************
|
||||
* The gCube/gCore software is licensed as Free Open Source software
|
||||
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
* The software and documentation is provided by its authors/distributors
|
||||
* "as is" and no expressed or
|
||||
* implied warranty is given for its use, quality or fitness for a
|
||||
* particular case.
|
||||
****************************************************************************
|
||||
* Filename: TaskbarWindow.java
|
||||
****************************************************************************
|
||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
||||
***************************************************************************/
|
||||
|
||||
package org.gcube.portlets.admin.resourcemanagement.client.widgets.taskbar;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.console.ConsoleMessageBroker;
|
||||
import org.gcube.resourcemanagement.support.shared.util.Configuration;
|
||||
|
||||
import com.extjs.gxt.ui.client.event.IconButtonEvent;
|
||||
import com.extjs.gxt.ui.client.event.SelectionListener;
|
||||
import com.extjs.gxt.ui.client.widget.Component;
|
||||
import com.extjs.gxt.ui.client.widget.Window;
|
||||
import com.extjs.gxt.ui.client.widget.button.ToolButton;
|
||||
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
||||
|
||||
/**
|
||||
* @author Daniele Strollo (ISTI-CNR)
|
||||
*
|
||||
*/
|
||||
public class TaskbarWindow extends Window {
|
||||
private TaskbarItem relatedItem = null;
|
||||
private boolean isMinimized = false;
|
||||
|
||||
public static ArrayList<Integer> extractedColors = new ArrayList<Integer>();
|
||||
|
||||
protected TaskbarWindow(final TaskbarItem relatedItem) {
|
||||
super();
|
||||
this.setModal(false);
|
||||
this.setClosable(false);
|
||||
this.setLayout(new FitLayout());
|
||||
this.relatedItem = relatedItem;
|
||||
|
||||
this.setWidth(800);
|
||||
this.setHeight(500);
|
||||
|
||||
this.getHeader().addTool(new ToolButton("x-tool-minimize", new SelectionListener<IconButtonEvent>() {
|
||||
@Override
|
||||
public void componentSelected(final IconButtonEvent ce) {
|
||||
doMinimize();
|
||||
}
|
||||
}));
|
||||
/* removed the close functionality from the window. only the button can be closed
|
||||
this.getHeader().addTool(new ToolButton("x-tool-close", new SelectionListener<IconButtonEvent>() {
|
||||
@Override
|
||||
public void componentSelected(final IconButtonEvent ce) {
|
||||
doClose();
|
||||
}
|
||||
}));
|
||||
*/
|
||||
if (Configuration.openProfileOnLoad) {
|
||||
this.show();
|
||||
}
|
||||
}
|
||||
|
||||
protected final void doClose() {
|
||||
ConsoleMessageBroker.trace(this, "Closing taskbar item: " + this.relatedItem.getResourceID());
|
||||
this.relatedItem.destroy();
|
||||
this.hide();
|
||||
}
|
||||
|
||||
protected final void doMinimize() {
|
||||
if (this.isMinimized) {
|
||||
if (!Configuration.allowMultipleProfiles) {
|
||||
TaskbarRegister.minimizeAll();
|
||||
}
|
||||
this.show();
|
||||
this.relatedItem.activate();
|
||||
} else {
|
||||
this.hide();
|
||||
this.relatedItem.disactivate();
|
||||
}
|
||||
this.isMinimized = !isMinimized;
|
||||
}
|
||||
|
||||
public final void setIsMinimized(boolean minimized) {
|
||||
this.isMinimized = minimized;
|
||||
}
|
||||
|
||||
public final boolean isMinimized() {
|
||||
return this.isMinimized;
|
||||
}
|
||||
|
||||
public final void setMainWidget(final Component widget) {
|
||||
this.removeAll();
|
||||
this.add(widget);
|
||||
this.layout(true);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
/****************************************************************************
|
||||
* This software is part of the gCube Project.
|
||||
* Site: http://www.gcube-system.org/
|
||||
****************************************************************************
|
||||
* The gCube/gCore software is licensed as Free Open Source software
|
||||
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
* The software and documentation is provided by its authors/distributors
|
||||
* "as is" and no expressed or
|
||||
* implied warranty is given for its use, quality or fitness for a
|
||||
* particular case.
|
||||
****************************************************************************
|
||||
* Filename: MainContainer.java
|
||||
****************************************************************************
|
||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
||||
***************************************************************************/
|
||||
|
||||
package org.gcube.portlets.admin.resourcemanagement.client.widgets.viewport;
|
||||
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.panels.MainPanel;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.widgets.registry.WidgetsRegistry;
|
||||
import com.extjs.gxt.ui.client.widget.LayoutContainer;
|
||||
|
||||
/**
|
||||
* @author Daniele Strollo (ISTI-CNR)
|
||||
*/
|
||||
public class MainContainer extends LayoutContainer {
|
||||
public MainContainer() {
|
||||
super();
|
||||
//- this.setPagePosition(0, 150);
|
||||
}
|
||||
|
||||
public boolean add(String id, MainPanel item) {
|
||||
WidgetsRegistry.registerWidget(id, item.getContainer());
|
||||
return super.add(item.getContainer(), item.getLayout());
|
||||
}
|
||||
|
||||
public boolean addPanel(String id, MainPanel item) {
|
||||
WidgetsRegistry.registerPanel(id, item);
|
||||
return super.add(item.getContainer(), item.getLayout());
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,211 @@
|
|||
/****************************************************************************
|
||||
* This software is part of the gCube Project.
|
||||
* Site: http://www.gcube-system.org/
|
||||
****************************************************************************
|
||||
* The gCube/gCore software is licensed as Free Open Source software
|
||||
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
* The software and documentation is provided by its authors/distributors
|
||||
* "as is" and no expressed or
|
||||
* implied warranty is given for its use, quality or fitness for a
|
||||
* particular case.
|
||||
****************************************************************************
|
||||
* Filename: ResourceCommands.java
|
||||
****************************************************************************
|
||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
||||
***************************************************************************/
|
||||
|
||||
package org.gcube.portlets.admin.resourcemanagement.server;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.common.scope.impl.ScopeBean;
|
||||
import org.gcube.resourcemanagement.support.client.utils.CurrentStatus;
|
||||
import org.gcube.resourcemanagement.support.shared.util.Assertion;
|
||||
import org.gcube.resourcemanagement.support.server.managers.resources.CollectionManager;
|
||||
import org.gcube.resourcemanagement.support.server.managers.resources.GHNManager;
|
||||
import org.gcube.resourcemanagement.support.server.managers.resources.GenericResourceManager;
|
||||
import org.gcube.resourcemanagement.support.server.managers.resources.RuntimeResourceManager;
|
||||
import org.gcube.resourcemanagement.support.server.types.AllowedResourceTypes;
|
||||
import org.gcube.resourcemanagement.support.server.utils.ServerConsole;
|
||||
import org.gcube.resourcemanagement.support.shared.exceptions.InvalidParameterException;
|
||||
import org.gcube.resourcemanagement.support.shared.operations.SupportedOperations;
|
||||
import org.gcube.resourcemanagement.support.shared.types.datamodel.ResourceDescriptor;
|
||||
|
||||
/**
|
||||
* @author Daniele Strollo (ISTI-CNR)
|
||||
*
|
||||
*/
|
||||
public class ResourceCommands {
|
||||
private static final String LOG_PREFIX = "[RES-CMDS]";
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void doOperation(
|
||||
final CurrentStatus status,
|
||||
final SupportedOperations opCode,
|
||||
final String scope,
|
||||
final List<ResourceDescriptor> resources)
|
||||
throws Exception {
|
||||
ServerConsole.debug(LOG_PREFIX, "[RES-COMMANDS-DO] Required operation: " + opCode);
|
||||
|
||||
Assertion<InvalidParameterException> checker = new Assertion<InvalidParameterException>();
|
||||
checker.validate(opCode != null, new InvalidParameterException("Invalid operation required"));
|
||||
checker.validate(scope != null && scope.length() > 0,
|
||||
new InvalidParameterException("Invalid scope."));
|
||||
checker.validate(resources != null && resources.size() > 0,
|
||||
new InvalidParameterException("Invalid resource descriptor."));
|
||||
// Checks permissions
|
||||
checker.validate(opCode.isAllowed(status.getCredentials()),
|
||||
new InvalidParameterException("The current user is not allowed to execute the operation."));
|
||||
|
||||
ScopeBean gscope = new ScopeBean(scope);
|
||||
|
||||
/**********************************************************
|
||||
* GHN
|
||||
*********************************************************/
|
||||
|
||||
// SHUTDOWN
|
||||
if (opCode.equals(SupportedOperations.GHN_SHUTDOWN)) {
|
||||
for (ResourceDescriptor resource : resources) {
|
||||
checker.validate(
|
||||
resource.getType().equals(AllowedResourceTypes.GHN.name()),
|
||||
new InvalidParameterException("Invalid type. GHN required"));
|
||||
new GHNManager(resource.getID(), resource.getName()).shutDown(gscope, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
// RESTART
|
||||
if (opCode.equals(SupportedOperations.GHN_RESTART) || opCode.equals(SupportedOperations.GHN_CLEAN_RESTART)) {
|
||||
for (ResourceDescriptor resource : resources) {
|
||||
checker.validate(
|
||||
resource.getType().equals(AllowedResourceTypes.GHN.name()),
|
||||
new InvalidParameterException("Invalid type. GHN required"));
|
||||
new GHNManager(resource.getID(), resource.getName()).shutDown(gscope,
|
||||
// restart
|
||||
true,
|
||||
// to clean?
|
||||
(opCode.equals(SupportedOperations.GHN_CLEAN_RESTART) ? true : false));
|
||||
}
|
||||
}
|
||||
|
||||
// DELETE
|
||||
if (opCode.equals(SupportedOperations.GHN_DELETE)) {
|
||||
for (ResourceDescriptor resource : resources) {
|
||||
checker.validate(
|
||||
resource.getType().equals(AllowedResourceTypes.GHN.name()),
|
||||
new InvalidParameterException("Invalid type. GHN required"));
|
||||
new GHNManager(resource.getID()).delete(gscope);
|
||||
}
|
||||
}
|
||||
|
||||
// DELETE
|
||||
if (opCode.equals(SupportedOperations.GHN_FORCE_DELETE)) {
|
||||
for (ResourceDescriptor resource : resources) {
|
||||
checker.validate(
|
||||
resource.getType().equals(AllowedResourceTypes.GHN.name()),
|
||||
new InvalidParameterException("Invalid type. GHN required"));
|
||||
new GHNManager(resource.getID()).forceDelete(gscope);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************
|
||||
* GENERIC RESOURCE
|
||||
*********************************************************/
|
||||
// DELETE
|
||||
if (opCode.equals(SupportedOperations.GENERIC_RESOURCE_DELETE)) {
|
||||
for (ResourceDescriptor resource : resources) {
|
||||
checker.validate(
|
||||
resource.getType().equals(AllowedResourceTypes.GenericResource.name()),
|
||||
new InvalidParameterException("Invalid type. " + AllowedResourceTypes.GenericResource.name() + " required"));
|
||||
new GenericResourceManager(resource.getID()).delete(gscope);
|
||||
}
|
||||
}
|
||||
// DELETE
|
||||
if (opCode.equals(SupportedOperations.GENERIC_RESOURCE_FORCE_DELETE)) {
|
||||
for (ResourceDescriptor resource : resources) {
|
||||
checker.validate(
|
||||
resource.getType().equals(AllowedResourceTypes.GenericResource.name()),
|
||||
new InvalidParameterException("Invalid type. " + AllowedResourceTypes.GenericResource.name() + " required"));
|
||||
new GenericResourceManager(resource.getID()).forceDelete(gscope);
|
||||
}
|
||||
}
|
||||
|
||||
/**********************************************************
|
||||
* RUNTIME RESOURCE
|
||||
*********************************************************/
|
||||
// DELETE
|
||||
if (opCode.equals(SupportedOperations.RUNTIME_RESOURCE_DELETE)) {
|
||||
System.out.println("DELETING RUNTIME RESOURCE");
|
||||
for (ResourceDescriptor resource : resources) {
|
||||
checker.validate(
|
||||
resource.getType().equals(AllowedResourceTypes.RuntimeResource.name()),
|
||||
new InvalidParameterException("Invalid type. " + AllowedResourceTypes.RuntimeResource.name() + " required"));
|
||||
new RuntimeResourceManager(resource.getID()).delete(gscope);
|
||||
}
|
||||
}
|
||||
// DELETE
|
||||
if (opCode.equals(SupportedOperations.RUNTIME_RESOURCE_FORCE_DELETE)) {
|
||||
for (ResourceDescriptor resource : resources) {
|
||||
checker.validate(
|
||||
resource.getType().equals(AllowedResourceTypes.RuntimeResource.name()),
|
||||
new InvalidParameterException("Invalid type. " + AllowedResourceTypes.RuntimeResource.name() + " required"));
|
||||
new RuntimeResourceManager(resource.getID()).forceDelete(gscope);
|
||||
}
|
||||
}
|
||||
|
||||
/**********************************************************
|
||||
* COLLECTION
|
||||
*********************************************************/
|
||||
// DELETE
|
||||
if (opCode.equals(SupportedOperations.COLLECTION_DELETE)) {
|
||||
for (ResourceDescriptor resource : resources) {
|
||||
checker.validate(
|
||||
resource.getType().equals(AllowedResourceTypes.Collection.name()),
|
||||
new InvalidParameterException("Invalid type. " + AllowedResourceTypes.Collection.name() + " required"));
|
||||
new CollectionManager(resource.getID()).delete(gscope);
|
||||
}
|
||||
}
|
||||
// DELETE
|
||||
if (opCode.equals(SupportedOperations.COLLECTION_FORCE_DELETE)) {
|
||||
for (ResourceDescriptor resource : resources) {
|
||||
checker.validate(
|
||||
resource.getType().equals(AllowedResourceTypes.Collection.name()),
|
||||
new InvalidParameterException("Invalid type. " + AllowedResourceTypes.Collection.name() + " required"));
|
||||
new CollectionManager(resource.getID()).forceDelete(gscope);
|
||||
}
|
||||
}
|
||||
|
||||
/**********************************************************
|
||||
* VIEW
|
||||
*********************************************************/
|
||||
// // DELETE
|
||||
// if (opCode.equals(SupportedOperations.VIEW_DELETE)) {
|
||||
// for (ResourceDescriptor resource : resources) {
|
||||
// checker.validate(
|
||||
// resource.getType().equals(AllowedResourceTypes.VIEW.name()),
|
||||
// new InvalidParameterException("Invalid type. " + AllowedResourceTypes.VIEW.name() + " required"));
|
||||
// new ViewManager(resource.getID()).delete(gscope);
|
||||
// }
|
||||
// }
|
||||
// // DELETE
|
||||
// if (opCode.equals(SupportedOperations.VIEW_FORCE_DELETE)) {
|
||||
// for (ResourceDescriptor resource : resources) {
|
||||
// checker.validate(
|
||||
// resource.getType().equals(AllowedResourceTypes.VIEW.name()),
|
||||
// new InvalidParameterException("Invalid type. " + AllowedResourceTypes.VIEW.name() + " required"));
|
||||
// new ViewManager(resource.getID()).forceDelete(gscope);
|
||||
// }
|
||||
// }
|
||||
|
||||
/**********************************************************
|
||||
* RUNNING INSTANCE
|
||||
*********************************************************/
|
||||
if (opCode.equals(SupportedOperations.RUNNING_INSTANCE_UNDEPLOY)) {
|
||||
for (ResourceDescriptor resource : resources) {
|
||||
ServerConsole.debug(LOG_PREFIX, "Undeploying RI: " + resource.getID());
|
||||
// FIXME per massi: togli questi commenti per abilitare undeploy
|
||||
// new RunningInstanceManager(resource.getID()).undeploy(gscope);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,534 @@
|
|||
/****************************************************************************
|
||||
* This software is part of the gCube Project.
|
||||
* Site: http://www.gcube-system.org/
|
||||
****************************************************************************
|
||||
* The gCube/gCore software is licensed as Free Open Source software
|
||||
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
* The software and documentation is provided by its authors/distributors
|
||||
* "as is" and no expressed or
|
||||
* implied warranty is given for its use, quality or fitness for a
|
||||
* particular case.
|
||||
****************************************************************************
|
||||
* Filename: ServiceProxyImpl.java
|
||||
****************************************************************************
|
||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
||||
***************************************************************************/
|
||||
|
||||
package org.gcube.portlets.admin.resourcemanagement.server;
|
||||
|
||||
import static org.gcube.resources.discovery.icclient.ICFactory.client;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.StringReader;
|
||||
import java.security.InvalidParameterException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.spec.InvalidKeySpecException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Vector;
|
||||
|
||||
import javax.crypto.SecretKeyFactory;
|
||||
import javax.crypto.spec.PBEKeySpec;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
|
||||
import org.gcube.common.resources.gcore.utils.XPathHelper;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.common.scope.impl.ScopeBean;
|
||||
import org.gcube.portlets.admin.resourcemanagement.client.remote.ServiceProxy;
|
||||
import org.gcube.portlets.admin.resourcemanagement.server.gcube.services.StatusHandler;
|
||||
import org.gcube.portlets.admin.resourcemanagement.server.gcube.services.configuration.ConfigurationLoader;
|
||||
import org.gcube.resourcemanagement.support.client.utils.CurrentStatus;
|
||||
import org.gcube.resourcemanagement.support.client.views.ResourceTypeDecorator;
|
||||
import org.gcube.resourcemanagement.support.server.gcube.CacheManager;
|
||||
import org.gcube.resourcemanagement.support.server.gcube.ISClientRequester;
|
||||
import org.gcube.resourcemanagement.support.server.gcube.queries.QueryLoader;
|
||||
import org.gcube.resourcemanagement.support.server.gcube.queries.QueryLocation;
|
||||
import org.gcube.resourcemanagement.support.server.managers.resources.GenericResourceManager;
|
||||
import org.gcube.resourcemanagement.support.server.managers.resources.ManagementUtils;
|
||||
import org.gcube.resourcemanagement.support.server.managers.resources.ResourceFactory;
|
||||
import org.gcube.resourcemanagement.support.server.managers.scope.ScopeManager;
|
||||
import org.gcube.resourcemanagement.support.server.types.AllowedResourceTypes;
|
||||
import org.gcube.resourcemanagement.support.server.utils.ServerConsole;
|
||||
import org.gcube.resourcemanagement.support.shared.exceptions.InvalidPermissionsException;
|
||||
import org.gcube.resourcemanagement.support.shared.operations.SupportedOperations;
|
||||
import org.gcube.resourcemanagement.support.shared.plugins.GenericResourcePlugin;
|
||||
import org.gcube.resourcemanagement.support.shared.types.Tuple;
|
||||
import org.gcube.resourcemanagement.support.shared.types.UserGroup;
|
||||
import org.gcube.resourcemanagement.support.shared.types.datamodel.CompleteResourceProfile;
|
||||
import org.gcube.resourcemanagement.support.shared.types.datamodel.ResourceDescriptor;
|
||||
import org.gcube.resourcemanagement.support.shared.util.Assertion;
|
||||
import org.gcube.resourcemanagement.support.shared.util.Configuration;
|
||||
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
||||
import org.gcube.resources.discovery.client.queries.impl.QueryTemplate;
|
||||
import org.gcube.vremanagement.resourcemanager.client.RMReportingLibrary;
|
||||
import org.w3c.dom.Node;
|
||||
import org.xml.sax.InputSource;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
||||
import org.gcube.portlets.admin.resourcemanagement.shared.utils.BCrypt;
|
||||
|
||||
/**
|
||||
* @author Daniele Strollo
|
||||
* @author Massimiliano Assante (ISTI-CNR)
|
||||
*
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class ServiceProxyImpl extends RemoteServiceServlet implements ServiceProxy {
|
||||
private static final String LOG_PREFIX = "[SERVICE-IMPL]";
|
||||
|
||||
public final void emptyCache() {
|
||||
ISClientRequester.emptyCache();
|
||||
}
|
||||
|
||||
public final void setUseCache(final boolean flag) {
|
||||
this.getCurrentStatus().setUseCache(flag);
|
||||
}
|
||||
|
||||
public final void setSuperUser(final boolean superUser) {
|
||||
if (superUser && this.getCurrentStatus().getCredentials() == UserGroup.DEBUG) {
|
||||
this.getCurrentStatus().setCredentials(UserGroup.ADMIN);
|
||||
} else {
|
||||
this.getCurrentStatus().setCredentials(UserGroup.DEBUG);
|
||||
}
|
||||
initScopes(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by portlet at module instantiation
|
||||
*/
|
||||
public final CurrentStatus initStatus() {
|
||||
ServerConsole.trace(LOG_PREFIX, "[INIT-STATUS] initializing config parameters");
|
||||
|
||||
ServerConsole.info(LOG_PREFIX, "Clearing status");
|
||||
StatusHandler.clearStatus(getHttpSession());
|
||||
|
||||
ConfigurationLoader.setConfigurationFile(getPropertiesFSPath() + File.separator + "resourcemanagement.properties");
|
||||
return this.getCurrentStatus();
|
||||
}
|
||||
|
||||
private HttpSession getHttpSession() {
|
||||
return this.getThreadLocalRequest().getSession();
|
||||
}
|
||||
|
||||
public final void initScopes(final boolean doClean) {
|
||||
ServerConsole.trace(LOG_PREFIX, "[INIT-SCOPES] initializing scopes from: " + this.getScopeDataPath());
|
||||
|
||||
// Updates the scopes
|
||||
try {
|
||||
ScopeManager.setScopeConfigFile(this.getScopeDataPath());
|
||||
if (doClean) {
|
||||
ScopeManager.clear();
|
||||
}
|
||||
ScopeManager.update();
|
||||
} catch (Exception e) {
|
||||
ServerConsole.error(LOG_PREFIX, "During scope caching", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private String getServletFSPath() {
|
||||
return this.getServletContext().getRealPath("") + File.separator + "WEB-INF";
|
||||
}
|
||||
|
||||
private String getPropertiesFSPath() {
|
||||
return this.getServletContext().getRealPath("") + File.separator + "conf";
|
||||
}
|
||||
|
||||
private String getScopeDataPath() {
|
||||
String startDirectory = getServletFSPath();
|
||||
return startDirectory + File.separator + "xml" + File.separator +
|
||||
((this.getCurrentStatus().getCredentials() == UserGroup.ADMIN) ?
|
||||
"scopedata_admin.xml" :
|
||||
"scopedata.xml");
|
||||
}
|
||||
|
||||
private String getXML2HTMLMapping() {
|
||||
String startDirectory = getServletFSPath();
|
||||
return startDirectory + File.separator + "xml" + File.separator + "xmlverbatim.xsl";
|
||||
}
|
||||
|
||||
|
||||
public final Tuple<String> addResourcesToScope(
|
||||
final String resType,
|
||||
final List<String> resourceIDs,
|
||||
final String scope)
|
||||
throws Exception {
|
||||
Assertion<Exception> checker = new Assertion<Exception>();
|
||||
|
||||
CurrentStatus status = this.getCurrentStatus();
|
||||
|
||||
checker.validate(SupportedOperations.ADD_TO_SCOPE.isAllowed(status.getCredentials()),
|
||||
new Exception("User not allowed to request this operation"));
|
||||
checker.validate(resType != null && resType.trim().length() > 0, new Exception("Invalid parameter type"));
|
||||
checker.validate(resourceIDs != null && resourceIDs.size() > 0, new Exception("Invalid parameter type"));
|
||||
checker.validate(scope != null && scope.trim().length() > 0, new Exception("Invalid parameter type"));
|
||||
|
||||
AllowedResourceTypes type = AllowedResourceTypes.valueOf(resType);
|
||||
ScopeBean targetScope = new ScopeBean(scope);
|
||||
ScopeBean sourceScope = new ScopeBean(status.getCurrentScope());
|
||||
|
||||
String reportID = ManagementUtils.addToExistingScope(type,
|
||||
resourceIDs.toArray(new String[]{}),
|
||||
sourceScope,
|
||||
targetScope);
|
||||
|
||||
RMReportingLibrary manager =
|
||||
ResourceFactory.createResourceManager(type).getReportResourceManager(targetScope.toString());
|
||||
|
||||
String xmlReport = manager.getReport(reportID);
|
||||
String mappingPath = this.getXML2HTMLMapping();
|
||||
String htmlReport = ISClientRequester.XML2HTML(xmlReport, mappingPath);
|
||||
return new Tuple<String>(
|
||||
reportID,
|
||||
resType,
|
||||
xmlReport,
|
||||
htmlReport);
|
||||
}
|
||||
/**
|
||||
* REMOVE FROM SCOPE
|
||||
*/
|
||||
public final Tuple<String> removeResourcesFromScope(
|
||||
final String resType,
|
||||
final List<String> resourceIDs,
|
||||
final String scope)
|
||||
throws Exception {
|
||||
Assertion<Exception> checker = new Assertion<Exception>();
|
||||
|
||||
CurrentStatus status = this.getCurrentStatus();
|
||||
|
||||
checker.validate(SupportedOperations.ADD_TO_SCOPE.isAllowed(status.getCredentials()),
|
||||
new Exception("User not allowed to request this operation"));
|
||||
checker.validate(resType != null && resType.trim().length() > 0, new Exception("Invalid parameter type"));
|
||||
checker.validate(resourceIDs != null && resourceIDs.size() > 0, new Exception("Invalid parameter type"));
|
||||
checker.validate(scope != null && scope.trim().length() > 0, new Exception("Invalid parameter type"));
|
||||
|
||||
AllowedResourceTypes type = AllowedResourceTypes.valueOf(resType);
|
||||
ScopeBean targetScope = new ScopeBean(scope);
|
||||
ScopeBean sourceScope = new ScopeBean(status.getCurrentScope());
|
||||
|
||||
String reportID = ManagementUtils.removeFromExistingScope(type,
|
||||
resourceIDs.toArray(new String[]{}),
|
||||
sourceScope,
|
||||
targetScope);
|
||||
|
||||
|
||||
RMReportingLibrary manager =
|
||||
ResourceFactory.createResourceManager(type).getReportResourceManager(targetScope.toString());
|
||||
|
||||
String xmlReport = manager.getReport(reportID);
|
||||
String mappingPath = this.getXML2HTMLMapping();
|
||||
String htmlReport = ISClientRequester.XML2HTML(xmlReport, mappingPath);
|
||||
|
||||
return new Tuple<String>(
|
||||
reportID,
|
||||
resType,
|
||||
xmlReport,
|
||||
htmlReport);
|
||||
}
|
||||
|
||||
public final String deploy(final List<String> ghnsID, final List<String> servicesID) throws Exception {
|
||||
try {
|
||||
ScopeBean sourceScope = new ScopeBean(this.getCurrentStatus().getCurrentScope());
|
||||
String[] param1 = ghnsID.toArray(new String[0]);
|
||||
String[] param2 = servicesID.toArray(new String[0]);
|
||||
return ManagementUtils.deploy(sourceScope, param1, param2);
|
||||
} catch (Exception e) {
|
||||
ServerConsole.error(LOG_PREFIX, "During service deployment", e);
|
||||
throw new Exception(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public final Tuple<String> checkDeployStatus(final String scope, final String deployID) throws Exception {
|
||||
if (SupportedOperations.SERVICE_GET_REPORT.isAllowed(this.getCurrentStatus().getCredentials())) {
|
||||
ScopeBean sourceScope = ScopeManager.getScope(scope);
|
||||
RMReportingLibrary manager =
|
||||
ResourceFactory.createResourceManager(AllowedResourceTypes.Service).getReportResourceManager(sourceScope.toString());
|
||||
String xmlReport = manager.getReport(deployID);
|
||||
String mappingPath = this.getXML2HTMLMapping();
|
||||
String htmlReport = ISClientRequester.XML2HTML(xmlReport, mappingPath);
|
||||
return new Tuple<String>(deployID, xmlReport, htmlReport);
|
||||
} else {
|
||||
throw new Exception("The current user is not allowed to request the operation");
|
||||
}
|
||||
}
|
||||
|
||||
public final List<String> getAvailableScopes() {
|
||||
ServerConsole.trace(LOG_PREFIX, "[GET-SCOPES] getting available scopes");
|
||||
Vector<String> retval = new Vector<String>();
|
||||
try {
|
||||
Map<String, ScopeBean> scopes = ScopeManager.getAvailableScopes();
|
||||
for (ScopeBean scope : scopes.values())
|
||||
retval.add(scope.toString());
|
||||
|
||||
return retval;
|
||||
} catch (Exception e) {
|
||||
retval.add("/gcube");
|
||||
retval.add("/gcube/devsec");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
public final List<String> getAvailableAddScopes() {
|
||||
List<String> retval = new Vector<String>();
|
||||
try {
|
||||
ScopeBean currScope = ScopeManager.getScope(this.getCurrentStatus().getCurrentScope());
|
||||
List<String> scopes = this.getAvailableScopes();
|
||||
for (String scope : scopes) {
|
||||
if (scope.contains(currScope.toString())) {
|
||||
retval.add(scope);
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
} catch (Exception e) {
|
||||
ServerConsole.error(LOG_PREFIX, e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public final HashMap<String, ArrayList<String>> getResourceTypeTree(final String scope) throws Exception {
|
||||
try {
|
||||
ScopeBean gscope = new ScopeBean(scope);
|
||||
HashMap<String, ArrayList<String>> results = ISClientRequester.getResourcesTree(getCacheManager(this.getCurrentStatus()), gscope);
|
||||
return results;
|
||||
} catch (Exception e) {
|
||||
ServerConsole.error(LOG_PREFIX, "applying resource get", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
public final List<String> getRelatedResources(final String type, final String id, final String scope)
|
||||
{
|
||||
try {
|
||||
return ISClientRequester.getRelatedResources(
|
||||
getCacheManager(this.getCurrentStatus()),
|
||||
type,
|
||||
id,
|
||||
new ScopeBean(scope)
|
||||
);
|
||||
} catch (Exception e) {
|
||||
ServerConsole.error(LOG_PREFIX, e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public final List<String> getResourcesByType(final String scope, final String type)
|
||||
{
|
||||
try {
|
||||
return ISClientRequester.getResourcesByType(
|
||||
getCacheManager(this.getCurrentStatus()),
|
||||
new ScopeBean(scope), type, null);
|
||||
} catch (Exception e) {
|
||||
ServerConsole.error(LOG_PREFIX, e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public final ResourceDescriptor getGenericResourceDescriptor(final String scope, final String resID) throws Exception {
|
||||
return this.getDescriptor(ScopeManager.getScope(scope), resID);
|
||||
}
|
||||
|
||||
private ResourceDescriptor getDescriptor(final ScopeBean scope, final String resID) throws Exception {
|
||||
|
||||
|
||||
//set the scope
|
||||
String currScope = ScopeProvider.instance.get();
|
||||
ScopeProvider.instance.set(scope.toString());
|
||||
|
||||
QueryTemplate isQuery = null;
|
||||
DiscoveryClient<String> client = client();
|
||||
|
||||
isQuery = new QueryTemplate(QueryLoader.getQuery(QueryLocation.GET_RESOURCE_BYID));
|
||||
|
||||
isQuery.addParameter("RES_ID", resID);
|
||||
isQuery.addParameter("RES_TYPE", ResourceTypeDecorator.GenericResource.name());
|
||||
|
||||
List<String> results = client.submit(isQuery);
|
||||
|
||||
if (results != null && results.size() > 0) {
|
||||
ResourceDescriptor retval = new ResourceDescriptor();
|
||||
|
||||
List<String> currValue = null;
|
||||
DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
|
||||
Node node = docBuilder.parse(new InputSource(new StringReader(results.get(0)))).getDocumentElement();
|
||||
XPathHelper helper = new XPathHelper(node);
|
||||
|
||||
currValue = helper.evaluate("/Resource/ID/text()");
|
||||
if (currValue != null && currValue.size() > 0) {
|
||||
retval.setID(currValue.get(0));
|
||||
}
|
||||
currValue = helper.evaluate("/Resource/Profile/Name/text()");
|
||||
if (currValue != null && currValue.size() > 0) {
|
||||
retval.setName(currValue.get(0));
|
||||
}
|
||||
|
||||
currValue = helper.evaluate("/Resource/Profile/Body/node()");
|
||||
if (currValue != null && currValue.size() > 0) {
|
||||
StringBuilder bodytext = new StringBuilder();
|
||||
for (String line : currValue) {
|
||||
bodytext.append(line);
|
||||
}
|
||||
retval.set("Body", bodytext.toString().trim());
|
||||
} else {
|
||||
retval.set("Body", "");
|
||||
}
|
||||
|
||||
|
||||
currValue = helper.evaluate("/Resource/Profile/Description/text()");
|
||||
if (currValue != null && currValue.size() > 0) {
|
||||
retval.set("Description", currValue.get(0));
|
||||
} else {
|
||||
retval.set("Description", "");
|
||||
}
|
||||
|
||||
|
||||
currValue = helper.evaluate("/Resource/Profile/SecondaryType/text()");
|
||||
if (currValue != null && currValue.size() > 0) {
|
||||
retval.set("SecondaryType", currValue.get(0));
|
||||
} else {
|
||||
retval.set("SecondaryType", "");
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public final List<ResourceDescriptor> getResourcesModel(final String scope, final String type, final String subType, final List<Tuple<String>> additionalMaps)
|
||||
throws Exception {
|
||||
if (scope == null || type == null) {
|
||||
return null;
|
||||
}
|
||||
return ISClientRequester.getResourceModels(new ScopeBean(scope), type, subType, additionalMaps);
|
||||
}
|
||||
|
||||
|
||||
public final List<String> getWSResources(final String scope) {
|
||||
try {
|
||||
return ISClientRequester.getWSResources(new ScopeBean(scope));
|
||||
} catch (Exception e) {
|
||||
ServerConsole.error(LOG_PREFIX, e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public final List<String> getResourcesBySubType(final String scope, final String type, final String subtype) {
|
||||
try {
|
||||
return ISClientRequester.getResourcesByType(
|
||||
getCacheManager(this.getCurrentStatus()),
|
||||
new ScopeBean(scope), type, subtype);
|
||||
} catch (Exception e) {
|
||||
ServerConsole.error(LOG_PREFIX, e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public final CompleteResourceProfile getResourceByID(final String scope, final String type, final String resID) {
|
||||
try {
|
||||
CompleteResourceProfile profile = ISClientRequester.getResourceByID(this.getXML2HTMLMapping(), new ScopeBean(scope), type, resID);
|
||||
System.out.println("****\n\n\n CompleteResourceProfile getResourceByID(final String scope, final String type, final String resID) *****");
|
||||
System.out.println("****CompleteResourceProfile getResourceByID("+scope+","+type+","+resID+") *****\n\n");
|
||||
return profile;
|
||||
} catch (Exception e) {
|
||||
ServerConsole.error(LOG_PREFIX, e);
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public final String createGenericResource(
|
||||
final String ID,
|
||||
final String name,
|
||||
final String description,
|
||||
final String body,
|
||||
final String subType)
|
||||
throws Exception {
|
||||
// Check permissions
|
||||
Assertion<InvalidPermissionsException> checker = new Assertion<InvalidPermissionsException>();
|
||||
checker.validate(
|
||||
SupportedOperations.GENERIC_RESOURCE_CREATE.isAllowed(this.getCurrentStatus().getCredentials()),
|
||||
new InvalidPermissionsException("The user is not allowed to execute the following operation"));
|
||||
|
||||
return GenericResourceManager.create(
|
||||
ID,
|
||||
new ScopeBean(this.getCurrentStatus().getCurrentScope()),
|
||||
name,
|
||||
description,
|
||||
body,
|
||||
subType);
|
||||
}
|
||||
|
||||
public final void updateGenericResource(
|
||||
final String ID,
|
||||
final String name,
|
||||
final String description,
|
||||
final String body,
|
||||
final String subType)
|
||||
throws Exception {
|
||||
// Check permissions
|
||||
Assertion<InvalidPermissionsException> checker = new Assertion<InvalidPermissionsException>();
|
||||
checker.validate(
|
||||
SupportedOperations.GENERIC_RESOURCE_EDIT.isAllowed(this.getCurrentStatus().getCredentials()),
|
||||
new InvalidPermissionsException("The user is not allowed to execute the following operation"));
|
||||
|
||||
ScopeBean sourceScope = new ScopeBean(this.getCurrentStatus().getCurrentScope());
|
||||
GenericResourceManager resource = new GenericResourceManager(ID);
|
||||
resource.update(name, description, body, subType, sourceScope);
|
||||
}
|
||||
|
||||
public final void setCurrentScope(final String scope) {
|
||||
this.getCurrentStatus().setCurrentScope(scope);
|
||||
}
|
||||
|
||||
public final Map<String, GenericResourcePlugin> getGenericResourcePlugins() throws Exception {
|
||||
return ISClientRequester.getGenericResourcePlugins(ScopeManager.getScope(this.getCurrentStatus().getCurrentScope()));
|
||||
}
|
||||
|
||||
private CurrentStatus getCurrentStatus() {
|
||||
return StatusHandler.getStatus(this.getHttpSession());
|
||||
}
|
||||
|
||||
private CacheManager getCacheManager(CurrentStatus status) {
|
||||
CacheManager cm = new CacheManager();
|
||||
cm.setUseCache(status.useCache());
|
||||
return cm;
|
||||
}
|
||||
/***********************************************************
|
||||
* RESOURCE OPERATIONS
|
||||
* @throws InvalidParameterException
|
||||
**********************************************************/
|
||||
public final void doOperation(
|
||||
final SupportedOperations opCode,
|
||||
final String scope,
|
||||
final List<ResourceDescriptor> resources)
|
||||
throws Exception {
|
||||
try {
|
||||
ResourceCommands.doOperation(
|
||||
this.getCurrentStatus(),
|
||||
opCode, scope, resources);
|
||||
} catch (final Exception e) {
|
||||
ServerConsole.error(LOG_PREFIX, e);
|
||||
throw new Exception(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean enableSuperUserMode(String code) {
|
||||
String ipAddressCaller = getThreadLocalRequest().getRemoteAddr();
|
||||
boolean matched = BCrypt.checkpw(code, Configuration.CODE);
|
||||
if (matched)
|
||||
ServerConsole.info(LOG_PREFIX, "AUTHORISED SUPER USER MODE, IP: " + ipAddressCaller);
|
||||
else
|
||||
ServerConsole.info(LOG_PREFIX, "FAILED ATTEMPT SUPER USER MODE FROM IP: " + ipAddressCaller);
|
||||
return matched;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,162 @@
|
|||
/****************************************************************************
|
||||
* This software is part of the gCube Project.
|
||||
* Site: http://www.gcube-system.org/
|
||||
****************************************************************************
|
||||
* The gCube/gCore software is licensed as Free Open Source software
|
||||
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
* The software and documentation is provided by its authors/distributors
|
||||
* "as is" and no expressed or
|
||||
* implied warranty is given for its use, quality or fitness for a
|
||||
* particular case.
|
||||
****************************************************************************
|
||||
* Filename: StatusHandler.java
|
||||
****************************************************************************
|
||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
||||
***************************************************************************/
|
||||
|
||||
package org.gcube.portlets.admin.resourcemanagement.server.gcube.services;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.gcube.application.framework.core.session.ASLSession;
|
||||
import org.gcube.application.framework.core.session.SessionManager;
|
||||
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
|
||||
import org.gcube.portlets.admin.resourcemanagement.server.gcube.services.configuration.ConfigurationLoader;
|
||||
import org.gcube.resourcemanagement.support.client.utils.CurrentStatus;
|
||||
import org.gcube.resourcemanagement.support.server.utils.ServerConsole;
|
||||
import org.gcube.resourcemanagement.support.shared.types.RunningMode;
|
||||
import org.gcube.resourcemanagement.support.shared.types.UserGroup;
|
||||
import org.gcube.vomanagement.usermanagement.RoleManager;
|
||||
import org.gcube.vomanagement.usermanagement.UserManager;
|
||||
import org.gcube.vomanagement.usermanagement.impl.LiferayRoleManager;
|
||||
import org.gcube.vomanagement.usermanagement.impl.LiferayUserManager;
|
||||
import org.gcube.vomanagement.usermanagement.model.GCubeRole;
|
||||
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
||||
|
||||
/**
|
||||
* @author Daniele Strollo (ISTI-CNR)
|
||||
*
|
||||
*/
|
||||
public class StatusHandler {
|
||||
private static final String STATUS_KEY = "current_status";
|
||||
public static final String USER_EMAIL_KEY = "theusermail";
|
||||
private static final String LOG_PREFIX = "[StatusHandler]";
|
||||
private static final String ADMIN_ROLE = "VO-Admin";
|
||||
|
||||
public static final void setStatus(final HttpSession session, final CurrentStatus status) {
|
||||
session.setAttribute(STATUS_KEY, status);
|
||||
}
|
||||
|
||||
public static final void clearStatus(final HttpSession session) {
|
||||
if (session != null && session.getAttribute(STATUS_KEY) != null) {
|
||||
session.removeAttribute(STATUS_KEY);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the status if running in portal mode otherwise returns null.
|
||||
* @param session
|
||||
* @return
|
||||
*/
|
||||
private static CurrentStatus initStatus(final HttpSession session) {
|
||||
if (session == null || session.getAttribute(ScopeHelper.USERNAME_ATTRIBUTE) == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String username = session.getAttribute(ScopeHelper.USERNAME_ATTRIBUTE).toString();
|
||||
|
||||
// inside portal
|
||||
if (username != null) {
|
||||
ServerConsole.info(LOG_PREFIX, "Running inside portal... [OK]");
|
||||
CurrentStatus status = new CurrentStatus();
|
||||
status.setCurrentUser(username);
|
||||
status.setCredentials(UserGroup.USER);
|
||||
status.setRunningMode(RunningMode.PORTAL);
|
||||
ASLSession aslSession = SessionManager.getInstance().getASLSession(session.getId(), username);
|
||||
ServerConsole.error(LOG_PREFIX, "The portal scope is [" + aslSession.getScopeName() + "]");
|
||||
|
||||
status.setCurrentScope(aslSession.getScopeName());
|
||||
|
||||
aslSession.getGroupId();
|
||||
RoleManager rman = new LiferayRoleManager();
|
||||
UserManager uman = new LiferayUserManager();
|
||||
|
||||
|
||||
try {
|
||||
List<GCubeRole> roles = null;
|
||||
|
||||
// Gets the user email. If not provided the default one will be used.
|
||||
// The mail will be store inside the session.
|
||||
GCubeUser umodel = uman.getUserByUsername(username);
|
||||
session.setAttribute(USER_EMAIL_KEY, umodel.getEmail());
|
||||
long groupId = aslSession.getGroupId();
|
||||
roles = rman.listRolesByUserAndGroup(groupId, uman.getUserByUsername(username).getUserId());
|
||||
for (GCubeRole role : roles) {
|
||||
if (role.getRoleName().equals(ADMIN_ROLE)) {
|
||||
status.setCredentials(UserGroup.ADMIN);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ServerConsole.error(LOG_PREFIX, e);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
// not running in a portal
|
||||
return null;
|
||||
}
|
||||
|
||||
public static final CurrentStatus getStatus(final HttpSession session) {
|
||||
// CREATING THE STATUS
|
||||
// Status initialization
|
||||
if (session.getAttribute(STATUS_KEY) == null) {
|
||||
CurrentStatus status = initStatus(session);
|
||||
|
||||
// Not in portal mode
|
||||
if (status == null) {
|
||||
ServerConsole.info(LOG_PREFIX, "Running outside portal... [OK]");
|
||||
status = new CurrentStatus();
|
||||
|
||||
// LOADS THE DEFAULTS
|
||||
try {
|
||||
String runningMode = ConfigurationLoader.getProperty("RUNNING_MODE");
|
||||
status.setRunningMode(RunningMode.valueOf(runningMode));
|
||||
ServerConsole.debug(LOG_PREFIX, "Setting RUNNING_MODE to: " + status.getRunningMode());
|
||||
} catch (Exception e) {
|
||||
ServerConsole.error(LOG_PREFIX, "Loading defaults", e);
|
||||
}
|
||||
try {
|
||||
String credentials = ConfigurationLoader.getProperty("USER_CREDENTIALS");
|
||||
status.setCredentials(UserGroup.valueOf(credentials));
|
||||
ServerConsole.debug(LOG_PREFIX, "Setting USER_CREDENTIALS to: " + status.getCredentials());
|
||||
} catch (Exception e) {
|
||||
ServerConsole.error(LOG_PREFIX, "Loading defaults", e);
|
||||
}
|
||||
try {
|
||||
status.setCurrentUser(ConfigurationLoader.getProperty("DEFAULT_USER"));
|
||||
ServerConsole.debug(LOG_PREFIX, "Setting DEFAULT_USER to: " + status.getCurrentUser());
|
||||
} catch (Exception e) {
|
||||
ServerConsole.error(LOG_PREFIX, "Loading defaults", e);
|
||||
}
|
||||
try {
|
||||
status.setCurrentScope(ConfigurationLoader.getProperty("DEFAULT_SCOPE"));
|
||||
ServerConsole.debug(LOG_PREFIX, "Setting DEFAULT_SCOPE to: " + status.getCurrentScope());
|
||||
} catch (Exception e) {
|
||||
ServerConsole.error(LOG_PREFIX, "Loading defaults", e);
|
||||
}
|
||||
try {
|
||||
if (ConfigurationLoader.getProperty("LIST_GHN_STARTUP").equalsIgnoreCase("NO"))
|
||||
status.setLoadGHNatStartup(false);
|
||||
ServerConsole.debug(LOG_PREFIX, "*********************\n\n\nSetting LIST_GHN_STARTUP to: " + status.isLoadGHNatStartup());
|
||||
} catch (Exception e) {
|
||||
ServerConsole.error(LOG_PREFIX, "Loading defaults", e);
|
||||
}
|
||||
}
|
||||
session.setAttribute(STATUS_KEY, status);
|
||||
return status;
|
||||
} else {
|
||||
return (CurrentStatus) session.getAttribute(STATUS_KEY);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,111 @@
|
|||
/****************************************************************************
|
||||
* This software is part of the gCube Project.
|
||||
* Site: http://www.gcube-system.org/
|
||||
****************************************************************************
|
||||
* The gCube/gCore software is licensed as Free Open Source software
|
||||
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
* The software and documentation is provided by its authors/distributors
|
||||
* "as is" and no expressed or
|
||||
* implied warranty is given for its use, quality or fitness for a
|
||||
* particular case.
|
||||
****************************************************************************
|
||||
* Filename: ConfigurationLoader.java
|
||||
****************************************************************************
|
||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
||||
***************************************************************************/
|
||||
|
||||
package org.gcube.portlets.admin.resourcemanagement.server.gcube.services.configuration;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.gcube.resourcemanagement.support.server.utils.ServerConsole;
|
||||
|
||||
/**
|
||||
* @author Daniele Strollo (ISTI-CNR)
|
||||
*
|
||||
*/
|
||||
public final class ConfigurationLoader {
|
||||
private static final String DEFAULT_PATH = "war/conf/resourcemanagement.properties";
|
||||
private static final ConfigurationLoader singleton = new ConfigurationLoader(DEFAULT_PATH);
|
||||
private static final String LOG_PREFIX = "[CONF_LOADER]";
|
||||
private Properties properties = null;
|
||||
private ConfigurationLoader(final String confFile) {
|
||||
if (this.properties == null) {
|
||||
this.properties = this.load(confFile);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setConfigurationFile(final String filename) {
|
||||
singleton.properties = singleton.load(filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load a properties file from the classpath
|
||||
*
|
||||
* @param propsName
|
||||
* @return Properties
|
||||
* @throws Exception
|
||||
*/
|
||||
private Properties load(final String propsName) {
|
||||
ServerConsole.debug(LOG_PREFIX, "[CONF] loading configuration in file: " + propsName);
|
||||
|
||||
FileInputStream fis = null;
|
||||
Properties props = new Properties();
|
||||
try {
|
||||
fis = new FileInputStream(propsName);
|
||||
props.load(fis);
|
||||
} catch (Exception e) {
|
||||
ServerConsole.debug(LOG_PREFIX, "[CONF] cannot find configuration file: " + propsName + " Trying in standalone mode.");
|
||||
try {
|
||||
fis = new FileInputStream(DEFAULT_PATH);
|
||||
} catch (Exception e1) {
|
||||
ServerConsole.debug(LOG_PREFIX, "[CONF] cannot find local standalone configuration file");
|
||||
}
|
||||
} finally {
|
||||
try {
|
||||
if (fis != null) {
|
||||
fis.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
return props;
|
||||
}
|
||||
|
||||
protected static ConfigurationLoader getInstance() {
|
||||
return ConfigurationLoader.singleton;
|
||||
}
|
||||
|
||||
public static Properties getProperties() {
|
||||
return getInstance().properties;
|
||||
}
|
||||
|
||||
public static String getProperty(final String key) throws Exception {
|
||||
// Getting the default value
|
||||
try {
|
||||
Class<?> c = Class.forName(DefaultConfiguration.class.getName());
|
||||
Field field = c.getField(key);
|
||||
String defaultValue = field.get(null).toString();
|
||||
if (getInstance().properties == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
return getInstance().properties.getProperty(
|
||||
key.trim(),
|
||||
defaultValue);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static int getIntProperty(final String key) throws Exception {
|
||||
return Integer.parseInt(getProperty(key));
|
||||
}
|
||||
|
||||
public static boolean getBoolProperty(final String key) throws Exception {
|
||||
return Boolean.parseBoolean(getProperty(key));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
/****************************************************************************
|
||||
* This software is part of the gCube Project.
|
||||
* Site: http://www.gcube-system.org/
|
||||
****************************************************************************
|
||||
* The gCube/gCore software is licensed as Free Open Source software
|
||||
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
* The software and documentation is provided by its authors/distributors
|
||||
* "as is" and no expressed or
|
||||
* implied warranty is given for its use, quality or fitness for a
|
||||
* particular case.
|
||||
****************************************************************************
|
||||
* Filename: DefaultConfiguration.java
|
||||
****************************************************************************
|
||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
||||
***************************************************************************/
|
||||
|
||||
package org.gcube.portlets.admin.resourcemanagement.server.gcube.services.configuration;
|
||||
|
||||
/**
|
||||
* @author Daniele Strollo (ISTI-CNR)
|
||||
*
|
||||
*/
|
||||
public class DefaultConfiguration {
|
||||
|
||||
/**
|
||||
* The user and its credentials
|
||||
* Possible values for credentials:
|
||||
* [USER,ADMIN,DEBUG]
|
||||
* USER_CREDENTIALS = DEBUG
|
||||
* Defines the modality in which the portlet is running
|
||||
* possible values [STANDALONE,PORTAL,NOTDEFINED]
|
||||
*/
|
||||
public static final String USER_CREDENTIALS = "USER";
|
||||
public static final String RUNNING_MODE = "STANDALONE";
|
||||
public static final String DEFAULT_USER = "daniele.strollo";
|
||||
|
||||
/**
|
||||
* The scope that will be used as default
|
||||
*/
|
||||
public static final String DEFAULT_SCOPE = "/d4science.research-infrastructures.eu";
|
||||
|
||||
/*
|
||||
* The target of update notification (if in singleton mode).
|
||||
* Mails MUST be separated by ";"
|
||||
*/
|
||||
public static final String USERMAIL_TO = "daniele.strollo@gmail.com";
|
||||
// USERMAIL_CC = Not supported due to old implementation of mail in liferay
|
||||
|
||||
|
||||
/*****************************************
|
||||
* PROPERTIES FOR THE SWEEPER
|
||||
*****************************************/
|
||||
/*
|
||||
* The max number of minutes from last profile update to consider a GHN alive.
|
||||
*/
|
||||
public static final String LIVE_GHN_MAX_MINUTES = "40";
|
||||
|
||||
/*
|
||||
* The max number of minutes from last profile update to consider a GHN alive.
|
||||
*/
|
||||
public static final String LIST_GHN_STARTUP = "YES";
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
|
||||
package org.gcube.portlets.admin.resourcemanagement.server.portlet;
|
||||
|
||||
import javax.portlet.GenericPortlet;
|
||||
import javax.portlet.ActionRequest;
|
||||
import javax.portlet.RenderRequest;
|
||||
import javax.portlet.ActionResponse;
|
||||
import javax.portlet.RenderResponse;
|
||||
import javax.portlet.PortletException;
|
||||
import java.io.IOException;
|
||||
import javax.portlet.PortletRequestDispatcher;
|
||||
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
|
||||
|
||||
/**
|
||||
* ResourceManagementPortlet Portlet Class
|
||||
* @author massi
|
||||
*/
|
||||
public class ResourceManagementPortlet extends GenericPortlet {
|
||||
// private static final String LOG_PREFIX = "[ResourceManagementPortlet]";
|
||||
|
||||
public final void doView(final RenderRequest request, final RenderResponse response)
|
||||
throws PortletException, IOException {
|
||||
|
||||
response.setContentType("text/html");
|
||||
try {
|
||||
ScopeHelper.setContext(request); // <-- Static method which sets the username in the session and the scope depending on the context automatically
|
||||
}
|
||||
catch (Exception e) {
|
||||
System.out.println("Could not initialize portlet context");
|
||||
}
|
||||
PortletRequestDispatcher dispatcher =
|
||||
getPortletContext().getRequestDispatcher("/WEB-INF/jsp/ResourceManagementPortlet_view.jsp");
|
||||
dispatcher.include(request, response);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void processAction(final ActionRequest request, final ActionResponse response)
|
||||
throws PortletException, IOException {
|
||||
// nop - done by massi
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/****************************************************************************
|
||||
* This software is part of the gCube Project.
|
||||
* Site: http://www.gcube-system.org/
|
||||
****************************************************************************
|
||||
* The gCube/gCore software is licensed as Free Open Source software
|
||||
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
* The software and documentation is provided by its authors/distributors
|
||||
* "as is" and no expressed or
|
||||
* implied warranty is given for its use, quality or fitness for a
|
||||
* particular case.
|
||||
****************************************************************************
|
||||
* Filename: WidgetNotRegistered.java
|
||||
****************************************************************************
|
||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
||||
***************************************************************************/
|
||||
|
||||
package org.gcube.portlets.admin.resourcemanagement.shared.exceptions;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
/**
|
||||
* @author Daniele Strollo (ISTI-CNR)
|
||||
*
|
||||
*/
|
||||
public class WidgetNotRegistered extends Exception implements IsSerializable {
|
||||
private static final long serialVersionUID = -4492836891522593176L;
|
||||
|
||||
public WidgetNotRegistered() {
|
||||
super();
|
||||
}
|
||||
|
||||
public WidgetNotRegistered(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public WidgetNotRegistered(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public WidgetNotRegistered(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,752 @@
|
|||
package org.gcube.portlets.admin.resourcemanagement.shared.utils;
|
||||
|
||||
// Copyright (c) 2006 Damien Miller <djm@mindrot.org>
|
||||
//
|
||||
// Permission to use, copy, modify, and distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice appear in all copies.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
import java.security.SecureRandom;
|
||||
|
||||
/**
|
||||
* BCrypt implements OpenBSD-style Blowfish password hashing using
|
||||
* the scheme described in "A Future-Adaptable Password Scheme" by
|
||||
* Niels Provos and David Mazieres.
|
||||
* <p>
|
||||
* This password hashing system tries to thwart off-line password
|
||||
* cracking using a computationally-intensive hashing algorithm,
|
||||
* based on Bruce Schneier's Blowfish cipher. The work factor of
|
||||
* the algorithm is parameterised, so it can be increased as
|
||||
* computers get faster.
|
||||
* <p>
|
||||
* Usage is really simple. To hash a password for the first time,
|
||||
* call the hashpw method with a random salt, like this:
|
||||
* <p>
|
||||
* <code>
|
||||
* String pw_hash = BCrypt.hashpw(plain_password, BCrypt.gensalt()); <br />
|
||||
* </code>
|
||||
* <p>
|
||||
* To check whether a plaintext password matches one that has been
|
||||
* hashed previously, use the checkpw method:
|
||||
* <p>
|
||||
* <code>
|
||||
* if (BCrypt.checkpw(candidate_password, stored_hash))<br />
|
||||
* System.out.println("It matches");<br />
|
||||
* else<br />
|
||||
* System.out.println("It does not match");<br />
|
||||
* </code>
|
||||
* <p>
|
||||
* The gensalt() method takes an optional parameter (log_rounds)
|
||||
* that determines the computational complexity of the hashing:
|
||||
* <p>
|
||||
* <code>
|
||||
* String strong_salt = BCrypt.gensalt(10)<br />
|
||||
* String stronger_salt = BCrypt.gensalt(12)<br />
|
||||
* </code>
|
||||
* <p>
|
||||
* The amount of work increases exponentially (2**log_rounds), so
|
||||
* each increment is twice as much work. The default log_rounds is
|
||||
* 10, and the valid range is 4 to 31.
|
||||
*
|
||||
* @author Damien Miller
|
||||
* @version 0.2
|
||||
*/
|
||||
public class BCrypt {
|
||||
// BCrypt parameters
|
||||
private static final int GENSALT_DEFAULT_LOG2_ROUNDS = 10;
|
||||
private static final int BCRYPT_SALT_LEN = 16;
|
||||
|
||||
// Blowfish parameters
|
||||
private static final int BLOWFISH_NUM_ROUNDS = 16;
|
||||
|
||||
// Initial contents of key schedule
|
||||
private static final int P_orig[] = {
|
||||
0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344,
|
||||
0xa4093822, 0x299f31d0, 0x082efa98, 0xec4e6c89,
|
||||
0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c,
|
||||
0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917,
|
||||
0x9216d5d9, 0x8979fb1b
|
||||
};
|
||||
private static final int S_orig[] = {
|
||||
0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7,
|
||||
0xb8e1afed, 0x6a267e96, 0xba7c9045, 0xf12c7f99,
|
||||
0x24a19947, 0xb3916cf7, 0x0801f2e2, 0x858efc16,
|
||||
0x636920d8, 0x71574e69, 0xa458fea3, 0xf4933d7e,
|
||||
0x0d95748f, 0x728eb658, 0x718bcd58, 0x82154aee,
|
||||
0x7b54a41d, 0xc25a59b5, 0x9c30d539, 0x2af26013,
|
||||
0xc5d1b023, 0x286085f0, 0xca417918, 0xb8db38ef,
|
||||
0x8e79dcb0, 0x603a180e, 0x6c9e0e8b, 0xb01e8a3e,
|
||||
0xd71577c1, 0xbd314b27, 0x78af2fda, 0x55605c60,
|
||||
0xe65525f3, 0xaa55ab94, 0x57489862, 0x63e81440,
|
||||
0x55ca396a, 0x2aab10b6, 0xb4cc5c34, 0x1141e8ce,
|
||||
0xa15486af, 0x7c72e993, 0xb3ee1411, 0x636fbc2a,
|
||||
0x2ba9c55d, 0x741831f6, 0xce5c3e16, 0x9b87931e,
|
||||
0xafd6ba33, 0x6c24cf5c, 0x7a325381, 0x28958677,
|
||||
0x3b8f4898, 0x6b4bb9af, 0xc4bfe81b, 0x66282193,
|
||||
0x61d809cc, 0xfb21a991, 0x487cac60, 0x5dec8032,
|
||||
0xef845d5d, 0xe98575b1, 0xdc262302, 0xeb651b88,
|
||||
0x23893e81, 0xd396acc5, 0x0f6d6ff3, 0x83f44239,
|
||||
0x2e0b4482, 0xa4842004, 0x69c8f04a, 0x9e1f9b5e,
|
||||
0x21c66842, 0xf6e96c9a, 0x670c9c61, 0xabd388f0,
|
||||
0x6a51a0d2, 0xd8542f68, 0x960fa728, 0xab5133a3,
|
||||
0x6eef0b6c, 0x137a3be4, 0xba3bf050, 0x7efb2a98,
|
||||
0xa1f1651d, 0x39af0176, 0x66ca593e, 0x82430e88,
|
||||
0x8cee8619, 0x456f9fb4, 0x7d84a5c3, 0x3b8b5ebe,
|
||||
0xe06f75d8, 0x85c12073, 0x401a449f, 0x56c16aa6,
|
||||
0x4ed3aa62, 0x363f7706, 0x1bfedf72, 0x429b023d,
|
||||
0x37d0d724, 0xd00a1248, 0xdb0fead3, 0x49f1c09b,
|
||||
0x075372c9, 0x80991b7b, 0x25d479d8, 0xf6e8def7,
|
||||
0xe3fe501a, 0xb6794c3b, 0x976ce0bd, 0x04c006ba,
|
||||
0xc1a94fb6, 0x409f60c4, 0x5e5c9ec2, 0x196a2463,
|
||||
0x68fb6faf, 0x3e6c53b5, 0x1339b2eb, 0x3b52ec6f,
|
||||
0x6dfc511f, 0x9b30952c, 0xcc814544, 0xaf5ebd09,
|
||||
0xbee3d004, 0xde334afd, 0x660f2807, 0x192e4bb3,
|
||||
0xc0cba857, 0x45c8740f, 0xd20b5f39, 0xb9d3fbdb,
|
||||
0x5579c0bd, 0x1a60320a, 0xd6a100c6, 0x402c7279,
|
||||
0x679f25fe, 0xfb1fa3cc, 0x8ea5e9f8, 0xdb3222f8,
|
||||
0x3c7516df, 0xfd616b15, 0x2f501ec8, 0xad0552ab,
|
||||
0x323db5fa, 0xfd238760, 0x53317b48, 0x3e00df82,
|
||||
0x9e5c57bb, 0xca6f8ca0, 0x1a87562e, 0xdf1769db,
|
||||
0xd542a8f6, 0x287effc3, 0xac6732c6, 0x8c4f5573,
|
||||
0x695b27b0, 0xbbca58c8, 0xe1ffa35d, 0xb8f011a0,
|
||||
0x10fa3d98, 0xfd2183b8, 0x4afcb56c, 0x2dd1d35b,
|
||||
0x9a53e479, 0xb6f84565, 0xd28e49bc, 0x4bfb9790,
|
||||
0xe1ddf2da, 0xa4cb7e33, 0x62fb1341, 0xcee4c6e8,
|
||||
0xef20cada, 0x36774c01, 0xd07e9efe, 0x2bf11fb4,
|
||||
0x95dbda4d, 0xae909198, 0xeaad8e71, 0x6b93d5a0,
|
||||
0xd08ed1d0, 0xafc725e0, 0x8e3c5b2f, 0x8e7594b7,
|
||||
0x8ff6e2fb, 0xf2122b64, 0x8888b812, 0x900df01c,
|
||||
0x4fad5ea0, 0x688fc31c, 0xd1cff191, 0xb3a8c1ad,
|
||||
0x2f2f2218, 0xbe0e1777, 0xea752dfe, 0x8b021fa1,
|
||||
0xe5a0cc0f, 0xb56f74e8, 0x18acf3d6, 0xce89e299,
|
||||
0xb4a84fe0, 0xfd13e0b7, 0x7cc43b81, 0xd2ada8d9,
|
||||
0x165fa266, 0x80957705, 0x93cc7314, 0x211a1477,
|
||||
0xe6ad2065, 0x77b5fa86, 0xc75442f5, 0xfb9d35cf,
|
||||
0xebcdaf0c, 0x7b3e89a0, 0xd6411bd3, 0xae1e7e49,
|
||||
0x00250e2d, 0x2071b35e, 0x226800bb, 0x57b8e0af,
|
||||
0x2464369b, 0xf009b91e, 0x5563911d, 0x59dfa6aa,
|
||||
0x78c14389, 0xd95a537f, 0x207d5ba2, 0x02e5b9c5,
|
||||
0x83260376, 0x6295cfa9, 0x11c81968, 0x4e734a41,
|
||||
0xb3472dca, 0x7b14a94a, 0x1b510052, 0x9a532915,
|
||||
0xd60f573f, 0xbc9bc6e4, 0x2b60a476, 0x81e67400,
|
||||
0x08ba6fb5, 0x571be91f, 0xf296ec6b, 0x2a0dd915,
|
||||
0xb6636521, 0xe7b9f9b6, 0xff34052e, 0xc5855664,
|
||||
0x53b02d5d, 0xa99f8fa1, 0x08ba4799, 0x6e85076a,
|
||||
0x4b7a70e9, 0xb5b32944, 0xdb75092e, 0xc4192623,
|
||||
0xad6ea6b0, 0x49a7df7d, 0x9cee60b8, 0x8fedb266,
|
||||
0xecaa8c71, 0x699a17ff, 0x5664526c, 0xc2b19ee1,
|
||||
0x193602a5, 0x75094c29, 0xa0591340, 0xe4183a3e,
|
||||
0x3f54989a, 0x5b429d65, 0x6b8fe4d6, 0x99f73fd6,
|
||||
0xa1d29c07, 0xefe830f5, 0x4d2d38e6, 0xf0255dc1,
|
||||
0x4cdd2086, 0x8470eb26, 0x6382e9c6, 0x021ecc5e,
|
||||
0x09686b3f, 0x3ebaefc9, 0x3c971814, 0x6b6a70a1,
|
||||
0x687f3584, 0x52a0e286, 0xb79c5305, 0xaa500737,
|
||||
0x3e07841c, 0x7fdeae5c, 0x8e7d44ec, 0x5716f2b8,
|
||||
0xb03ada37, 0xf0500c0d, 0xf01c1f04, 0x0200b3ff,
|
||||
0xae0cf51a, 0x3cb574b2, 0x25837a58, 0xdc0921bd,
|
||||
0xd19113f9, 0x7ca92ff6, 0x94324773, 0x22f54701,
|
||||
0x3ae5e581, 0x37c2dadc, 0xc8b57634, 0x9af3dda7,
|
||||
0xa9446146, 0x0fd0030e, 0xecc8c73e, 0xa4751e41,
|
||||
0xe238cd99, 0x3bea0e2f, 0x3280bba1, 0x183eb331,
|
||||
0x4e548b38, 0x4f6db908, 0x6f420d03, 0xf60a04bf,
|
||||
0x2cb81290, 0x24977c79, 0x5679b072, 0xbcaf89af,
|
||||
0xde9a771f, 0xd9930810, 0xb38bae12, 0xdccf3f2e,
|
||||
0x5512721f, 0x2e6b7124, 0x501adde6, 0x9f84cd87,
|
||||
0x7a584718, 0x7408da17, 0xbc9f9abc, 0xe94b7d8c,
|
||||
0xec7aec3a, 0xdb851dfa, 0x63094366, 0xc464c3d2,
|
||||
0xef1c1847, 0x3215d908, 0xdd433b37, 0x24c2ba16,
|
||||
0x12a14d43, 0x2a65c451, 0x50940002, 0x133ae4dd,
|
||||
0x71dff89e, 0x10314e55, 0x81ac77d6, 0x5f11199b,
|
||||
0x043556f1, 0xd7a3c76b, 0x3c11183b, 0x5924a509,
|
||||
0xf28fe6ed, 0x97f1fbfa, 0x9ebabf2c, 0x1e153c6e,
|
||||
0x86e34570, 0xeae96fb1, 0x860e5e0a, 0x5a3e2ab3,
|
||||
0x771fe71c, 0x4e3d06fa, 0x2965dcb9, 0x99e71d0f,
|
||||
0x803e89d6, 0x5266c825, 0x2e4cc978, 0x9c10b36a,
|
||||
0xc6150eba, 0x94e2ea78, 0xa5fc3c53, 0x1e0a2df4,
|
||||
0xf2f74ea7, 0x361d2b3d, 0x1939260f, 0x19c27960,
|
||||
0x5223a708, 0xf71312b6, 0xebadfe6e, 0xeac31f66,
|
||||
0xe3bc4595, 0xa67bc883, 0xb17f37d1, 0x018cff28,
|
||||
0xc332ddef, 0xbe6c5aa5, 0x65582185, 0x68ab9802,
|
||||
0xeecea50f, 0xdb2f953b, 0x2aef7dad, 0x5b6e2f84,
|
||||
0x1521b628, 0x29076170, 0xecdd4775, 0x619f1510,
|
||||
0x13cca830, 0xeb61bd96, 0x0334fe1e, 0xaa0363cf,
|
||||
0xb5735c90, 0x4c70a239, 0xd59e9e0b, 0xcbaade14,
|
||||
0xeecc86bc, 0x60622ca7, 0x9cab5cab, 0xb2f3846e,
|
||||
0x648b1eaf, 0x19bdf0ca, 0xa02369b9, 0x655abb50,
|
||||
0x40685a32, 0x3c2ab4b3, 0x319ee9d5, 0xc021b8f7,
|
||||
0x9b540b19, 0x875fa099, 0x95f7997e, 0x623d7da8,
|
||||
0xf837889a, 0x97e32d77, 0x11ed935f, 0x16681281,
|
||||
0x0e358829, 0xc7e61fd6, 0x96dedfa1, 0x7858ba99,
|
||||
0x57f584a5, 0x1b227263, 0x9b83c3ff, 0x1ac24696,
|
||||
0xcdb30aeb, 0x532e3054, 0x8fd948e4, 0x6dbc3128,
|
||||
0x58ebf2ef, 0x34c6ffea, 0xfe28ed61, 0xee7c3c73,
|
||||
0x5d4a14d9, 0xe864b7e3, 0x42105d14, 0x203e13e0,
|
||||
0x45eee2b6, 0xa3aaabea, 0xdb6c4f15, 0xfacb4fd0,
|
||||
0xc742f442, 0xef6abbb5, 0x654f3b1d, 0x41cd2105,
|
||||
0xd81e799e, 0x86854dc7, 0xe44b476a, 0x3d816250,
|
||||
0xcf62a1f2, 0x5b8d2646, 0xfc8883a0, 0xc1c7b6a3,
|
||||
0x7f1524c3, 0x69cb7492, 0x47848a0b, 0x5692b285,
|
||||
0x095bbf00, 0xad19489d, 0x1462b174, 0x23820e00,
|
||||
0x58428d2a, 0x0c55f5ea, 0x1dadf43e, 0x233f7061,
|
||||
0x3372f092, 0x8d937e41, 0xd65fecf1, 0x6c223bdb,
|
||||
0x7cde3759, 0xcbee7460, 0x4085f2a7, 0xce77326e,
|
||||
0xa6078084, 0x19f8509e, 0xe8efd855, 0x61d99735,
|
||||
0xa969a7aa, 0xc50c06c2, 0x5a04abfc, 0x800bcadc,
|
||||
0x9e447a2e, 0xc3453484, 0xfdd56705, 0x0e1e9ec9,
|
||||
0xdb73dbd3, 0x105588cd, 0x675fda79, 0xe3674340,
|
||||
0xc5c43465, 0x713e38d8, 0x3d28f89e, 0xf16dff20,
|
||||
0x153e21e7, 0x8fb03d4a, 0xe6e39f2b, 0xdb83adf7,
|
||||
0xe93d5a68, 0x948140f7, 0xf64c261c, 0x94692934,
|
||||
0x411520f7, 0x7602d4f7, 0xbcf46b2e, 0xd4a20068,
|
||||
0xd4082471, 0x3320f46a, 0x43b7d4b7, 0x500061af,
|
||||
0x1e39f62e, 0x97244546, 0x14214f74, 0xbf8b8840,
|
||||
0x4d95fc1d, 0x96b591af, 0x70f4ddd3, 0x66a02f45,
|
||||
0xbfbc09ec, 0x03bd9785, 0x7fac6dd0, 0x31cb8504,
|
||||
0x96eb27b3, 0x55fd3941, 0xda2547e6, 0xabca0a9a,
|
||||
0x28507825, 0x530429f4, 0x0a2c86da, 0xe9b66dfb,
|
||||
0x68dc1462, 0xd7486900, 0x680ec0a4, 0x27a18dee,
|
||||
0x4f3ffea2, 0xe887ad8c, 0xb58ce006, 0x7af4d6b6,
|
||||
0xaace1e7c, 0xd3375fec, 0xce78a399, 0x406b2a42,
|
||||
0x20fe9e35, 0xd9f385b9, 0xee39d7ab, 0x3b124e8b,
|
||||
0x1dc9faf7, 0x4b6d1856, 0x26a36631, 0xeae397b2,
|
||||
0x3a6efa74, 0xdd5b4332, 0x6841e7f7, 0xca7820fb,
|
||||
0xfb0af54e, 0xd8feb397, 0x454056ac, 0xba489527,
|
||||
0x55533a3a, 0x20838d87, 0xfe6ba9b7, 0xd096954b,
|
||||
0x55a867bc, 0xa1159a58, 0xcca92963, 0x99e1db33,
|
||||
0xa62a4a56, 0x3f3125f9, 0x5ef47e1c, 0x9029317c,
|
||||
0xfdf8e802, 0x04272f70, 0x80bb155c, 0x05282ce3,
|
||||
0x95c11548, 0xe4c66d22, 0x48c1133f, 0xc70f86dc,
|
||||
0x07f9c9ee, 0x41041f0f, 0x404779a4, 0x5d886e17,
|
||||
0x325f51eb, 0xd59bc0d1, 0xf2bcc18f, 0x41113564,
|
||||
0x257b7834, 0x602a9c60, 0xdff8e8a3, 0x1f636c1b,
|
||||
0x0e12b4c2, 0x02e1329e, 0xaf664fd1, 0xcad18115,
|
||||
0x6b2395e0, 0x333e92e1, 0x3b240b62, 0xeebeb922,
|
||||
0x85b2a20e, 0xe6ba0d99, 0xde720c8c, 0x2da2f728,
|
||||
0xd0127845, 0x95b794fd, 0x647d0862, 0xe7ccf5f0,
|
||||
0x5449a36f, 0x877d48fa, 0xc39dfd27, 0xf33e8d1e,
|
||||
0x0a476341, 0x992eff74, 0x3a6f6eab, 0xf4f8fd37,
|
||||
0xa812dc60, 0xa1ebddf8, 0x991be14c, 0xdb6e6b0d,
|
||||
0xc67b5510, 0x6d672c37, 0x2765d43b, 0xdcd0e804,
|
||||
0xf1290dc7, 0xcc00ffa3, 0xb5390f92, 0x690fed0b,
|
||||
0x667b9ffb, 0xcedb7d9c, 0xa091cf0b, 0xd9155ea3,
|
||||
0xbb132f88, 0x515bad24, 0x7b9479bf, 0x763bd6eb,
|
||||
0x37392eb3, 0xcc115979, 0x8026e297, 0xf42e312d,
|
||||
0x6842ada7, 0xc66a2b3b, 0x12754ccc, 0x782ef11c,
|
||||
0x6a124237, 0xb79251e7, 0x06a1bbe6, 0x4bfb6350,
|
||||
0x1a6b1018, 0x11caedfa, 0x3d25bdd8, 0xe2e1c3c9,
|
||||
0x44421659, 0x0a121386, 0xd90cec6e, 0xd5abea2a,
|
||||
0x64af674e, 0xda86a85f, 0xbebfe988, 0x64e4c3fe,
|
||||
0x9dbc8057, 0xf0f7c086, 0x60787bf8, 0x6003604d,
|
||||
0xd1fd8346, 0xf6381fb0, 0x7745ae04, 0xd736fccc,
|
||||
0x83426b33, 0xf01eab71, 0xb0804187, 0x3c005e5f,
|
||||
0x77a057be, 0xbde8ae24, 0x55464299, 0xbf582e61,
|
||||
0x4e58f48f, 0xf2ddfda2, 0xf474ef38, 0x8789bdc2,
|
||||
0x5366f9c3, 0xc8b38e74, 0xb475f255, 0x46fcd9b9,
|
||||
0x7aeb2661, 0x8b1ddf84, 0x846a0e79, 0x915f95e2,
|
||||
0x466e598e, 0x20b45770, 0x8cd55591, 0xc902de4c,
|
||||
0xb90bace1, 0xbb8205d0, 0x11a86248, 0x7574a99e,
|
||||
0xb77f19b6, 0xe0a9dc09, 0x662d09a1, 0xc4324633,
|
||||
0xe85a1f02, 0x09f0be8c, 0x4a99a025, 0x1d6efe10,
|
||||
0x1ab93d1d, 0x0ba5a4df, 0xa186f20f, 0x2868f169,
|
||||
0xdcb7da83, 0x573906fe, 0xa1e2ce9b, 0x4fcd7f52,
|
||||
0x50115e01, 0xa70683fa, 0xa002b5c4, 0x0de6d027,
|
||||
0x9af88c27, 0x773f8641, 0xc3604c06, 0x61a806b5,
|
||||
0xf0177a28, 0xc0f586e0, 0x006058aa, 0x30dc7d62,
|
||||
0x11e69ed7, 0x2338ea63, 0x53c2dd94, 0xc2c21634,
|
||||
0xbbcbee56, 0x90bcb6de, 0xebfc7da1, 0xce591d76,
|
||||
0x6f05e409, 0x4b7c0188, 0x39720a3d, 0x7c927c24,
|
||||
0x86e3725f, 0x724d9db9, 0x1ac15bb4, 0xd39eb8fc,
|
||||
0xed545578, 0x08fca5b5, 0xd83d7cd3, 0x4dad0fc4,
|
||||
0x1e50ef5e, 0xb161e6f8, 0xa28514d9, 0x6c51133c,
|
||||
0x6fd5c7e7, 0x56e14ec4, 0x362abfce, 0xddc6c837,
|
||||
0xd79a3234, 0x92638212, 0x670efa8e, 0x406000e0,
|
||||
0x3a39ce37, 0xd3faf5cf, 0xabc27737, 0x5ac52d1b,
|
||||
0x5cb0679e, 0x4fa33742, 0xd3822740, 0x99bc9bbe,
|
||||
0xd5118e9d, 0xbf0f7315, 0xd62d1c7e, 0xc700c47b,
|
||||
0xb78c1b6b, 0x21a19045, 0xb26eb1be, 0x6a366eb4,
|
||||
0x5748ab2f, 0xbc946e79, 0xc6a376d2, 0x6549c2c8,
|
||||
0x530ff8ee, 0x468dde7d, 0xd5730a1d, 0x4cd04dc6,
|
||||
0x2939bbdb, 0xa9ba4650, 0xac9526e8, 0xbe5ee304,
|
||||
0xa1fad5f0, 0x6a2d519a, 0x63ef8ce2, 0x9a86ee22,
|
||||
0xc089c2b8, 0x43242ef6, 0xa51e03aa, 0x9cf2d0a4,
|
||||
0x83c061ba, 0x9be96a4d, 0x8fe51550, 0xba645bd6,
|
||||
0x2826a2f9, 0xa73a3ae1, 0x4ba99586, 0xef5562e9,
|
||||
0xc72fefd3, 0xf752f7da, 0x3f046f69, 0x77fa0a59,
|
||||
0x80e4a915, 0x87b08601, 0x9b09e6ad, 0x3b3ee593,
|
||||
0xe990fd5a, 0x9e34d797, 0x2cf0b7d9, 0x022b8b51,
|
||||
0x96d5ac3a, 0x017da67d, 0xd1cf3ed6, 0x7c7d2d28,
|
||||
0x1f9f25cf, 0xadf2b89b, 0x5ad6b472, 0x5a88f54c,
|
||||
0xe029ac71, 0xe019a5e6, 0x47b0acfd, 0xed93fa9b,
|
||||
0xe8d3c48d, 0x283b57cc, 0xf8d56629, 0x79132e28,
|
||||
0x785f0191, 0xed756055, 0xf7960e44, 0xe3d35e8c,
|
||||
0x15056dd4, 0x88f46dba, 0x03a16125, 0x0564f0bd,
|
||||
0xc3eb9e15, 0x3c9057a2, 0x97271aec, 0xa93a072a,
|
||||
0x1b3f6d9b, 0x1e6321f5, 0xf59c66fb, 0x26dcf319,
|
||||
0x7533d928, 0xb155fdf5, 0x03563482, 0x8aba3cbb,
|
||||
0x28517711, 0xc20ad9f8, 0xabcc5167, 0xccad925f,
|
||||
0x4de81751, 0x3830dc8e, 0x379d5862, 0x9320f991,
|
||||
0xea7a90c2, 0xfb3e7bce, 0x5121ce64, 0x774fbe32,
|
||||
0xa8b6e37e, 0xc3293d46, 0x48de5369, 0x6413e680,
|
||||
0xa2ae0810, 0xdd6db224, 0x69852dfd, 0x09072166,
|
||||
0xb39a460a, 0x6445c0dd, 0x586cdecf, 0x1c20c8ae,
|
||||
0x5bbef7dd, 0x1b588d40, 0xccd2017f, 0x6bb4e3bb,
|
||||
0xdda26a7e, 0x3a59ff45, 0x3e350a44, 0xbcb4cdd5,
|
||||
0x72eacea8, 0xfa6484bb, 0x8d6612ae, 0xbf3c6f47,
|
||||
0xd29be463, 0x542f5d9e, 0xaec2771b, 0xf64e6370,
|
||||
0x740e0d8d, 0xe75b1357, 0xf8721671, 0xaf537d5d,
|
||||
0x4040cb08, 0x4eb4e2cc, 0x34d2466a, 0x0115af84,
|
||||
0xe1b00428, 0x95983a1d, 0x06b89fb4, 0xce6ea048,
|
||||
0x6f3f3b82, 0x3520ab82, 0x011a1d4b, 0x277227f8,
|
||||
0x611560b1, 0xe7933fdc, 0xbb3a792b, 0x344525bd,
|
||||
0xa08839e1, 0x51ce794b, 0x2f32c9b7, 0xa01fbac9,
|
||||
0xe01cc87e, 0xbcc7d1f6, 0xcf0111c3, 0xa1e8aac7,
|
||||
0x1a908749, 0xd44fbd9a, 0xd0dadecb, 0xd50ada38,
|
||||
0x0339c32a, 0xc6913667, 0x8df9317c, 0xe0b12b4f,
|
||||
0xf79e59b7, 0x43f5bb3a, 0xf2d519ff, 0x27d9459c,
|
||||
0xbf97222c, 0x15e6fc2a, 0x0f91fc71, 0x9b941525,
|
||||
0xfae59361, 0xceb69ceb, 0xc2a86459, 0x12baa8d1,
|
||||
0xb6c1075e, 0xe3056a0c, 0x10d25065, 0xcb03a442,
|
||||
0xe0ec6e0e, 0x1698db3b, 0x4c98a0be, 0x3278e964,
|
||||
0x9f1f9532, 0xe0d392df, 0xd3a0342b, 0x8971f21e,
|
||||
0x1b0a7441, 0x4ba3348c, 0xc5be7120, 0xc37632d8,
|
||||
0xdf359f8d, 0x9b992f2e, 0xe60b6f47, 0x0fe3f11d,
|
||||
0xe54cda54, 0x1edad891, 0xce6279cf, 0xcd3e7e6f,
|
||||
0x1618b166, 0xfd2c1d05, 0x848fd2c5, 0xf6fb2299,
|
||||
0xf523f357, 0xa6327623, 0x93a83531, 0x56cccd02,
|
||||
0xacf08162, 0x5a75ebb5, 0x6e163697, 0x88d273cc,
|
||||
0xde966292, 0x81b949d0, 0x4c50901b, 0x71c65614,
|
||||
0xe6c6c7bd, 0x327a140a, 0x45e1d006, 0xc3f27b9a,
|
||||
0xc9aa53fd, 0x62a80f00, 0xbb25bfe2, 0x35bdd2f6,
|
||||
0x71126905, 0xb2040222, 0xb6cbcf7c, 0xcd769c2b,
|
||||
0x53113ec0, 0x1640e3d3, 0x38abbd60, 0x2547adf0,
|
||||
0xba38209c, 0xf746ce76, 0x77afa1c5, 0x20756060,
|
||||
0x85cbfe4e, 0x8ae88dd8, 0x7aaaf9b0, 0x4cf9aa7e,
|
||||
0x1948c25c, 0x02fb8a8c, 0x01c36ae4, 0xd6ebe1f9,
|
||||
0x90d4f869, 0xa65cdea0, 0x3f09252d, 0xc208e69f,
|
||||
0xb74e6132, 0xce77e25b, 0x578fdfe3, 0x3ac372e6
|
||||
};
|
||||
|
||||
// bcrypt IV: "OrpheanBeholderScryDoubt"
|
||||
static private final int bf_crypt_ciphertext[] = {
|
||||
0x4f727068, 0x65616e42, 0x65686f6c,
|
||||
0x64657253, 0x63727944, 0x6f756274
|
||||
};
|
||||
|
||||
// Table for Base64 encoding
|
||||
static private final char base64_code[] = {
|
||||
'.', '/', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
|
||||
'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V',
|
||||
'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',
|
||||
'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
|
||||
'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5',
|
||||
'6', '7', '8', '9'
|
||||
};
|
||||
|
||||
// Table for Base64 decoding
|
||||
static private final byte index_64[] = {
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, 0, 1, 54, 55,
|
||||
56, 57, 58, 59, 60, 61, 62, 63, -1, -1,
|
||||
-1, -1, -1, -1, -1, 2, 3, 4, 5, 6,
|
||||
7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
|
||||
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
|
||||
-1, -1, -1, -1, -1, -1, 28, 29, 30,
|
||||
31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
|
||||
41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
|
||||
51, 52, 53, -1, -1, -1, -1, -1
|
||||
};
|
||||
|
||||
// Expanded Blowfish key
|
||||
private int P[];
|
||||
private int S[];
|
||||
|
||||
/**
|
||||
* Encode a byte array using bcrypt's slightly-modified base64
|
||||
* encoding scheme. Note that this is *not* compatible with
|
||||
* the standard MIME-base64 encoding.
|
||||
*
|
||||
* @param d the byte array to encode
|
||||
* @param len the number of bytes to encode
|
||||
* @return base64-encoded string
|
||||
* @exception IllegalArgumentException if the length is invalid
|
||||
*/
|
||||
private static String encode_base64(byte d[], int len)
|
||||
throws IllegalArgumentException {
|
||||
int off = 0;
|
||||
StringBuffer rs = new StringBuffer();
|
||||
int c1, c2;
|
||||
|
||||
if (len <= 0 || len > d.length)
|
||||
throw new IllegalArgumentException ("Invalid len");
|
||||
|
||||
while (off < len) {
|
||||
c1 = d[off++] & 0xff;
|
||||
rs.append(base64_code[(c1 >> 2) & 0x3f]);
|
||||
c1 = (c1 & 0x03) << 4;
|
||||
if (off >= len) {
|
||||
rs.append(base64_code[c1 & 0x3f]);
|
||||
break;
|
||||
}
|
||||
c2 = d[off++] & 0xff;
|
||||
c1 |= (c2 >> 4) & 0x0f;
|
||||
rs.append(base64_code[c1 & 0x3f]);
|
||||
c1 = (c2 & 0x0f) << 2;
|
||||
if (off >= len) {
|
||||
rs.append(base64_code[c1 & 0x3f]);
|
||||
break;
|
||||
}
|
||||
c2 = d[off++] & 0xff;
|
||||
c1 |= (c2 >> 6) & 0x03;
|
||||
rs.append(base64_code[c1 & 0x3f]);
|
||||
rs.append(base64_code[c2 & 0x3f]);
|
||||
}
|
||||
return rs.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Look up the 3 bits base64-encoded by the specified character,
|
||||
* range-checking againt conversion table
|
||||
* @param x the base64-encoded value
|
||||
* @return the decoded value of x
|
||||
*/
|
||||
private static byte char64(char x) {
|
||||
if ((int)x < 0 || (int)x > index_64.length)
|
||||
return -1;
|
||||
return index_64[(int)x];
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode a string encoded using bcrypt's base64 scheme to a
|
||||
* byte array. Note that this is *not* compatible with
|
||||
* the standard MIME-base64 encoding.
|
||||
* @param s the string to decode
|
||||
* @param maxolen the maximum number of bytes to decode
|
||||
* @return an array containing the decoded bytes
|
||||
* @throws IllegalArgumentException if maxolen is invalid
|
||||
*/
|
||||
private static byte[] decode_base64(String s, int maxolen)
|
||||
throws IllegalArgumentException {
|
||||
StringBuffer rs = new StringBuffer();
|
||||
int off = 0, slen = s.length(), olen = 0;
|
||||
byte ret[];
|
||||
byte c1, c2, c3, c4, o;
|
||||
|
||||
if (maxolen <= 0)
|
||||
throw new IllegalArgumentException ("Invalid maxolen");
|
||||
|
||||
while (off < slen - 1 && olen < maxolen) {
|
||||
c1 = char64(s.charAt(off++));
|
||||
c2 = char64(s.charAt(off++));
|
||||
if (c1 == -1 || c2 == -1)
|
||||
break;
|
||||
o = (byte)(c1 << 2);
|
||||
o |= (c2 & 0x30) >> 4;
|
||||
rs.append((char)o);
|
||||
if (++olen >= maxolen || off >= slen)
|
||||
break;
|
||||
c3 = char64(s.charAt(off++));
|
||||
if (c3 == -1)
|
||||
break;
|
||||
o = (byte)((c2 & 0x0f) << 4);
|
||||
o |= (c3 & 0x3c) >> 2;
|
||||
rs.append((char)o);
|
||||
if (++olen >= maxolen || off >= slen)
|
||||
break;
|
||||
c4 = char64(s.charAt(off++));
|
||||
o = (byte)((c3 & 0x03) << 6);
|
||||
o |= c4;
|
||||
rs.append((char)o);
|
||||
++olen;
|
||||
}
|
||||
|
||||
ret = new byte[olen];
|
||||
for (off = 0; off < olen; off++)
|
||||
ret[off] = (byte)rs.charAt(off);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Blowfish encipher a single 64-bit block encoded as
|
||||
* two 32-bit halves
|
||||
* @param lr an array containing the two 32-bit half blocks
|
||||
* @param off the position in the array of the blocks
|
||||
*/
|
||||
private final void encipher(int lr[], int off) {
|
||||
int i, n, l = lr[off], r = lr[off + 1];
|
||||
|
||||
l ^= P[0];
|
||||
for (i = 0; i <= BLOWFISH_NUM_ROUNDS - 2;) {
|
||||
// Feistel substitution on left word
|
||||
n = S[(l >> 24) & 0xff];
|
||||
n += S[0x100 | ((l >> 16) & 0xff)];
|
||||
n ^= S[0x200 | ((l >> 8) & 0xff)];
|
||||
n += S[0x300 | (l & 0xff)];
|
||||
r ^= n ^ P[++i];
|
||||
|
||||
// Feistel substitution on right word
|
||||
n = S[(r >> 24) & 0xff];
|
||||
n += S[0x100 | ((r >> 16) & 0xff)];
|
||||
n ^= S[0x200 | ((r >> 8) & 0xff)];
|
||||
n += S[0x300 | (r & 0xff)];
|
||||
l ^= n ^ P[++i];
|
||||
}
|
||||
lr[off] = r ^ P[BLOWFISH_NUM_ROUNDS + 1];
|
||||
lr[off + 1] = l;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cycically extract a word of key material
|
||||
* @param data the string to extract the data from
|
||||
* @param offp a "pointer" (as a one-entry array) to the
|
||||
* current offset into data
|
||||
* @return the next word of material from data
|
||||
*/
|
||||
private static int streamtoword(byte data[], int offp[]) {
|
||||
int i;
|
||||
int word = 0;
|
||||
int off = offp[0];
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
word = (word << 8) | (data[off] & 0xff);
|
||||
off = (off + 1) % data.length;
|
||||
}
|
||||
|
||||
offp[0] = off;
|
||||
return word;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise the Blowfish key schedule
|
||||
*/
|
||||
private void init_key() {
|
||||
P = (int[])P_orig.clone();
|
||||
S = (int[])S_orig.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
* Key the Blowfish cipher
|
||||
* @param key an array containing the key
|
||||
*/
|
||||
private void key(byte key[]) {
|
||||
int i;
|
||||
int koffp[] = { 0 };
|
||||
int lr[] = { 0, 0 };
|
||||
int plen = P.length, slen = S.length;
|
||||
|
||||
for (i = 0; i < plen; i++)
|
||||
P[i] = P[i] ^ streamtoword(key, koffp);
|
||||
|
||||
for (i = 0; i < plen; i += 2) {
|
||||
encipher(lr, 0);
|
||||
P[i] = lr[0];
|
||||
P[i + 1] = lr[1];
|
||||
}
|
||||
|
||||
for (i = 0; i < slen; i += 2) {
|
||||
encipher(lr, 0);
|
||||
S[i] = lr[0];
|
||||
S[i + 1] = lr[1];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform the "enhanced key schedule" step described by
|
||||
* Provos and Mazieres in "A Future-Adaptable Password Scheme"
|
||||
* http://www.openbsd.org/papers/bcrypt-paper.ps
|
||||
* @param data salt information
|
||||
* @param key password information
|
||||
*/
|
||||
private void ekskey(byte data[], byte key[]) {
|
||||
int i;
|
||||
int koffp[] = { 0 }, doffp[] = { 0 };
|
||||
int lr[] = { 0, 0 };
|
||||
int plen = P.length, slen = S.length;
|
||||
|
||||
for (i = 0; i < plen; i++)
|
||||
P[i] = P[i] ^ streamtoword(key, koffp);
|
||||
|
||||
for (i = 0; i < plen; i += 2) {
|
||||
lr[0] ^= streamtoword(data, doffp);
|
||||
lr[1] ^= streamtoword(data, doffp);
|
||||
encipher(lr, 0);
|
||||
P[i] = lr[0];
|
||||
P[i + 1] = lr[1];
|
||||
}
|
||||
|
||||
for (i = 0; i < slen; i += 2) {
|
||||
lr[0] ^= streamtoword(data, doffp);
|
||||
lr[1] ^= streamtoword(data, doffp);
|
||||
encipher(lr, 0);
|
||||
S[i] = lr[0];
|
||||
S[i + 1] = lr[1];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform the central password hashing step in the
|
||||
* bcrypt scheme
|
||||
* @param password the password to hash
|
||||
* @param salt the binary salt to hash with the password
|
||||
* @param log_rounds the binary logarithm of the number
|
||||
* of rounds of hashing to apply
|
||||
* @return an array containing the binary hashed password
|
||||
*/
|
||||
private byte[] crypt_raw(byte password[], byte salt[], int log_rounds) {
|
||||
int rounds, i, j;
|
||||
int cdata[] = (int[])bf_crypt_ciphertext.clone();
|
||||
int clen = cdata.length;
|
||||
byte ret[];
|
||||
|
||||
if (log_rounds < 4 || log_rounds > 31)
|
||||
throw new IllegalArgumentException ("Bad number of rounds");
|
||||
rounds = 1 << log_rounds;
|
||||
if (salt.length != BCRYPT_SALT_LEN)
|
||||
throw new IllegalArgumentException ("Bad salt length");
|
||||
|
||||
init_key();
|
||||
ekskey(salt, password);
|
||||
for (i = 0; i < rounds; i++) {
|
||||
key(password);
|
||||
key(salt);
|
||||
}
|
||||
|
||||
for (i = 0; i < 64; i++) {
|
||||
for (j = 0; j < (clen >> 1); j++)
|
||||
encipher(cdata, j << 1);
|
||||
}
|
||||
|
||||
ret = new byte[clen * 4];
|
||||
for (i = 0, j = 0; i < clen; i++) {
|
||||
ret[j++] = (byte)((cdata[i] >> 24) & 0xff);
|
||||
ret[j++] = (byte)((cdata[i] >> 16) & 0xff);
|
||||
ret[j++] = (byte)((cdata[i] >> 8) & 0xff);
|
||||
ret[j++] = (byte)(cdata[i] & 0xff);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hash a password using the OpenBSD bcrypt scheme
|
||||
* @param password the password to hash
|
||||
* @param salt the salt to hash with (perhaps generated
|
||||
* using BCrypt.gensalt)
|
||||
* @return the hashed password
|
||||
*/
|
||||
public static String hashpw(String password, String salt) {
|
||||
BCrypt B;
|
||||
String real_salt;
|
||||
byte passwordb[], saltb[], hashed[];
|
||||
char minor = (char)0;
|
||||
int rounds, off = 0;
|
||||
StringBuffer rs = new StringBuffer();
|
||||
|
||||
if (salt.charAt(0) != '$' || salt.charAt(1) != '2')
|
||||
throw new IllegalArgumentException ("Invalid salt version");
|
||||
if (salt.charAt(2) == '$')
|
||||
off = 3;
|
||||
else {
|
||||
minor = salt.charAt(2);
|
||||
if (minor != 'a' || salt.charAt(3) != '$')
|
||||
throw new IllegalArgumentException ("Invalid salt revision");
|
||||
off = 4;
|
||||
}
|
||||
|
||||
// Extract number of rounds
|
||||
if (salt.charAt(off + 2) > '$')
|
||||
throw new IllegalArgumentException ("Missing salt rounds");
|
||||
rounds = Integer.parseInt(salt.substring(off, off + 2));
|
||||
|
||||
real_salt = salt.substring(off + 3, off + 25);
|
||||
try {
|
||||
passwordb = (password + (minor >= 'a' ? "\000" : "")).getBytes("UTF-8");
|
||||
} catch (UnsupportedEncodingException uee) {
|
||||
throw new AssertionError("UTF-8 is not supported");
|
||||
}
|
||||
|
||||
saltb = decode_base64(real_salt, BCRYPT_SALT_LEN);
|
||||
|
||||
B = new BCrypt();
|
||||
hashed = B.crypt_raw(passwordb, saltb, rounds);
|
||||
|
||||
rs.append("$2");
|
||||
if (minor >= 'a')
|
||||
rs.append(minor);
|
||||
rs.append("$");
|
||||
if (rounds < 10)
|
||||
rs.append("0");
|
||||
rs.append(Integer.toString(rounds));
|
||||
rs.append("$");
|
||||
rs.append(encode_base64(saltb, saltb.length));
|
||||
rs.append(encode_base64(hashed,
|
||||
bf_crypt_ciphertext.length * 4 - 1));
|
||||
return rs.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a salt for use with the BCrypt.hashpw() method
|
||||
* @param log_rounds the log2 of the number of rounds of
|
||||
* hashing to apply - the work factor therefore increases as
|
||||
* 2**log_rounds.
|
||||
* @param random an instance of SecureRandom to use
|
||||
* @return an encoded salt value
|
||||
*/
|
||||
public static String gensalt(int log_rounds, SecureRandom random) {
|
||||
StringBuffer rs = new StringBuffer();
|
||||
byte rnd[] = new byte[BCRYPT_SALT_LEN];
|
||||
|
||||
random.nextBytes(rnd);
|
||||
|
||||
rs.append("$2a$");
|
||||
if (log_rounds < 10)
|
||||
rs.append("0");
|
||||
rs.append(Integer.toString(log_rounds));
|
||||
rs.append("$");
|
||||
rs.append(encode_base64(rnd, rnd.length));
|
||||
return rs.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a salt for use with the BCrypt.hashpw() method
|
||||
* @param log_rounds the log2 of the number of rounds of
|
||||
* hashing to apply - the work factor therefore increases as
|
||||
* 2**log_rounds.
|
||||
* @return an encoded salt value
|
||||
*/
|
||||
public static String gensalt(int log_rounds) {
|
||||
return gensalt(log_rounds, new SecureRandom());
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a salt for use with the BCrypt.hashpw() method,
|
||||
* selecting a reasonable default for the number of hashing
|
||||
* rounds to apply
|
||||
* @return an encoded salt value
|
||||
*/
|
||||
public static String gensalt() {
|
||||
return gensalt(GENSALT_DEFAULT_LOG2_ROUNDS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that a plaintext password matches a previously hashed
|
||||
* one
|
||||
* @param plaintext the plaintext password to verify
|
||||
* @param hashed the previously-hashed password
|
||||
* @return true if the passwords match, false otherwise
|
||||
*/
|
||||
public static boolean checkpw(String plaintext, String hashed) {
|
||||
return (hashed.compareTo(hashpw(plaintext, hashed)) == 0);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,185 @@
|
|||
/****************************************************************************
|
||||
* This software is part of the gCube Project.
|
||||
* Site: http://www.gcube-system.org/
|
||||
****************************************************************************
|
||||
* The gCube/gCore software is licensed as Free Open Source software
|
||||
* conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
* The software and documentation is provided by its authors/distributors
|
||||
* "as is" and no expressed or
|
||||
* implied warranty is given for its use, quality or fitness for a
|
||||
* particular case.
|
||||
****************************************************************************
|
||||
* Filename: XMLUtil.java
|
||||
****************************************************************************
|
||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
||||
***************************************************************************/
|
||||
|
||||
package org.gcube.portlets.admin.resourcemanagement.shared.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.resourcemanagement.support.shared.types.datamodel.AtomicTreeNode;
|
||||
|
||||
|
||||
|
||||
import com.google.gwt.xml.client.Document;
|
||||
import com.google.gwt.xml.client.Element;
|
||||
import com.google.gwt.xml.client.NamedNodeMap;
|
||||
import com.google.gwt.xml.client.Node;
|
||||
import com.google.gwt.xml.client.NodeList;
|
||||
import com.google.gwt.xml.client.XMLParser;
|
||||
|
||||
/**
|
||||
* @author Daniele Strollo (ISTI-CNR)
|
||||
*
|
||||
*/
|
||||
|
||||
public class XMLUtil {
|
||||
|
||||
public static AtomicTreeNode XMLToTree(final String xml, final String rootName)
|
||||
throws Exception {
|
||||
AtomicTreeNode root = null;
|
||||
Document doc = XMLParser.parse(xml);
|
||||
String rootTag = rootName;
|
||||
root = elementToNode((com.google.gwt.xml.client.Element) doc.getElementsByTagName(rootTag).item(0));
|
||||
return root;
|
||||
}
|
||||
|
||||
private static AtomicTreeNode elementToNode(final com.google.gwt.xml.client.Element el) throws Exception {
|
||||
if (el == null) {
|
||||
throw new Exception("Invalid Profile");
|
||||
}
|
||||
StringBuffer value = new StringBuffer(XMLUtil.getTextContent(el).trim());
|
||||
|
||||
if (el.hasAttributes()) {
|
||||
NamedNodeMap attr = el.getAttributes();
|
||||
String attrName = null;
|
||||
String attrVal = null;
|
||||
for (int i = 0; i < attr.getLength(); i++) {
|
||||
attrName = attr.item(i).getNodeName();
|
||||
attrVal = attr.getNamedItem(attrName).getNodeValue();
|
||||
value.append(attrName + " = " + attrVal + "; ");
|
||||
}
|
||||
} else {
|
||||
if (value != null && value.length() != 0) {
|
||||
value = new StringBuffer("value = " + value);
|
||||
}
|
||||
}
|
||||
|
||||
String tagName = el.getTagName() + ((value.length() != 0) ? " [" + value + "]" : "");
|
||||
AtomicTreeNode node = new AtomicTreeNode(tagName);
|
||||
Iterator<com.google.gwt.xml.client.Element> childrenIterator = XMLUtil.getElementChildren(el).iterator();
|
||||
while (childrenIterator.hasNext()) {
|
||||
node.add(elementToNode(childrenIterator.next()));
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
|
||||
public static Element getFirstElementChild(final Element parent) {
|
||||
if (parent == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Node current = parent.getFirstChild();
|
||||
while (current != null) {
|
||||
if (current.getNodeType() == Node.ELEMENT_NODE) {
|
||||
Element elem = (Element) current;
|
||||
return elem;
|
||||
}
|
||||
current = current.getNextSibling();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static Element getFirstElementChild(final Element parent, final String tagName) {
|
||||
if (parent == null || tagName == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Node current = parent.getFirstChild();
|
||||
while (current != null) {
|
||||
if (current.getNodeType() == Node.ELEMENT_NODE) {
|
||||
Element elem = (Element) current;
|
||||
if (tagName.equals(elem.getTagName())) {
|
||||
return elem;
|
||||
}
|
||||
}
|
||||
current = current.getNextSibling();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static List<com.google.gwt.xml.client.Element> getElementChildren(final Element parent) {
|
||||
ArrayList<Element> result = new ArrayList<Element>();
|
||||
if (parent == null) {
|
||||
return result;
|
||||
}
|
||||
|
||||
Node current = parent.getFirstChild();
|
||||
while (current != null) {
|
||||
if (current.getNodeType() == Node.ELEMENT_NODE) {
|
||||
Element elem = (Element) current;
|
||||
result.add(elem);
|
||||
}
|
||||
current = current.getNextSibling();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public static List<Element> getElementChildren(final Element parent, final String tagName) {
|
||||
ArrayList<Element> result = new ArrayList<Element>();
|
||||
if (parent == null || tagName == null) {
|
||||
return result;
|
||||
}
|
||||
Node current = parent.getFirstChild();
|
||||
while (current != null) {
|
||||
if (current.getNodeType() == Node.ELEMENT_NODE) {
|
||||
Element elem = (Element) current;
|
||||
if (tagName.equals(elem.getTagName())) {
|
||||
result.add(elem);
|
||||
}
|
||||
}
|
||||
current = current.getNextSibling();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public static String getTextContent(final Element parent) {
|
||||
StringBuffer result = new StringBuffer();
|
||||
if (parent == null) {
|
||||
return result.toString();
|
||||
}
|
||||
Node current = parent.getFirstChild();
|
||||
while (current != null) {
|
||||
if (current.getNodeType() == Node.TEXT_NODE) {
|
||||
result.append(current.getNodeValue());
|
||||
}
|
||||
current = current.getNextSibling();
|
||||
|
||||
}
|
||||
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
public static String getEntireContent(final Node parent) {
|
||||
StringBuilder result = new StringBuilder();
|
||||
if (parent != null) {
|
||||
NodeList children = parent.getChildNodes();
|
||||
for (int i = 0; i < children.getLength(); i++) {
|
||||
Node node = children.item(i);
|
||||
result.append(node.toString());
|
||||
//if(node.hasChildNodes()) result.append(getEntireContent(node));
|
||||
}
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
log4j.rootLogger=DEBUG, A1
|
||||
log4j.appender.A1=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
|
||||
|
||||
# Print the date in ISO 8601 format
|
||||
log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
|
||||
|
||||
# Print only messages of level TRACE or above in the package org.gcube
|
||||
log4j.logger.org.gcube=TRACE
|
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module rename-to='resourcemanagementportlet'>
|
||||
<!-- Inherit the core Web Toolkit stuff. -->
|
||||
<inherits name='com.google.gwt.user.User' />
|
||||
|
||||
<!-- To Comment out -->
|
||||
<!-- <set-property name="user.agent" value="safari,gecko1_8" /> -->
|
||||
|
||||
<!-- Other module inherits -->
|
||||
<inherits name='com.extjs.gxt.ui.GXT' />
|
||||
<inherits name='com.google.gwt.query.Query' />
|
||||
<!-- inherits Resource Sweeper Widget -->
|
||||
<inherits name='org.gcube.portlets.admin.resourcesweeper.Resource_sweeper' />
|
||||
|
||||
<!-- inherits IS Health Monitor Widget -->
|
||||
<inherits
|
||||
name='org.gcube.portlets.admin.ishealthmonitor.Resource_ishealth_monitor' />
|
||||
|
||||
<inherits name='org.gcube.resourcemanagement.support.Resource_support' />
|
||||
<entry-point
|
||||
class='org.gcube.portlets.admin.resourcemanagement.client.ResourceManagementPortlet' />
|
||||
<!-- Specify the paths for translatable code -->
|
||||
<source path='client' />
|
||||
<source path='shared' />
|
||||
<add-linker name="xsiframe" />
|
||||
</module>
|
|
@ -0,0 +1,335 @@
|
|||
/* Comment import to style regular, uncomment if deploying on openbio or d4science.org */
|
||||
/*@import url(openbio.css);*/
|
||||
@import url(coherence.css);
|
||||
|
||||
/* Fix the scrollbar background style*/
|
||||
.x-progress-text div {
|
||||
background-color: transparent !important;
|
||||
font-size: 11px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.iosItem {
|
||||
color: #444;
|
||||
font-family: "HelveticaNeue-Light", "Helvetica Neue Light",
|
||||
"Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
|
||||
font-weight: 300;
|
||||
font-size: 15px;
|
||||
display: block;
|
||||
margin-left: 10px;
|
||||
margin-top: 10px;
|
||||
padding: 5px;
|
||||
width: 120px;
|
||||
height: 100px;
|
||||
border-radius: 10px;
|
||||
-moz-border-radius: 10px;
|
||||
-webkit-border-radius: 10px;
|
||||
}
|
||||
|
||||
.wizardTextBox {
|
||||
background-color: white;
|
||||
border-width: 1px;
|
||||
-moz-border-radius: 4px;
|
||||
-webkit-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
letter-spacing: normal;
|
||||
line-height: 20px !important;;
|
||||
height: 35px !important;
|
||||
width: 295px;
|
||||
font-size: 18px !important;
|
||||
}
|
||||
|
||||
.portlet {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.x-menubar {
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.portlet-wrapper {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.lfr-grid .lfr-column {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* to fix bug in duallist
|
||||
*/
|
||||
.x-form-list input {
|
||||
left: -5000px;
|
||||
}
|
||||
|
||||
/** Add css rules here for your application. */
|
||||
.taskbar-pattern {
|
||||
background-image: url(images/pattern.gif);
|
||||
background-repeat: repeat;
|
||||
border: 2px solid #A9BFD3;
|
||||
border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
-webkit-border-radius: 5px;
|
||||
}
|
||||
|
||||
.taskbar-button {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.taskbar-button:hover,.taskbar-button:focus {
|
||||
border: 0px;
|
||||
-moz-transition: -moz-transform .15s linear;
|
||||
-o-transition: -o-transform .15s linear;
|
||||
-webkit-transition: -webkit-transform .15s linear;
|
||||
-webkit-transform: scale(1.10);
|
||||
-moz-transform: scale(1.10);
|
||||
-o-transform: scale(1.10);
|
||||
position: relative;
|
||||
z-index: 5;
|
||||
cursor: pointer;
|
||||
cursor: hand;
|
||||
}
|
||||
|
||||
.x-hide-panel-header {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.x-grid-invalid-row {
|
||||
border: 1px solid;
|
||||
background: repeat-x left top;
|
||||
color: lime;
|
||||
}
|
||||
|
||||
/*
|
||||
* Used as initial background for the central panel
|
||||
*/
|
||||
.x-panel-cube-background {
|
||||
color: #000;
|
||||
border: 0px;
|
||||
/* background-image:url(images/icons/bigcube.gif); */
|
||||
background-repeat: no-repeat;
|
||||
background-position: center center;
|
||||
}
|
||||
|
||||
.left-panel-tree-background {
|
||||
color: #000;
|
||||
border: 0px;
|
||||
background-image: url(images/d4infra.gif);
|
||||
background-repeat: no-repeat;
|
||||
background-position: center center;
|
||||
}
|
||||
|
||||
/* HERE THE ICONS */
|
||||
.detach-icon {
|
||||
background-image: url(images/icons/detach.png) !important;
|
||||
}
|
||||
|
||||
.profile-folder-icon {
|
||||
background-image: url(images/icons/folder.png) !important;
|
||||
}
|
||||
|
||||
.profile-icon {
|
||||
background-image: url(images/icons/profile.gif) !important;
|
||||
}
|
||||
|
||||
.shutdown-icon {
|
||||
background-image: url(images/icons/shutdown.png) !important;
|
||||
}
|
||||
|
||||
.sweeper-icon {
|
||||
background-image: url(images/icons/sweeper2.png) !important;
|
||||
}
|
||||
|
||||
.new-icon {
|
||||
background-image: url(images/icons/new.png) !important;
|
||||
}
|
||||
|
||||
.install-icon {
|
||||
background-image: url(images/icons/install.png) !important;
|
||||
}
|
||||
|
||||
.deploy-icon {
|
||||
background-image: url(images/icons/deploy.png) !important;
|
||||
}
|
||||
|
||||
.add-software-icon {
|
||||
background-image: url(images/icons/cog_add.png) !important;
|
||||
}
|
||||
|
||||
.is-icon {
|
||||
background-image: url(images/icons/is.png) !important;
|
||||
}
|
||||
|
||||
.getreport-icon {
|
||||
background-image: url(images/icons/report.png) !important;
|
||||
}
|
||||
|
||||
.link-icon {
|
||||
background-image: url(images/icons/link.png) !important;
|
||||
}
|
||||
|
||||
.restart-icon {
|
||||
background-image: url(images/icons/restart.png) !important;
|
||||
}
|
||||
|
||||
.clean-restart-icon {
|
||||
background-image: url(images/icons/clean-restart.png) !important;
|
||||
}
|
||||
/*
|
||||
.profile-big-icon {
|
||||
background-image:url(images/icons/profile-big.gif) !important;
|
||||
}*/
|
||||
.report-big-icon {
|
||||
background-image: url(images/icons/report-big.png) !important;
|
||||
}
|
||||
|
||||
.refresh-icon {
|
||||
background-image: url(images/icons/refresh.png) !important;
|
||||
}
|
||||
|
||||
.close-icon {
|
||||
background-image: url(images/icons/close.png) !important;
|
||||
}
|
||||
|
||||
.closeall-icon {
|
||||
background-image: url(images/icons/closeall.png) !important;
|
||||
}
|
||||
|
||||
.upgrade-icon {
|
||||
background-image: url(images/icons/upgrade.png) !important;
|
||||
}
|
||||
|
||||
.delete-icon {
|
||||
background-image: url(images/icons/delete.png) !important;
|
||||
}
|
||||
|
||||
.force-delete-icon {
|
||||
background-image: url(images/icons/forcedelete.png) !important;
|
||||
}
|
||||
|
||||
.grid-icon {
|
||||
background-image: url(images/icons/grid.png) !important;
|
||||
top: -2px;
|
||||
}
|
||||
|
||||
.validate-icon {
|
||||
background-image: url(images/icons/validate.gif) !important;
|
||||
top: -2px;
|
||||
}
|
||||
|
||||
.console-error-icon {
|
||||
background-image: url(images/icons/error.png) !important;
|
||||
}
|
||||
|
||||
.console-log-icon {
|
||||
background-image: url(images/icons/log.png) !important;
|
||||
}
|
||||
|
||||
.clear-icon {
|
||||
background-image: url(images/icons/trash.png) !important;
|
||||
}
|
||||
|
||||
.console-icon {
|
||||
background-image: url(images/icons/console.png) !important;
|
||||
}
|
||||
|
||||
.about-icon {
|
||||
background-image: url(images/icons/about.png) !important;
|
||||
}
|
||||
|
||||
.defaultleaf-icon {
|
||||
background-image: url(images/icons/grid.png) !important;
|
||||
}
|
||||
|
||||
.resources-icon {
|
||||
background-image: url(images/icons/world.png) !important;
|
||||
}
|
||||
|
||||
|
||||
/* RESOURCES */
|
||||
|
||||
.collection-icon {
|
||||
background-image: url(images/resource-icons/violet.png) !important;
|
||||
}
|
||||
|
||||
.runninginstance-icon {
|
||||
background-image: url(images/resource-icons/blue.png) !important;
|
||||
}
|
||||
|
||||
.genericresource-icon {
|
||||
background-image: url(images/resource-icons/green.png) !important;
|
||||
}
|
||||
|
||||
.ghn-icon {
|
||||
background-image: url(images/resource-icons/ramarro.png) !important;
|
||||
}
|
||||
.runtimeresource-icon {
|
||||
background-image: url(images/resource-icons/yellow.png) !important;
|
||||
}
|
||||
.service-icon {
|
||||
background-image: url(images/resource-icons/orange.png) !important;
|
||||
}
|
||||
.wsresources-icon {
|
||||
background-image: url(images/resource-icons/red.png) !important;
|
||||
}
|
||||
/* END RESOURCES */
|
||||
|
||||
.pluginCM-icon {
|
||||
background-image: url(images/icons/pluginCM.png) !important;
|
||||
}
|
||||
|
||||
.pluginTM-icon {
|
||||
background-image: url(images/tree_diag.png) !important;
|
||||
}
|
||||
|
||||
.pluginVM-icon {
|
||||
background-image: url(images/icons/eye.png) !important;
|
||||
}
|
||||
|
||||
.metadatacollection-icon {
|
||||
background-image: url(images/icons/table_multiple.png) !important;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.empty-icon {
|
||||
background-image: url(images/icons/error.png) !important;
|
||||
}
|
||||
|
||||
.addtoscope-icon {
|
||||
background-image: url(images/icons/brick_add.png) !important;
|
||||
}
|
||||
|
||||
.removefromscope-icon {
|
||||
background-image: url(images/icons/brick_delete.png) !important;
|
||||
}
|
||||
|
||||
.edit-icon {
|
||||
background-image: url(images/icons/wand.png) !important;
|
||||
}
|
||||
|
||||
.sendButton {
|
||||
display: block;
|
||||
font-size: 16pt;
|
||||
}
|
||||
|
||||
/** Most GWT widgets already have a style name defined */
|
||||
.gwt-DialogBox {
|
||||
width: 400px;
|
||||
}
|
||||
|
||||
.dialogVPanel {
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
.serverResponseLabelError {
|
||||
color: red;
|
||||
}
|
||||
|
||||
/** Set ids using widget.getElement().setId("idOfElement") */
|
||||
#closeButton {
|
||||
margin: 15px 6px 6px;
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
<!doctype html>
|
||||
<!-- The DOCTYPE declaration above will set the -->
|
||||
<!-- browser's rendering engine into -->
|
||||
<!-- "Standards Mode". Replacing this declaration -->
|
||||
<!-- with a "Quirks Mode" doctype may lead to some -->
|
||||
<!-- differences in layout. -->
|
||||
|
||||
<html>
|
||||
<head>
|
||||
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<meta HTTP-EQUIV="Expires" CONTENT="0">
|
||||
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
|
||||
<meta HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
|
||||
|
||||
<link rel="shortcut icon" href="mask_images/favicon.gif" >
|
||||
<link href='http://fonts.googleapis.com/css?family=Reenie+Beanie' rel='stylesheet' type='text/css'>
|
||||
<title>D4Science Infrastructure Monitor</title>
|
||||
|
||||
|
||||
|
||||
<!-- -->
|
||||
<!-- Consider inlining CSS to reduce the number of requested files -->
|
||||
<!-- -->
|
||||
|
||||
<link type="text/css" rel="stylesheet" href="xmlverbatim.css" />
|
||||
<link type="text/css" rel="stylesheet" href="gxt/css/gxt-all.css" />
|
||||
<link type="text/css" rel="stylesheet" href="ResourceManagementPortlet.css" />
|
||||
|
||||
<script type="text/javascript" language="javascript"
|
||||
src="resourcemanagementportlet/resourcemanagementportlet.nocache.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
|
||||
<body>
|
||||
<div style="margin-top: 5px; margin-left: 5px;" id="MyUniqueDIV"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<%@page contentType="text/html"%>
|
||||
<%@page pageEncoding="UTF-8"%>
|
||||
|
||||
<%-- Uncomment below lines to add portlet taglibs to jsp
|
||||
<%@ page import="javax.portlet.*"%>
|
||||
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>
|
||||
|
||||
<portlet:defineObjects />
|
||||
--%>
|
||||
|
||||
<b>
|
||||
EDIT MODE
|
||||
</b>
|
|
@ -0,0 +1,13 @@
|
|||
<%@page contentType="text/html"%>
|
||||
<%@page pageEncoding="UTF-8"%>
|
||||
|
||||
<%-- Uncomment below lines to add portlet taglibs to jsp
|
||||
<%@ page import="javax.portlet.*"%>
|
||||
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>
|
||||
|
||||
<portlet:defineObjects />
|
||||
--%>
|
||||
|
||||
<b>
|
||||
HELP MODE
|
||||
</b>
|
|
@ -0,0 +1,20 @@
|
|||
<%@page contentType="text/html"%>
|
||||
<%@page pageEncoding="UTF-8"%>
|
||||
|
||||
<%-- Uncomment below lines to add portlet taglibs to jsp
|
||||
<%@ page import="javax.portlet.*"%>
|
||||
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>
|
||||
|
||||
<portlet:defineObjects />
|
||||
--%>
|
||||
<!-- -->
|
||||
<!-- Consider inlining CSS to reduce the number of requested files -->
|
||||
<!-- -->
|
||||
<link href='http://fonts.googleapis.com/css?family=Reenie+Beanie' rel='stylesheet' type='text/css'>
|
||||
<link type="text/css" rel="stylesheet" href="<%=request.getContextPath()%>/xmlverbatim.css">
|
||||
<link type="text/css" rel="stylesheet" href="<%=request.getContextPath()%>/gxt/css/gxt-all.css" />
|
||||
<link type="text/css" rel="stylesheet" href="<%=request.getContextPath()%>/ResourceManagementPortlet.css" />
|
||||
|
||||
|
||||
<script type="text/javascript" language="javascript" src="<%=request.getContextPath()%>/resourcemanagementportlet/resourcemanagementportlet.nocache.js"></script>
|
||||
<div id="MyUniqueDIV" class="portlet-wrapper"></div>
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE display PUBLIC "-//Liferay//DTD Display 6.2.0//EN" "http://www.liferay.com/dtd/liferay-display_6_2_0.dtd">
|
||||
|
||||
<display>
|
||||
<category name="gCube Enabling Apps">
|
||||
<portlet id="resources-management" />
|
||||
</category>
|
||||
</display>
|
|
@ -0,0 +1,9 @@
|
|||
name=Resources Management
|
||||
module-group-id=liferay
|
||||
module-incremental-version=1
|
||||
tags=
|
||||
short-description=
|
||||
change-log=
|
||||
page-url=http://www.d4science.eu
|
||||
author=D4Science EU
|
||||
licenses=
|
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE liferay-portlet-app PUBLIC "-//Liferay//DTD Portlet Application 6.2.0//EN" "http://www.liferay.com/dtd/liferay-portlet-app_6_2_0.dtd">
|
||||
|
||||
<liferay-portlet-app>
|
||||
<portlet>
|
||||
<portlet-name>resources-management</portlet-name>
|
||||
<layout-cacheable>false</layout-cacheable>
|
||||
<instanceable>false</instanceable>
|
||||
<ajaxable>false</ajaxable>
|
||||
<header-portlet-css>/ResourceManagementPortlet.css</header-portlet-css>
|
||||
</portlet>
|
||||
<role-mapper>
|
||||
<role-name>administrator</role-name>
|
||||
<role-link>Administrator</role-link>
|
||||
</role-mapper>
|
||||
<role-mapper>
|
||||
<role-name>guest</role-name>
|
||||
<role-link>Guest</role-link>
|
||||
</role-mapper>
|
||||
<role-mapper>
|
||||
<role-name>power-user</role-name>
|
||||
<role-link>Power User</role-link>
|
||||
</role-mapper>
|
||||
<role-mapper>
|
||||
<role-name>user</role-name>
|
||||
<role-link>User</role-link>
|
||||
</role-mapper>
|
||||
</liferay-portlet-app>
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0"?>
|
||||
<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd">
|
||||
<portlet>
|
||||
<portlet-name>resources-management</portlet-name>
|
||||
<display-name>Resources Management</display-name>
|
||||
<portlet-class>org.gcube.portlets.admin.resourcemanagement.server.portlet.ResourceManagementPortlet</portlet-class>
|
||||
<init-param>
|
||||
<name>view-jsp</name>
|
||||
<value>/WEB-INF/ResourceManagementPortlet_view.jsp</value>
|
||||
</init-param>
|
||||
<expiration-cache>0</expiration-cache>
|
||||
<supports>
|
||||
<mime-type>text/html</mime-type>
|
||||
</supports>
|
||||
<portlet-info>
|
||||
<title>Resources Management</title>
|
||||
<short-title>Resources Management</short-title>
|
||||
<keywords>Resources Management</keywords>
|
||||
</portlet-info>
|
||||
<security-role-ref>
|
||||
<role-name>administrator</role-name>
|
||||
</security-role-ref>
|
||||
</portlet>
|
||||
</portlet-app>
|
|
@ -0,0 +1,69 @@
|
|||
<?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_2_5.xsd"
|
||||
version="2.5">
|
||||
|
||||
|
||||
<!-- Servlets -->
|
||||
<servlet>
|
||||
<servlet-name>ServiceProxy</servlet-name>
|
||||
<servlet-class>org.gcube.portlets.admin.resourcemanagement.server.ServiceProxyImpl</servlet-class>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>ServiceProxy</servlet-name>
|
||||
<url-pattern>/resourcemanagementportlet/ServiceProxy</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<!-- Sweeper -->
|
||||
<servlet>
|
||||
<servlet-name>sweeperServlet</servlet-name>
|
||||
<servlet-class>org.gcube.portlets.admin.resourcesweeper.server.SweeperServiceImpl</servlet-class>
|
||||
</servlet>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>sweeperServlet</servlet-name>
|
||||
<url-pattern>/resourcemanagementportlet/sweeper</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<!-- AuthZ -->
|
||||
<filter>
|
||||
<filter-name>AuthFilter</filter-name>
|
||||
<filter-class>org.gcube.resourcemanagement.support.shared.util.TokenFilter</filter-class>
|
||||
</filter>
|
||||
<filter-mapping>
|
||||
<filter-name>AuthFilter</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
|
||||
|
||||
<!-- IS Health -->
|
||||
<servlet>
|
||||
<servlet-name>isHealthServlet</servlet-name>
|
||||
<servlet-class>org.gcube.portlets.admin.ishealthmonitor.server.ISMonitorServiceImpl</servlet-class>
|
||||
</servlet>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>isHealthServlet</servlet-name>
|
||||
<url-pattern>/resourcemanagementportlet/ishealth</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>jUnitHostImpl</servlet-name>
|
||||
<servlet-class>com.google.gwt.junit.server.JUnitHostImpl</servlet-class>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>jUnitHostImpl</servlet-name>
|
||||
<url-pattern>/resourcemanagementportlet/junithost/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
<servlet-mapping>
|
||||
<servlet-name>jUnitHostImpl</servlet-name>
|
||||
<url-pattern>/org.gcube.portlets.admin.resourcemanagement.ResourceManagementPortletJUnit/junithost/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<!-- Default page to serve -->
|
||||
<welcome-file-list>
|
||||
<welcome-file>ResourceManagementPortlet.html</welcome-file>
|
||||
</welcome-file-list>
|
||||
|
||||
</web-app>
|
|
@ -0,0 +1,76 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<infrastructures>
|
||||
|
||||
<infrastructure>
|
||||
<name>d4science</name>
|
||||
<vos>
|
||||
<vo>
|
||||
<name>d4science</name>
|
||||
<src>ServiceMap_d4science.research-infrastructures.eu.xml</src>
|
||||
<scope>/d4science.research-infrastructures.eu</scope>
|
||||
</vo>
|
||||
<vo>
|
||||
<name>d4science/D4Research</name>
|
||||
<src>ServiceMap_D4Research.xml</src>
|
||||
<scope>/d4science.research-infrastructures.eu/D4Research</scope>
|
||||
</vo>
|
||||
<vo>
|
||||
<name>d4science/Edison</name>
|
||||
<src>ServiceMap_Edison.xml</src>
|
||||
<scope>/d4science.research-infrastructures.eu/Edison</scope>
|
||||
</vo>
|
||||
<vo>
|
||||
<name>d4science/FARM</name>
|
||||
<src>ServiceMap_FARM.xml</src>
|
||||
<scope>/d4science.research-infrastructures.eu/FARM</scope>
|
||||
</vo>
|
||||
<vo>
|
||||
<name>d4science/gCubeApps</name>
|
||||
<src>ServiceMap_gCubeApps.xml</src>
|
||||
<scope>/d4science.research-infrastructures.eu/gCubeApps</scope>
|
||||
</vo>
|
||||
<vo>
|
||||
<name>d4science/OpenAIRE</name>
|
||||
<src>ServiceMap_OpenAIRE.xml</src>
|
||||
<scope>/d4science.research-infrastructures.eu/OpenAIRE</scope>
|
||||
</vo>
|
||||
<vo>
|
||||
<name>d4science/SmartArea</name>
|
||||
<src>ServiceMap_SmartArea.xml</src>
|
||||
<scope>/d4science.research-infrastructures.eu/SmartArea</scope>
|
||||
</vo>
|
||||
<vo>
|
||||
<name>d4science/SoBigData</name>
|
||||
<src>ServiceMap_SoBigData.xml</src>
|
||||
<scope>/d4science.research-infrastructures.eu/SoBigData</scope>
|
||||
</vo>
|
||||
</vos>
|
||||
</infrastructure>
|
||||
|
||||
<infrastructure>
|
||||
<name>gcube</name>
|
||||
<vos>
|
||||
<vo>
|
||||
<name>gcube</name>
|
||||
<src>ServiceMap_gcube.xml</src>
|
||||
<scope>/gcube</scope>
|
||||
</vo>
|
||||
<vo>
|
||||
<name>gcube/devsec</name>
|
||||
<src>ServiceMap_devsec.xml</src>
|
||||
<scope>/gcube/devsec</scope>
|
||||
</vo>
|
||||
<vo>
|
||||
<name>gcube/devNext</name>
|
||||
<src>ServiceMap_devNext.xml</src>
|
||||
<scope>/gcube/devNext</scope>
|
||||
</vo>
|
||||
<vo>
|
||||
<name>gcube/preprod</name>
|
||||
<src>ServiceMap_preprod.xml</src>
|
||||
<scope>/gcube/preprod</scope>
|
||||
</vo>
|
||||
</vos>
|
||||
</infrastructure>
|
||||
|
||||
</infrastructures>
|
|
@ -0,0 +1,76 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<infrastructures>
|
||||
|
||||
<infrastructure>
|
||||
<name>d4science</name>
|
||||
<vos>
|
||||
<vo>
|
||||
<name>d4science</name>
|
||||
<src>ServiceMap_d4science.research-infrastructures.eu.xml</src>
|
||||
<scope>/d4science.research-infrastructures.eu</scope>
|
||||
</vo>
|
||||
<vo>
|
||||
<name>d4science/D4Research</name>
|
||||
<src>ServiceMap_D4Research.xml</src>
|
||||
<scope>/d4science.research-infrastructures.eu/D4Research</scope>
|
||||
</vo>
|
||||
<vo>
|
||||
<name>d4science/Edison</name>
|
||||
<src>ServiceMap_Edison.xml</src>
|
||||
<scope>/d4science.research-infrastructures.eu/Edison</scope>
|
||||
</vo>
|
||||
<vo>
|
||||
<name>d4science/FARM</name>
|
||||
<src>ServiceMap_FARM.xml</src>
|
||||
<scope>/d4science.research-infrastructures.eu/FARM</scope>
|
||||
</vo>
|
||||
<vo>
|
||||
<name>d4science/gCubeApps</name>
|
||||
<src>ServiceMap_gCubeApps.xml</src>
|
||||
<scope>/d4science.research-infrastructures.eu/gCubeApps</scope>
|
||||
</vo>
|
||||
<vo>
|
||||
<name>d4science/OpenAIRE</name>
|
||||
<src>ServiceMap_OpenAIRE.xml</src>
|
||||
<scope>/d4science.research-infrastructures.eu/OpenAIRE</scope>
|
||||
</vo>
|
||||
<vo>
|
||||
<name>d4science/SmartArea</name>
|
||||
<src>ServiceMap_SmartArea.xml</src>
|
||||
<scope>/d4science.research-infrastructures.eu/SmartArea</scope>
|
||||
</vo>
|
||||
<vo>
|
||||
<name>d4science/SoBigData</name>
|
||||
<src>ServiceMap_SoBigData.xml</src>
|
||||
<scope>/d4science.research-infrastructures.eu/SoBigData</scope>
|
||||
</vo>
|
||||
</vos>
|
||||
</infrastructure>
|
||||
|
||||
<infrastructure>
|
||||
<name>gcube</name>
|
||||
<vos>
|
||||
<vo>
|
||||
<name>gcube</name>
|
||||
<src>ServiceMap_gcube.xml</src>
|
||||
<scope>/gcube</scope>
|
||||
</vo>
|
||||
<vo>
|
||||
<name>gcube/devsec</name>
|
||||
<src>ServiceMap_devsec.xml</src>
|
||||
<scope>/gcube/devsec</scope>
|
||||
</vo>
|
||||
<vo>
|
||||
<name>gcube/devNext</name>
|
||||
<src>ServiceMap_devNext.xml</src>
|
||||
<scope>/gcube/devNext</scope>
|
||||
</vo>
|
||||
<vo>
|
||||
<name>gcube/preprod</name>
|
||||
<src>ServiceMap_preprod.xml</src>
|
||||
<scope>/gcube/preprod</scope>
|
||||
</vo>
|
||||
</vos>
|
||||
</infrastructure>
|
||||
|
||||
</infrastructures>
|
|
@ -0,0 +1,322 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
|
||||
<!--
|
||||
XML to HTML Verbatim Formatter with Syntax Highlighting
|
||||
Version 1.1
|
||||
Contributors: Doug Dicks, added auto-indent (parameter indent-elements)
|
||||
for pretty-print
|
||||
|
||||
Copyright 2002 Oliver Becker
|
||||
ob@obqo.de
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
Unless required by applicable law or agreed to in writing, software distributed
|
||||
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||||
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations under the License.
|
||||
|
||||
Alternatively, this software may be used under the terms of the
|
||||
GNU Lesser General Public License (LGPL).
|
||||
-->
|
||||
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:verb="http://informatik.hu-berlin.de/xmlverbatim"
|
||||
exclude-result-prefixes="verb">
|
||||
|
||||
<xsl:output method="html" omit-xml-declaration="yes" indent="no"/>
|
||||
|
||||
<xsl:param name="indent-elements" select="true()" />
|
||||
|
||||
<xsl:template match="/">
|
||||
<xsl:apply-templates select="." mode="xmlverb" />
|
||||
</xsl:template>
|
||||
|
||||
<!-- root -->
|
||||
<xsl:template match="/" mode="xmlverb">
|
||||
<xsl:text>
</xsl:text>
|
||||
<xsl:comment>
|
||||
<xsl:text> converted by xmlverbatim.xsl 1.1, (c) O. Becker </xsl:text>
|
||||
</xsl:comment>
|
||||
<xsl:text>
</xsl:text>
|
||||
<div class="xmlverb-default">
|
||||
<xsl:apply-templates mode="xmlverb">
|
||||
<xsl:with-param name="indent-elements" select="$indent-elements" />
|
||||
</xsl:apply-templates>
|
||||
</div>
|
||||
<xsl:text>
</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<!-- wrapper -->
|
||||
<xsl:template match="verb:wrapper">
|
||||
<xsl:apply-templates mode="xmlverb">
|
||||
<xsl:with-param name="indent-elements" select="$indent-elements" />
|
||||
</xsl:apply-templates>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="verb:wrapper" mode="xmlverb">
|
||||
<xsl:apply-templates mode="xmlverb">
|
||||
<xsl:with-param name="indent-elements" select="$indent-elements" />
|
||||
</xsl:apply-templates>
|
||||
</xsl:template>
|
||||
|
||||
<!-- element nodes -->
|
||||
<xsl:template match="*" mode="xmlverb">
|
||||
<xsl:param name="indent-elements" select="false()" />
|
||||
<xsl:param name="indent" select="''" />
|
||||
<xsl:param name="indent-increment" select="'   '" />
|
||||
<xsl:if test="$indent-elements">
|
||||
<br/>
|
||||
<xsl:value-of select="$indent" />
|
||||
</xsl:if>
|
||||
<xsl:text><</xsl:text>
|
||||
<xsl:variable name="ns-prefix"
|
||||
select="substring-before(name(),':')" />
|
||||
<xsl:if test="$ns-prefix != ''">
|
||||
<span class="xmlverb-element-nsprefix">
|
||||
<xsl:value-of select="$ns-prefix"/>
|
||||
</span>
|
||||
<xsl:text>:</xsl:text>
|
||||
</xsl:if>
|
||||
<span class="xmlverb-element-name">
|
||||
<xsl:value-of select="local-name()"/>
|
||||
</span>
|
||||
<xsl:variable name="pns" select="../namespace::*"/>
|
||||
<xsl:if test="$pns[name()=''] and not(namespace::*[name()=''])">
|
||||
<span class="xmlverb-ns-name">
|
||||
<xsl:text> xmlns</xsl:text>
|
||||
</span>
|
||||
<xsl:text>=""</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:for-each select="namespace::*">
|
||||
<!--<xsl:if test="not($pns[name()=name(current()) and .=current()])"> -->
|
||||
<xsl:call-template name="xmlverb-ns" />
|
||||
<!-- </xsl:if> -->
|
||||
</xsl:for-each>
|
||||
<xsl:for-each select="@*">
|
||||
<xsl:call-template name="xmlverb-attrs" />
|
||||
</xsl:for-each>
|
||||
<xsl:choose>
|
||||
<xsl:when test="node()">
|
||||
<xsl:text>></xsl:text>
|
||||
<xsl:apply-templates mode="xmlverb">
|
||||
<xsl:with-param name="indent-elements"
|
||||
select="$indent-elements"/>
|
||||
<xsl:with-param name="indent"
|
||||
select="concat($indent, $indent-increment)"/>
|
||||
<xsl:with-param name="indent-increment"
|
||||
select="$indent-increment"/>
|
||||
</xsl:apply-templates>
|
||||
<xsl:if test="* and $indent-elements">
|
||||
<br/>
|
||||
<xsl:value-of select="$indent" />
|
||||
</xsl:if>
|
||||
<xsl:text></</xsl:text>
|
||||
<xsl:if test="$ns-prefix != ''">
|
||||
<span class="xmlverb-element-nsprefix">
|
||||
<xsl:value-of select="$ns-prefix"/>
|
||||
</span>
|
||||
<xsl:text>:</xsl:text>
|
||||
</xsl:if>
|
||||
<span class="xmlverb-element-name">
|
||||
<xsl:value-of select="local-name()"/>
|
||||
</span>
|
||||
<xsl:text>></xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text> /></xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:if test="not(parent::*)"><br /><xsl:text>
</xsl:text></xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<!-- attribute nodes -->
|
||||
<xsl:template name="xmlverb-attrs">
|
||||
<xsl:text> </xsl:text>
|
||||
<span class="xmlverb-attr-name">
|
||||
<xsl:value-of select="name()"/>
|
||||
</span>
|
||||
<xsl:text>="</xsl:text>
|
||||
<span class="xmlverb-attr-content">
|
||||
<xsl:call-template name="html-replace-entities">
|
||||
<xsl:with-param name="text" select="normalize-space(.)" />
|
||||
<xsl:with-param name="attrs" select="true()" />
|
||||
</xsl:call-template>
|
||||
</span>
|
||||
<xsl:text>"</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<!-- namespace nodes -->
|
||||
<xsl:template name="xmlverb-ns">
|
||||
<xsl:if test="name()!='xml'">
|
||||
<span class="xmlverb-ns-name">
|
||||
<xsl:text> xmlns</xsl:text>
|
||||
<xsl:if test="name()!=''">
|
||||
<xsl:text>:</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:value-of select="name()"/>
|
||||
</span>
|
||||
<xsl:text>="</xsl:text>
|
||||
<span class="xmlverb-ns-uri">
|
||||
<xsl:value-of select="."/>
|
||||
</span>
|
||||
<xsl:text>"</xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<!-- text nodes -->
|
||||
<xsl:template match="text()" mode="xmlverb">
|
||||
<span class="xmlverb-text">
|
||||
<xsl:call-template name="preformatted-output">
|
||||
<xsl:with-param name="text">
|
||||
<xsl:call-template name="html-replace-entities">
|
||||
<xsl:with-param name="text" select="." />
|
||||
</xsl:call-template>
|
||||
</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</span>
|
||||
</xsl:template>
|
||||
|
||||
<!-- comments -->
|
||||
<xsl:template match="comment()" mode="xmlverb">
|
||||
<xsl:text><!--</xsl:text>
|
||||
<span class="xmlverb-comment">
|
||||
<xsl:call-template name="preformatted-output">
|
||||
<xsl:with-param name="text" select="." />
|
||||
</xsl:call-template>
|
||||
</span>
|
||||
<xsl:text>--></xsl:text>
|
||||
<xsl:if test="not(parent::*)"><br /><xsl:text>
</xsl:text></xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<!-- processing instructions -->
|
||||
<xsl:template match="processing-instruction()" mode="xmlverb">
|
||||
<xsl:text><?</xsl:text>
|
||||
<span class="xmlverb-pi-name">
|
||||
<xsl:value-of select="name()"/>
|
||||
</span>
|
||||
<xsl:if test=".!=''">
|
||||
<xsl:text> </xsl:text>
|
||||
<span class="xmlverb-pi-content">
|
||||
<xsl:value-of select="."/>
|
||||
</span>
|
||||
</xsl:if>
|
||||
<xsl:text>?></xsl:text>
|
||||
<xsl:if test="not(parent::*)"><br /><xsl:text>
</xsl:text></xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- =========================================================== -->
|
||||
<!-- Procedures / Functions -->
|
||||
<!-- =========================================================== -->
|
||||
|
||||
<!-- generate entities by replacing &, ", < and > in $text -->
|
||||
<xsl:template name="html-replace-entities">
|
||||
<xsl:param name="text" />
|
||||
<xsl:param name="attrs" />
|
||||
<xsl:variable name="tmp">
|
||||
<xsl:call-template name="replace-substring">
|
||||
<xsl:with-param name="from" select="'>'" />
|
||||
<xsl:with-param name="to" select="'&gt;'" />
|
||||
<xsl:with-param name="value">
|
||||
<xsl:call-template name="replace-substring">
|
||||
<xsl:with-param name="from" select="'<'" />
|
||||
<xsl:with-param name="to" select="'&lt;'" />
|
||||
<xsl:with-param name="value">
|
||||
<xsl:call-template name="replace-substring">
|
||||
<xsl:with-param name="from"
|
||||
select="'&'" />
|
||||
<xsl:with-param name="to"
|
||||
select="'&amp;'" />
|
||||
<xsl:with-param name="value"
|
||||
select="$text" />
|
||||
</xsl:call-template>
|
||||
</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:choose>
|
||||
<!-- $text is an attribute value -->
|
||||
<xsl:when test="$attrs">
|
||||
<xsl:call-template name="replace-substring">
|
||||
<xsl:with-param name="from" select="'
'" />
|
||||
<xsl:with-param name="to" select="'&#xA;'" />
|
||||
<xsl:with-param name="value">
|
||||
<xsl:call-template name="replace-substring">
|
||||
<xsl:with-param name="from"
|
||||
select="'"'" />
|
||||
<xsl:with-param name="to"
|
||||
select="'&quot;'" />
|
||||
<xsl:with-param name="value" select="$tmp" />
|
||||
</xsl:call-template>
|
||||
</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$tmp" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<!-- replace in $value substring $from with $to -->
|
||||
<xsl:template name="replace-substring">
|
||||
<xsl:param name="value" />
|
||||
<xsl:param name="from" />
|
||||
<xsl:param name="to" />
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains($value,$from)">
|
||||
<xsl:value-of select="substring-before($value,$from)" />
|
||||
<xsl:value-of select="$to" />
|
||||
<xsl:call-template name="replace-substring">
|
||||
<xsl:with-param name="value"
|
||||
select="substring-after($value,$from)" />
|
||||
<xsl:with-param name="from" select="$from" />
|
||||
<xsl:with-param name="to" select="$to" />
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$value" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<!-- preformatted output: space as , tab as 8
|
||||
nl as <br> -->
|
||||
<xsl:template name="preformatted-output">
|
||||
<xsl:param name="text" />
|
||||
<xsl:call-template name="output-nl">
|
||||
<xsl:with-param name="text">
|
||||
<xsl:call-template name="replace-substring">
|
||||
<xsl:with-param name="value"
|
||||
select="translate($text,' ',' ')" />
|
||||
<xsl:with-param name="from" select="'	'" />
|
||||
<xsl:with-param name="to"
|
||||
select="'        '" />
|
||||
</xsl:call-template>
|
||||
</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
<!-- output nl as <br> -->
|
||||
<xsl:template name="output-nl">
|
||||
<xsl:param name="text" />
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains($text,'
')">
|
||||
<xsl:value-of select="substring-before($text,'
')" />
|
||||
<br />
|
||||
<xsl:text>
</xsl:text>
|
||||
<xsl:call-template name="output-nl">
|
||||
<xsl:with-param name="text"
|
||||
select="substring-after($text,'
')" />
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$text" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
|
@ -0,0 +1,93 @@
|
|||
#bottombar {
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.x-menubar {
|
||||
background-image: none;
|
||||
background-color: #FFF;
|
||||
}
|
||||
|
||||
.x-panel-body-noheader {
|
||||
border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
-webkit-border-radius: 5px;
|
||||
}
|
||||
|
||||
.x-border-layout-ct {
|
||||
background-color: transparent;
|
||||
border-color: transparent;
|
||||
}
|
||||
|
||||
.x-toolbar {
|
||||
border-color: transparent;
|
||||
background-image: none;
|
||||
background-color: #FFF;
|
||||
}
|
||||
|
||||
.x-panel-header {
|
||||
background-image: none;
|
||||
background-color: #FFF;
|
||||
}
|
||||
|
||||
.x-toolbar .xtb-sep {
|
||||
background-image: none !important;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.x-accordion-hd {
|
||||
background-position: 0 0px;
|
||||
}
|
||||
|
||||
.x-status-text,.x-tree3-node-text,.x-status .x-status-text,.x-toolbar label,.x-component,.x-btn button
|
||||
{
|
||||
color: #4c68a6;
|
||||
font-family: "HelveticaNeue-Light", "Helvetica Neue Light",
|
||||
"Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
|
||||
font-weight: 300;
|
||||
font-size: 12px !important;
|
||||
}
|
||||
|
||||
.x-grid-group-hd .x-grid-group-div {
|
||||
color: #4c68a6;
|
||||
font-family: "HelveticaNeue-Light", "Helvetica Neue Light",
|
||||
"Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
|
||||
font-weight: normal;
|
||||
font-size: 12px !important;
|
||||
}
|
||||
|
||||
.x-status-text-panel {
|
||||
border-color: transparent;
|
||||
}
|
||||
|
||||
.x-panel-mc {
|
||||
padding-top: 5px;
|
||||
background: #FFF url(images/bg-pattern.png) repeat;
|
||||
border-color: #226599;
|
||||
-webkit-border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.ext-el-mask-msg {
|
||||
-webkit-border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
border-width: 2px;
|
||||
background-color: #FFF;
|
||||
background-image: none;
|
||||
}
|
||||
|
||||
.ext-el-mask-msg div {
|
||||
color: #4c68a6;
|
||||
font-family: "HelveticaNeue-Light", "Helvetica Neue Light",
|
||||
"Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
|
||||
font-weight: 300;
|
||||
font-size: 12px !important;
|
||||
border-color: transparent;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.loading-indicator {
|
||||
background-position: 5px 50%;
|
||||
background-image: url("images/loader.gif");
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
|
||||
# The user and its credentials
|
||||
# Possible values for credentials:
|
||||
# [USER,ADMIN,DEBUG]
|
||||
USER_CREDENTIALS = DEBUG
|
||||
|
||||
# Defines the modality in which the portlet is running
|
||||
# possible values [STANDALONE,PORTAL,NOTDEFINED]
|
||||
RUNNING_MODE = STANDALONE
|
||||
|
||||
DEFAULT_USER = massimiliano.assante
|
||||
|
||||
# The scope that will be used as default
|
||||
DEFAULT_SCOPE =/d4science.research-infrastructures.eu
|
||||
# the target of update notification (if in singleton mode)
|
||||
# mails MUST be separated by ;
|
||||
USERMAIL_TO = m.assante@gmail.com
|
||||
|
||||
###############################################################################
|
||||
# PROPERTIES FOR AUTOMATIC LOADING of GHN LIST AT STARTUP
|
||||
###############################################################################
|
||||
# Possible values:
|
||||
# [YES,NO]
|
||||
LIST_GHN_STARTUP = YES
|
||||
|
||||
|
||||
###############################################################################
|
||||
# PROPERTIES FOR THE SWEEPER
|
||||
###############################################################################
|
||||
# The max number of minutes from last profile update to consider a GHN alive.
|
||||
# NOT LINKED TO THE SWEEPER ANYMORE
|
||||
LIVE_GHN_MAX_MINUTES = 40
|
||||
|
|
@ -0,0 +1,478 @@
|
|||
/*
|
||||
* Ext GWT Library 2.1.1
|
||||
* Copyright(c) 2006-2009, Ext JS, LLC.
|
||||
* licensing@extjs.com
|
||||
*
|
||||
* http://extjs.com/license
|
||||
*/
|
||||
.x-panel {
|
||||
border-style: solid;
|
||||
border-color: #d0d0d0;
|
||||
}
|
||||
.x-panel-header {
|
||||
color:#333;
|
||||
border:1px solid #d0d0d0;
|
||||
background-image:url(../images/gray/panel/white-top-bottom.gif);
|
||||
}
|
||||
|
||||
.x-panel-body {
|
||||
border-color:#d0d0d0;
|
||||
}
|
||||
|
||||
.x-panel-bbar .x-toolbar {
|
||||
border-color:#d0d0d0;
|
||||
}
|
||||
|
||||
.x-panel-tbar .x-toolbar {
|
||||
border-color:#d0d0d0;
|
||||
}
|
||||
|
||||
.x-panel-tbar-noheader .x-toolbar, .x-panel-mc .x-panel-tbar .x-toolbar {
|
||||
border-color:#d0d0d0;
|
||||
}
|
||||
.x-panel-body-noheader, .x-panel-mc .x-panel-body {
|
||||
border-color:#d0d0d0;
|
||||
}
|
||||
.x-panel-tl .x-panel-header {
|
||||
color:#333;
|
||||
}
|
||||
.x-panel-tc {
|
||||
background-image:url(../images/gray/panel/top-bottom.gif);
|
||||
}
|
||||
.x-panel-tl {
|
||||
background-image:url(../images/gray/panel/corners-sprite.gif);
|
||||
border-color:#d0d0d0;
|
||||
}
|
||||
.x-panel-tr {
|
||||
background-image:url(../images/gray/panel/corners-sprite.gif);
|
||||
}
|
||||
.x-panel-bc {
|
||||
background-image:url(../images/gray/panel/top-bottom.gif);
|
||||
}
|
||||
.x-panel-bl {
|
||||
background-image:url(../images/gray/panel/corners-sprite.gif);
|
||||
}
|
||||
.x-panel-br {
|
||||
background-image:url(../images/gray/panel/corners-sprite.gif);
|
||||
}
|
||||
.x-panel-mc {
|
||||
background:#f1f1f1;
|
||||
}
|
||||
.x-panel-mc .x-panel-body {
|
||||
background:transparent;
|
||||
border: 0 none;
|
||||
}
|
||||
.x-panel-ml {
|
||||
background-image:url(../images/gray/panel/left-right.gif);
|
||||
}
|
||||
.x-panel-mr {
|
||||
background-image:url(../images/gray/panel/left-right.gif);
|
||||
}
|
||||
|
||||
/* Tools */
|
||||
.x-tool {
|
||||
background-image:url(../images/gray/panel/tool-sprites.gif);
|
||||
}
|
||||
|
||||
/* Ghosting */
|
||||
.x-panel-ghost {
|
||||
background:#e0e0e0;
|
||||
}
|
||||
|
||||
.x-panel-ghost ul {
|
||||
border-color:#b0b0b0;
|
||||
}
|
||||
|
||||
.x-grid-panel .x-panel-mc .x-panel-body {
|
||||
border:1px solid #d0d0d0;
|
||||
}
|
||||
|
||||
/* Buttons */
|
||||
|
||||
.x-btn-left{
|
||||
background-image:url(../images/gray/button/btn-sprite.gif);
|
||||
}
|
||||
.x-btn-right{
|
||||
background-image:url(../images/gray/button/btn-sprite.gif);
|
||||
}
|
||||
.x-btn-center{
|
||||
background-image:url(../images/gray/button/btn-sprite.gif);
|
||||
}
|
||||
|
||||
.x-btn-group-header {
|
||||
color: #333333;
|
||||
}
|
||||
.x-btn-group-tc {
|
||||
background-image: url(../images/gray/button/group-tb.gif);
|
||||
}
|
||||
.x-btn-group-tl {
|
||||
background-image: url(../images/gray/button/group-cs.gif);
|
||||
}
|
||||
.x-btn-group-tr {
|
||||
background-image: url(../images/gray/button/group-cs.gif);
|
||||
}
|
||||
.x-btn-group-bc {
|
||||
background-image: url(../images/gray/button/group-tb.gif);
|
||||
}
|
||||
.x-btn-group-bl {
|
||||
background-image: url(../images/gray/button/group-cs.gif);
|
||||
}
|
||||
.x-btn-group-br {
|
||||
background-image: url(../images/gray/button/group-cs.gif);
|
||||
}
|
||||
.x-btn-group-ml {
|
||||
background-image: url(../images/gray/button/group-lr.gif);
|
||||
}
|
||||
.x-btn-group-mr {
|
||||
background-image: url(../images/gray/button/group-lr.gif);
|
||||
}
|
||||
.x-btn-group-notitle .x-btn-group-tc {
|
||||
background-image: url(../images/gray/button/group-tb.gif);
|
||||
}
|
||||
|
||||
/* Layout classes */
|
||||
|
||||
.x-border-layout-ct {
|
||||
background:#f0f0f0;
|
||||
}
|
||||
|
||||
.x-accordion-hd {
|
||||
background-image:url(../images/gray/panel/light-hd.gif);
|
||||
}
|
||||
|
||||
.x-layout-collapsed{
|
||||
background-color:#eee;
|
||||
border-color:#e0e0e0;
|
||||
}
|
||||
.x-layout-collapsed-over{
|
||||
background-color:#fbfbfb;
|
||||
}
|
||||
|
||||
|
||||
/* qtips */
|
||||
.x-tip .x-tip-top {
|
||||
background-image:url(../images/gray/qtip/tip-sprite.gif);
|
||||
}
|
||||
.x-tip .x-tip-top-left {
|
||||
background-image:url(../images/gray/qtip/tip-sprite.gif);
|
||||
}
|
||||
.x-tip .x-tip-top-right {
|
||||
background-image:url(../images/gray/qtip/tip-sprite.gif);
|
||||
}
|
||||
.x-tip .x-tip-ft {
|
||||
background-image:url(../images/gray/qtip/tip-sprite.gif);
|
||||
}
|
||||
.x-tip .x-tip-ft-left {
|
||||
background-image:url(../images/gray/qtip/tip-sprite.gif);
|
||||
}
|
||||
.x-tip .x-tip-ft-right {
|
||||
background-image:url(../images/gray/qtip/tip-sprite.gif);
|
||||
}
|
||||
.x-tip .x-tip-bd-left {
|
||||
background-image:url(../images/gray/qtip/tip-sprite.gif);
|
||||
}
|
||||
.x-tip .x-tip-bd-right {
|
||||
background-image:url(../images/gray/qtip/tip-sprite.gif);
|
||||
}
|
||||
|
||||
/* Toolbars */
|
||||
|
||||
.x-toolbar{
|
||||
border-color:#d0d0d0;
|
||||
background:#f0f4f5 url(../images/gray/toolbar/bg.gif) repeat-x top left;
|
||||
}
|
||||
.x-toolbar button {
|
||||
color:#444;
|
||||
}
|
||||
.x-toolbar .x-btn-menu-arrow-wrap .x-btn-center button {
|
||||
background-image:url(../images/gray/toolbar/btn-arrow.gif);
|
||||
}
|
||||
.x-toolbar .x-btn-text-icon .x-btn-menu-arrow-wrap .x-btn-center button {
|
||||
background-image:url(../images/gray/toolbar/btn-arrow.gif);
|
||||
}
|
||||
.x-toolbar .x-btn-over .x-btn-left{
|
||||
background-image:url(../images/gray/toolbar/tb-btn-sprite.gif);
|
||||
}
|
||||
.x-toolbar .x-btn-over .x-btn-right{
|
||||
background-image:url(../images/gray/toolbar/tb-btn-sprite.gif);
|
||||
}
|
||||
.x-toolbar .x-btn-over .x-btn-center{
|
||||
background-image:url(../images/gray/toolbar/tb-btn-sprite.gif);
|
||||
}
|
||||
.x-toolbar .x-btn-over button {
|
||||
color:#111;
|
||||
}
|
||||
.x-toolbar .x-btn-click .x-btn-left, .x-toolbar .x-btn-pressed .x-btn-left, .x-toolbar .x-btn-menu-active .x-btn-left{
|
||||
background-image:url(../images/gray/toolbar/tb-btn-sprite.gif);
|
||||
}
|
||||
.x-toolbar .x-btn-click .x-btn-right, .x-toolbar .x-btn-pressed .x-btn-right, .x-toolbar .x-btn-menu-active .x-btn-right{
|
||||
background-image:url(../images/gray/toolbar/tb-btn-sprite.gif);
|
||||
}
|
||||
|
||||
.x-toolbar .x-btn-click .x-btn-center, .x-toolbar .x-btn-pressed .x-btn-center, .x-toolbar .x-btn-menu-active .x-btn-center{
|
||||
background-image:url(../images/gray/toolbar/tb-btn-sprite.gif);
|
||||
}
|
||||
.x-toolbar .ytb-sep {
|
||||
background-image: url(../images/default/grid/grid-split.gif);
|
||||
}
|
||||
|
||||
/* Tabs */
|
||||
|
||||
.x-tab-panel-header, .x-tab-panel-footer {
|
||||
background: #EAEAEA;
|
||||
border-color:#d0d0d0;
|
||||
}
|
||||
|
||||
|
||||
.x-tab-panel-header {
|
||||
border-color:#d0d0d0;
|
||||
}
|
||||
|
||||
.x-tab-panel-footer {
|
||||
border-color:#d0d0d0;
|
||||
}
|
||||
|
||||
ul.x-tab-strip-top{
|
||||
background:#dbdbdb url(../images/gray/tabs/tab-strip-bg.gif) repeat-x left top;
|
||||
border-color:#d0d0d0;
|
||||
padding-top: 2px;
|
||||
}
|
||||
|
||||
ul.x-tab-strip-bottom{
|
||||
background-image:url(../images/gray/tabs/tab-strip-btm-bg.gif);
|
||||
border-color:#d0d0d0;
|
||||
}
|
||||
|
||||
.x-tab-strip span.x-tab-strip-text {
|
||||
color:#333;
|
||||
}
|
||||
.x-tab-strip-over span.x-tab-strip-text {
|
||||
color:#111;
|
||||
}
|
||||
|
||||
.x-tab-strip-active span.x-tab-strip-text {
|
||||
color:#333;
|
||||
}
|
||||
|
||||
.x-tab-strip-disabled .x-tabs-text {
|
||||
color:#aaaaaa;
|
||||
}
|
||||
|
||||
.x-tab-strip-top .x-tab-right {
|
||||
background-image:url(../images/gray/tabs/tabs-sprite.gif);
|
||||
}
|
||||
|
||||
.x-tab-strip-top .x-tab-left {
|
||||
background-image:url(../images/gray/tabs/tabs-sprite.gif);
|
||||
}
|
||||
.x-tab-strip-top .x-tab-strip-inner {
|
||||
background-image:url(../images/gray/tabs/tabs-sprite.gif);
|
||||
}
|
||||
|
||||
.x-tab-strip-bottom .x-tab-right {
|
||||
background-image:url(../images/gray/tabs/tab-btm-inactive-right-bg.gif);
|
||||
}
|
||||
|
||||
.x-tab-strip-bottom .x-tab-left {
|
||||
background-image:url(../images/gray/tabs/tab-btm-inactive-left-bg.gif);
|
||||
}
|
||||
|
||||
.x-tab-strip-bottom .x-tab-strip-active .x-tab-right {
|
||||
background-image:url(../images/gray/tabs/tab-btm-right-bg.gif);
|
||||
}
|
||||
|
||||
.x-tab-strip-bottom .x-tab-strip-active .x-tab-left {
|
||||
background-image:url(../images/gray/tabs/tab-btm-left-bg.gif);
|
||||
}
|
||||
|
||||
.x-tab-strip .x-tab-strip-closable a.x-tab-strip-close {
|
||||
background-image:url(../images/gray/tabs/tab-close.gif);
|
||||
}
|
||||
.x-tab-strip .x-tab-strip-closable a.x-tab-strip-close:hover{
|
||||
background-image:url(../images/gray/tabs/tab-close.gif);
|
||||
}
|
||||
|
||||
.x-tab-panel-body {
|
||||
border-color:#d0d0d0;
|
||||
background:#fff;
|
||||
}
|
||||
.x-tab-panel-bbar .x-toolbar {
|
||||
border-color: #d0d0d0;
|
||||
}
|
||||
|
||||
.x-tab-panel-tbar .x-toolbar {
|
||||
border-color: #d0d0d0;
|
||||
}
|
||||
|
||||
.x-tab-panel-header-plain .x-tab-strip-spacer {
|
||||
border-color:#d0d0d0;
|
||||
background: #eaeaea;
|
||||
}
|
||||
|
||||
.x-tab-scroller-left {
|
||||
background-image: url(../images/gray/tabs/scroll-left.gif);
|
||||
border-color:#aeaeae;
|
||||
}
|
||||
.x-tab-scroller-right {
|
||||
background-image: url(../images/gray/tabs/scroll-right.gif);
|
||||
border-color:#aeaeae;
|
||||
}
|
||||
|
||||
/* Window */
|
||||
|
||||
.x-window-proxy {
|
||||
background:#e0e0e0;
|
||||
border-color:#b0b0b0;
|
||||
}
|
||||
|
||||
.x-window-tl .x-window-header {
|
||||
color:#555;
|
||||
}
|
||||
.x-window-tc {
|
||||
background-image:url(../images/gray/window/top-bottom.png);
|
||||
}
|
||||
.x-window-tl {
|
||||
background-image:url(../images/gray/window/left-corners.png);
|
||||
}
|
||||
.x-window-tr {
|
||||
background-image:url(../images/gray/window/right-corners.png);
|
||||
}
|
||||
.x-window-bc {
|
||||
background-image:url(../images/gray/window/top-bottom.png);
|
||||
}
|
||||
.x-window-bl {
|
||||
background-image:url(../images/gray/window/left-corners.png);
|
||||
}
|
||||
.x-window-br {
|
||||
background-image:url(../images/gray/window/right-corners.png);
|
||||
}
|
||||
.x-window-mc {
|
||||
border:1px solid #d0d0d0;
|
||||
background:#e8e8e8;
|
||||
}
|
||||
|
||||
.x-window-ml {
|
||||
background-image:url(../images/gray/window/left-right.png);
|
||||
}
|
||||
.x-window-mr {
|
||||
background-image:url(../images/gray/window/left-right.png);
|
||||
}
|
||||
.x-panel-ghost .x-window-tl {
|
||||
border-color:#d0d0d0;
|
||||
}
|
||||
.x-panel-collapsed .x-window-tl {
|
||||
border-color:#d0d0d0;
|
||||
}
|
||||
|
||||
.x-window-plain .x-window-mc {
|
||||
background: #e8e8e8;
|
||||
border-right:1px solid #eee;
|
||||
border-bottom:1px solid #eee;
|
||||
border-top:1px solid #d0d0d0;
|
||||
border-left:1px solid #d0d0d0;
|
||||
}
|
||||
|
||||
.x-window-plain .x-window-body {
|
||||
border-left:1px solid #eee;
|
||||
border-top:1px solid #eee;
|
||||
border-bottom:1px solid #d0d0d0;
|
||||
border-right:1px solid #d0d0d0;
|
||||
background:transparent !important;
|
||||
}
|
||||
|
||||
body.x-body-masked .x-window-mc, body.x-body-masked .x-window-plain .x-window-mc {
|
||||
background-color: #e4e4e4;
|
||||
}
|
||||
|
||||
|
||||
/* misc */
|
||||
.x-html-editor-wrap {
|
||||
border-color:#d0d0d0;
|
||||
}
|
||||
|
||||
/* Borders go last for specificity */
|
||||
.x-panel-noborder .x-panel-body-noborder {
|
||||
border-width:0;
|
||||
}
|
||||
|
||||
.x-panel-noborder .x-panel-header-noborder {
|
||||
border-width:0;
|
||||
border-bottom:1px solid #d0d0d0;
|
||||
}
|
||||
|
||||
.x-panel-noborder .x-panel-tbar-noborder .x-toolbar {
|
||||
border-width:0;
|
||||
border-bottom:1px solid #d0d0d0;
|
||||
}
|
||||
|
||||
.x-panel-noborder .x-panel-bbar-noborder .x-toolbar {
|
||||
border-width:0;
|
||||
border-top:1px solid #d0d0d0;
|
||||
}
|
||||
|
||||
.x-window-noborder .x-window-mc {
|
||||
border-width:0;
|
||||
}
|
||||
.x-window-plain .x-window-body-noborder {
|
||||
border-width:0;
|
||||
}
|
||||
|
||||
.x-tab-panel-noborder .x-tab-panel-body-noborder {
|
||||
border-width:0;
|
||||
}
|
||||
|
||||
.x-tab-panel-noborder .x-tab-panel-header-noborder {
|
||||
border-top-width:0;
|
||||
border-left-width:0;
|
||||
border-right-width:0;
|
||||
}
|
||||
|
||||
.x-tab-panel-noborder .x-tab-panel-footer-noborder {
|
||||
border-bottom-width:0;
|
||||
border-left-width:0;
|
||||
border-right-width:0;
|
||||
}
|
||||
|
||||
|
||||
.x-tab-panel-bbar-noborder .x-toolbar {
|
||||
border-width:0;
|
||||
border-top:1px solid #d0d0d0;
|
||||
}
|
||||
|
||||
.x-tab-panel-tbar-noborder .x-toolbar {
|
||||
border-width:0;
|
||||
border-bottom:1px solid #d0d0d0;
|
||||
}.x-accordion-hd {
|
||||
background-color: #e5e5e5;
|
||||
}.x-border {
|
||||
border: 1px solid #D0D0D0;
|
||||
}
|
||||
|
||||
.x-layout-popup {
|
||||
background-color: #F0F0F0;
|
||||
border: 1px solid #D0D0D0;
|
||||
}
|
||||
|
||||
.my-list {
|
||||
border: 1px solid #D0D0D0;
|
||||
}
|
||||
|
||||
.x-view {
|
||||
border:1px solid #D0D0D0;
|
||||
}.my-info {
|
||||
background: url(../images/gray/info/info-bg.gif) no-repeat;
|
||||
}.x-date-right-icon {
|
||||
background-image: url(../images/default/shared/right-btn.gif);
|
||||
margin-right: 2px;
|
||||
text-decoration: none !important;
|
||||
}
|
||||
|
||||
.x-date-left-icon {
|
||||
background-image: url(../images/default/shared/left-btn.gif);
|
||||
margin-right: 2px;
|
||||
text-decoration: none !important;
|
||||
}.my-tbl {
|
||||
border: 1px solid #C6C5C5;
|
||||
}.my-treetbl {
|
||||
border: 1px solid #C6C5C5;
|
||||
}
|
|
@ -0,0 +1,638 @@
|
|||
/*
|
||||
* Ext JS Library 2.1
|
||||
* Copyright(c) 2006-2008, Ext JS, LLC.
|
||||
* licensing@extjs.com
|
||||
*
|
||||
* http://extjs.com/license
|
||||
*/
|
||||
html,body {
|
||||
background: #3d71b8 url(../wallpapers/desktop.jpg) no-repeat left top;
|
||||
font: normal 12px tahoma, arial, verdana, sans-serif;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0 none;
|
||||
overflow: hidden;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.start {
|
||||
background-image: url( ../images/taskbar/black/startbutton-icon.gif ) !important;
|
||||
}
|
||||
|
||||
.bogus {
|
||||
background-image: url( ../images/bogus.png ) !important;
|
||||
}
|
||||
|
||||
.logout {
|
||||
background-image: url( ../images/logout.gif ) !important;
|
||||
}
|
||||
|
||||
.settings {
|
||||
background-image: url( ../images/gears.gif ) !important;
|
||||
}
|
||||
|
||||
#dpanels {
|
||||
width: 250px;
|
||||
float: right;
|
||||
}
|
||||
|
||||
#dpanels .x-panel {
|
||||
margin: 15px;
|
||||
}
|
||||
|
||||
#dpanels .x-date-picker {
|
||||
border: 0 none;
|
||||
border-top: 0 none;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
#dpanels .x-date-picker td.x-date-active {
|
||||
background: #ffffff;
|
||||
}
|
||||
|
||||
#dpanels .x-date-picker {
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
#x-desktop {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border: 0 none;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
zoom: 1;
|
||||
}
|
||||
|
||||
#ux-taskbar .x-btn {
|
||||
float: left;
|
||||
margin: 1px 0 0 1px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#ux-taskbar-start .x-btn {
|
||||
float: left;
|
||||
margin: 0;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#ux-taskbar button { /* width: 150px;
|
||||
overflow: hidden; */
|
||||
text-align: left;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
#title-bar-wrapper {
|
||||
height: 35px;
|
||||
}
|
||||
|
||||
#title-bar {
|
||||
color: #225599;
|
||||
padding: 9px 7px;
|
||||
font: bold 16px tahoma, arial, verdana, sans-serif;
|
||||
float: left;
|
||||
}
|
||||
|
||||
#x-logout {
|
||||
float: right;
|
||||
padding: 6px 7px;
|
||||
}
|
||||
|
||||
.x-btn-text-icon .x-btn-center .logout {
|
||||
background-position: 0pt 3px;
|
||||
background-repeat: no-repeat;
|
||||
padding: 3px 0pt 3px 18px;
|
||||
}
|
||||
|
||||
#ux-taskbar {
|
||||
background: transparent none;
|
||||
height: 30px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
position: relative;
|
||||
z-index: 12001;
|
||||
}
|
||||
|
||||
.x-btn-icon .ux-taskbutton-center .x-btn-text {
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
cursor: pointer;
|
||||
white-space: nowrap;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.x-btn-icon .ux-taskbutton-center {
|
||||
padding: 1px;
|
||||
}
|
||||
|
||||
.ux-startbutton-center .x-btn-text {
|
||||
color: #000000 !important;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.ux-taskbutton-left,.ux-taskbutton-right {
|
||||
font-size: 1px;
|
||||
line-height: 1px;
|
||||
}
|
||||
|
||||
.ux-taskbutton-left {
|
||||
width: 4px;
|
||||
height: 28px;
|
||||
background: url( ../images/taskbar/black/taskbutton.gif ) no-repeat 0 0;
|
||||
}
|
||||
|
||||
.ux-taskbutton-right {
|
||||
width: 4px;
|
||||
height: 28px;
|
||||
background: url( ../images/taskbar/black/taskbutton.gif ) no-repeat 0 -28px;
|
||||
}
|
||||
|
||||
.ux-taskbutton-left i,.ux-taskbutton-right i {
|
||||
display: block;
|
||||
width: 4px;
|
||||
overflow: hidden;
|
||||
font-size: 1px;
|
||||
line-height: 1px;
|
||||
}
|
||||
|
||||
.ux-taskbutton-center {
|
||||
background: url( ../images/taskbar/black/taskbutton.gif ) repeat-x 0 -56px;
|
||||
vertical-align: middle;
|
||||
text-align: center;
|
||||
padding: 0 5px;
|
||||
cursor: pointer;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
#ux-taskbar .ux-taskbutton-left {
|
||||
background-position: 0 0;
|
||||
}
|
||||
|
||||
#ux-taskbar .ux-taskbutton-right {
|
||||
background-position: 0 -28px;
|
||||
}
|
||||
|
||||
#ux-taskbar .ux-taskbutton-center {
|
||||
background-position: 0 -56px;
|
||||
}
|
||||
|
||||
#ux-taskbar .x-btn-over .ux-taskbutton-left {
|
||||
background-position: 0 -252px;
|
||||
}
|
||||
|
||||
#ux-taskbar .x-btn-over .ux-taskbutton-right {
|
||||
background-position: 0 -280px;
|
||||
}
|
||||
|
||||
#ux-taskbar .x-btn-over .ux-taskbutton-center {
|
||||
background-position: 0 -308px;
|
||||
}
|
||||
|
||||
#ux-taskbar .x-btn-click .ux-taskbutton-left {
|
||||
background-position: 0 -168px;
|
||||
}
|
||||
|
||||
#ux-taskbar .x-btn-click .ux-taskbutton-right {
|
||||
background-position: 0 -196px;
|
||||
}
|
||||
|
||||
#ux-taskbar .x-btn-click .ux-taskbutton-center {
|
||||
background-position: 0 -224px;
|
||||
}
|
||||
|
||||
#ux-taskbar .active-win .ux-taskbutton-left {
|
||||
background-position: 0 -84px;
|
||||
}
|
||||
|
||||
#ux-taskbar .active-win .ux-taskbutton-right {
|
||||
background: url( ../images/taskbar/black/taskbutton.gif ) no-repeat 0 -112px;
|
||||
}
|
||||
|
||||
#ux-taskbar .active-win .ux-taskbutton-center {
|
||||
background: url( ../images/taskbar/black/taskbutton.gif ) repeat-x 0 -140px;
|
||||
}
|
||||
|
||||
#ux-taskbar .active-win .ux-taskbutton-center button {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
#spacer {
|
||||
height: 25px;
|
||||
float: left;
|
||||
width: 0;
|
||||
overflow: hidden;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.x-window-body p,.x-panel-body p {
|
||||
padding: 10px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.x-window-maximized .x-window-bc {
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.add {
|
||||
background-image: url(../../shared/icons/fam/add.gif) !important;
|
||||
}
|
||||
|
||||
.option {
|
||||
background-image: url(../../shared/icons/fam/plugin.gif) !important;
|
||||
}
|
||||
|
||||
.remove {
|
||||
background-image: url(../../shared/icons/fam/delete.gif) !important;
|
||||
}
|
||||
|
||||
.tabs {
|
||||
background-image: url(../images/tabs.gif) !important;
|
||||
}
|
||||
|
||||
.ux-start-menu {
|
||||
background: transparent none;
|
||||
border: 0px none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.ux-start-menu-tl .x-window-header {
|
||||
color: #f1f1f1;
|
||||
font: bold 11px tahoma, arial, verdana, sans-serif;
|
||||
padding: 5px 0 4px 0;
|
||||
}
|
||||
|
||||
.x-panel-tl .x-panel-icon,.ux-start-menu-tl .x-panel-icon {
|
||||
background-position: 0pt 4px;
|
||||
background-repeat: no-repeat;
|
||||
padding-left: 20px !important;
|
||||
}
|
||||
|
||||
.ux-start-menu-tl {
|
||||
background: transparent url( ../images/taskbar/black/start-menu-left-corners.png ) no-repeat 0 0;
|
||||
padding-left: 6px;
|
||||
zoom: 1;
|
||||
z-index: 1;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.ux-start-menu-tr {
|
||||
background: transparent url( ../images/taskbar/black/start-menu-right-corners.png ) no-repeat right
|
||||
0;
|
||||
padding-right: 6px;
|
||||
}
|
||||
|
||||
.ux-start-menu-tc {
|
||||
background: transparent url( ../images/taskbar/black/start-menu-top-bottom.png ) repeat-x 0 0;
|
||||
overflow: hidden;
|
||||
zoom: 1;
|
||||
}
|
||||
|
||||
.ux-start-menu-ml {
|
||||
background: transparent url( ../images/taskbar/black/start-menu-left-right.png ) repeat-y 0 0;
|
||||
padding-left: 6px;
|
||||
zoom: 1;
|
||||
}
|
||||
|
||||
.ux-start-menu-bc {
|
||||
background: transparent url( ../images/taskbar/black/start-menu-top-bottom.png ) repeat-x 0 bottom;
|
||||
zoom: 1;
|
||||
}
|
||||
|
||||
.ux-start-menu-bc .x-window-footer {
|
||||
padding-bottom: 6px;
|
||||
zoom: 1;
|
||||
font-size: 0;
|
||||
line-height: 0;
|
||||
}
|
||||
|
||||
.ux-start-menu-bl {
|
||||
background: transparent url( ../images/taskbar/black/start-menu-left-corners.png ) no-repeat 0
|
||||
bottom;
|
||||
padding-left: 6px;
|
||||
zoom: 1;
|
||||
}
|
||||
|
||||
.ux-start-menu-br {
|
||||
background: transparent url( ../images/taskbar/black/start-menu-right-corners.png ) no-repeat right
|
||||
bottom;
|
||||
padding-right: 6px;
|
||||
zoom: 1;
|
||||
}
|
||||
|
||||
.x-panel-nofooter .ux-start-menu-bc {
|
||||
height: 6px;
|
||||
}
|
||||
|
||||
.ux-start-menu-splitbar-h {
|
||||
background-color: #d0d0d0;
|
||||
}
|
||||
|
||||
.ux-start-menu-bwrap {
|
||||
background: transparent none;
|
||||
border: 0px none;
|
||||
}
|
||||
|
||||
.ux-start-menu-body {
|
||||
background: transparent none;
|
||||
border: 0px none;
|
||||
}
|
||||
|
||||
.ux-start-menu-apps-panel {
|
||||
background: #ffffff none;
|
||||
border: 1px solid #1e2124;
|
||||
}
|
||||
|
||||
.ux-start-menu-tools-panel {
|
||||
border: 0px none;
|
||||
background: transparent url( ../images/taskbar/black/start-menu-right.png ) repeat-y scroll right
|
||||
0pt;
|
||||
}
|
||||
|
||||
#ux-taskbar-start {
|
||||
background: #000000 url( ../images/taskbar/black/taskbar-start-panel-bg.gif ) repeat-x left top;
|
||||
left: 0px;
|
||||
padding: 0;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
#ux-taskbar-start .x-toolbar {
|
||||
background: none;
|
||||
padding: 0px;
|
||||
border: 0px none;
|
||||
}
|
||||
|
||||
#ux-taskbuttons-panel {
|
||||
background: #000000 url( ../images/taskbar/black/taskbuttons-panel-bg.gif ) repeat-x left top;
|
||||
padding-top: 0;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.ux-taskbuttons-strip-wrap { /* overflow:hidden;
|
||||
position:relative;
|
||||
width:100%; */
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
zoom: 1;
|
||||
}
|
||||
|
||||
ul.ux-taskbuttons-strip {
|
||||
display: block;
|
||||
width: 5000px;
|
||||
zoom: 1;
|
||||
}
|
||||
|
||||
ul.ux-taskbuttons-strip li {
|
||||
float: left;
|
||||
margin-left: 2px;
|
||||
}
|
||||
|
||||
ul.ux-taskbuttons-strip li.ux-taskbuttons-edge {
|
||||
float: left;
|
||||
margin: 0 !important;
|
||||
padding: 0 !important;
|
||||
border: 0 none !important;
|
||||
font-size: 1px !important;
|
||||
line-height: 1px !important;
|
||||
overflow: hidden;
|
||||
zoom: 1;
|
||||
background: transparent !important;
|
||||
width: 1px;
|
||||
}
|
||||
|
||||
.x-clear {
|
||||
clear: both;
|
||||
height: 0;
|
||||
overflow: hidden;
|
||||
line-height: 0;
|
||||
font-size: 0;
|
||||
}
|
||||
|
||||
.x-taskbuttons-scrolling {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.x-taskbuttons-scrolling .ux-taskbuttons-strip-wrap {
|
||||
margin-left: 18px;
|
||||
margin-right: 18px;
|
||||
}
|
||||
|
||||
td.ux-taskButtons-edge { /*float:left;*/
|
||||
margin: 0 !important;
|
||||
padding: 0 !important;
|
||||
border: 0 none !important;
|
||||
font-size: 1px !important;
|
||||
line-height: 1px !important;
|
||||
overflow: hidden;
|
||||
zoom: 1;
|
||||
background: transparent !important;
|
||||
width: 1px;
|
||||
}
|
||||
|
||||
.ux-taskbuttons-scroller-left {
|
||||
background: transparent url( ../images/taskbar/black/scroll-left.gif ) no-repeat -18px 0;
|
||||
width: 18px;
|
||||
position: absolute;
|
||||
left: 1px;
|
||||
top: 0px;
|
||||
z-index: 10;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.ux-taskbuttons-scroller-left-over {
|
||||
background-position: 0 0;
|
||||
}
|
||||
|
||||
.ux-taskbuttons-scroller-left-disabled {
|
||||
background-position: -18px 0;
|
||||
opacity: .5;
|
||||
-moz-opacity: .5;
|
||||
filter: alpha(opacity = 50);
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.ux-taskbuttons-scroller-right {
|
||||
background: transparent url( ../images/taskbar/black/scroll-right.gif ) no-repeat 0 0;
|
||||
width: 18px;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0px;
|
||||
z-index: 10;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.ux-taskbuttons-scroller-right-over {
|
||||
background-position: -18px 0;
|
||||
}
|
||||
|
||||
.ux-taskbuttons-scroller-right-disabled {
|
||||
background-position: 0 0;
|
||||
opacity: .5;
|
||||
-moz-opacity: .5;
|
||||
filter: alpha(opacity = 50);
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.ux-toolmenu-sep {
|
||||
background-color: #18191a;
|
||||
border-bottom: 1px solid #858789;
|
||||
display: block;
|
||||
font-size: 1px;
|
||||
line-height: 1px;
|
||||
margin: 2px 3px;
|
||||
}
|
||||
|
||||
.ux-start-menu-tools-panel ul.x-menu-list li.x-menu-list-item a.x-menu-item {
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.ux-start-menu-tools-panel ul.x-menu-list li.x-menu-list-item .x-menu-item-active a.x-menu-item {
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
.ux-start-menu-tools-panel .x-menu-item-active {
|
||||
background: #525456 url( ../images/taskbar/black/item-over.gif ) repeat-x left bottom;
|
||||
border: 1px solid #000000;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#ux-taskbar .x-splitbar-h {
|
||||
background: #000000 url( ../images/taskbar/black/taskbar-split-h.gif ) no-repeat 0 0;
|
||||
width: 8px;
|
||||
}
|
||||
|
||||
.x-window-header-text {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
/*
|
||||
* Begin Start button
|
||||
*/
|
||||
.ux-startbutton-left,.ux-startbutton-right {
|
||||
font-size: 1px;
|
||||
line-height: 1px;
|
||||
}
|
||||
|
||||
.ux-startbutton-left {
|
||||
width: 10px;
|
||||
height: 28px;
|
||||
background: url( ../images/taskbar/black/startbutton.gif ) no-repeat 0 0;
|
||||
}
|
||||
|
||||
.ux-startbutton-right {
|
||||
width: 10px;
|
||||
height: 30px;
|
||||
background: url( ../images/taskbar/black/startbutton.gif ) no-repeat 0 -28px;
|
||||
}
|
||||
|
||||
.ux-startbutton-left i,.ux-startbutton-right i {
|
||||
display: block;
|
||||
width: 10px;
|
||||
overflow: hidden;
|
||||
font-size: 1px;
|
||||
line-height: 1px;
|
||||
}
|
||||
|
||||
.ux-startbutton-center {
|
||||
background: url( ../images/taskbar/black/startbutton.gif ) repeat-x 0 -56px;
|
||||
vertical-align: middle;
|
||||
text-align: center;
|
||||
padding: 0;
|
||||
cursor: pointer;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
#ux-taskbar .ux-startbutton-left {
|
||||
background-position: 0 0;
|
||||
}
|
||||
|
||||
#ux-taskbar .ux-startbutton-right {
|
||||
background-position: 0 -30px;
|
||||
}
|
||||
|
||||
#ux-taskbar .ux-startbutton-center {
|
||||
background-position: 0 -60px;
|
||||
}
|
||||
|
||||
#ux-taskbar .x-btn-over .ux-startbutton-left {
|
||||
background-position: 0 -270px;
|
||||
}
|
||||
|
||||
#ux-taskbar .x-btn-over .ux-startbutton-right {
|
||||
background-position: 0 -300px;
|
||||
}
|
||||
|
||||
#ux-taskbar .x-btn-over .ux-startbutton-center {
|
||||
background-position: 0 -330px;
|
||||
}
|
||||
|
||||
#ux-taskbar .x-btn-click .ux-startbutton-left {
|
||||
background-position: 0 -180px;
|
||||
}
|
||||
|
||||
#ux-taskbar .x-btn-click .ux-startbutton-right {
|
||||
background-position: 0 -210px;
|
||||
}
|
||||
|
||||
#ux-taskbar .x-btn-click .ux-startbutton-center {
|
||||
background-position: 0 -240px;
|
||||
}
|
||||
|
||||
#ux-taskbar .active-win .ux-startbutton-left {
|
||||
background-position: 0 -90px;
|
||||
}
|
||||
|
||||
#ux-taskbar .active-win .ux-startbutton-right {
|
||||
background: url( ../images/taskbar/black/startbutton.gif ) no-repeat 0 -120px;
|
||||
}
|
||||
|
||||
#ux-taskbar .active-win .ux-startbutton-center {
|
||||
background: url( ../images/taskbar/black/startbutton.gif ) repeat-x 0 -150px;
|
||||
}
|
||||
|
||||
#ux-taskbar .active-win .ux-startbutton-center button {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
/*
|
||||
* End Start button
|
||||
*/
|
||||
.x-resizable-proxy {
|
||||
background: #C7DFFC;
|
||||
opacity: .5;
|
||||
-moz-opacity: .5;
|
||||
filter: alpha(opacity = 50);
|
||||
border: 1px solid #3b5a82;
|
||||
}
|
||||
|
||||
/* Desktop Shortcuts */
|
||||
#x-shortcuts dt {
|
||||
float: left;
|
||||
margin: 15px 0 0 15px;
|
||||
clear: left;
|
||||
width: 64px;
|
||||
font: normal 10px tahoma, arial, verdana, sans-serif;
|
||||
text-align: center;
|
||||
zoom: 1;
|
||||
display: block;
|
||||
}
|
||||
|
||||
#x-shortcuts dt a {
|
||||
width: 64px;
|
||||
display: block;
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#x-shortcuts dt div {
|
||||
width: 100%;
|
||||
color: white;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#x-shortcuts dt a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
After Width: | Height: | Size: 62 KiB |
After Width: | Height: | Size: 155 KiB |
After Width: | Height: | Size: 996 B |
After Width: | Height: | Size: 967 B |
After Width: | Height: | Size: 513 B |
After Width: | Height: | Size: 842 B |
After Width: | Height: | Size: 992 B |
After Width: | Height: | Size: 808 B |
After Width: | Height: | Size: 400 B |
After Width: | Height: | Size: 191 B |
After Width: | Height: | Size: 944 B |