This commit is contained in:
Massimiliano Assante 2013-02-27 18:33:07 +00:00
parent 9b37a3da32
commit ce10cc2bdf
645 changed files with 20675 additions and 0 deletions

35
.classpath Normal file
View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/resource-management-4.0.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry including="**/*.java" kind="src" output="src/main/webapp/WEB-INF/classes" path="src/main/resources"/>
<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 including="**/*.java" kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
<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="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<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="output" path="target/resource-management-4.0.0-SNAPSHOT/WEB-INF/classes"/>
</classpath>

59
.project Normal file
View File

@ -0,0 +1,59 @@
<?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>
</natures>
</projectDescription>

15
.settings/.jsdtscope Normal file
View File

@ -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>

View File

@ -0,0 +1,3 @@
#Thu Jun 16 10:18:26 CEST 2011
eclipse.preferences.version=1
filesCopiedToWebInfLib=

View File

@ -0,0 +1,6 @@
#Wed Feb 27 16:43:28 CET 2013
eclipse.preferences.version=1
jarsExcludedFromWebInfLib=
lastWarOutDir=/Users/massi/Documents/workspace/resource-management/target/resource-management-4.0.0-SNAPSHOT
warSrcDir=src/main/webapp
warSrcDirIsOutput=false

View File

@ -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+

View File

@ -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

View File

@ -0,0 +1,9 @@
#Wed Feb 27 16:47:37 CET 2013
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.6

View File

@ -0,0 +1,5 @@
#Wed Feb 27 16:43:28 CET 2013
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="${module}">
<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"/>
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>
<property name="context-root" value="resource-management"/>
</wb-module>
</project-modules>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<fixed facet="wst.jsdt.web"/>
<installed facet="wst.jsdt.web" version="1.0"/>
<installed facet="java" version="1.6"/>
<installed facet="jst.web" version="2.5"/>
</faceted-project>

View File

@ -0,0 +1 @@
org.eclipse.wst.jsdt.launching.baseBrowserLibrary

View File

@ -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

View File

@ -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>

View File

@ -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>

1
distro/INSTALL Normal file
View File

@ -0,0 +1 @@
Use the respective war file of this component

7
distro/LICENSE Normal file
View File

@ -0,0 +1,7 @@
gCube System - License
------------------------------------------------------------
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.

5
distro/MAINTAINERS Normal file
View File

@ -0,0 +1,5 @@
Mantainers
-------
* Massimiliano Assante (massimiliano.assante@isti.cnr.it), CNR Pisa,
Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo".

51
distro/README Normal file
View File

@ -0,0 +1,51 @@
The gCube System - Portlets - Resource Management Portlet
------------------------------------------------------------
This work has been partially supported by the following European projects:
DILIGENT (FP6-2003-IST-2), D4Science (FP7-INFRA-2007-1.2.2), D4Science-II (FP7-INFRA-2008-1.2.2),
iMarine (FP7-INFRASTRUCTURES-2011-2), and EUBrazilOpenBio (FP7-ICT-2011-EU-Brazil).
Authors
-------
* Massimiliano Assante (massimiliano.assante@isti.cnr.it), CNR Pisa, Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo"
* Daniele Strollo
Version and Release Date
------------------------
v. 2.1.0, September 21st 2012
Description
-----------
EXT-GWT based portlet application to manage resources and their related operations
Download information
--------------------
Source code is available from SVN:
https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/admin/ResourceManagementPortlet
Binaries can be downloaded from:
http://software.d4science.research-infrastructures.eu/
Documentation
-------------
Documentation is available on-line from the Projects Documentation Wiki:
https://gcube.wiki.gcube-system.org/gcube/index.php/Developer%27s_Guide
Licensing
---------
This software is licensed under the terms you may find in the file named "LICENSE" in this directory.
On OSX
---------
If having troubles with xerces:
javax.xml.parsers.FactoryConfigurationError: Provider org.apache.xerces.jaxp.DocumentBuilderFactoryImpl not found
With jdk1.5 use sax.jar provided in the lib dir in behalf of $GLOBUS_LOCATION/lib/xercesImpl.jar
and xml-apis.jar.

90
distro/changelog.xml Normal file
View File

@ -0,0 +1,90 @@
<ReleaseNotes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="xsd/changelog.xsd">
<Changeset
component="org.gcube.portlets-admin.resource-management-portlet-servicearchive.4-0-0"
date="2013-02-27">
<Change>Mavenized</Change>
</Changeset>
<Changeset
component="org.gcube.portlets-admin.resource-management-portlet-servicearchive.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-servicearchive.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-servicearchive.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-servicearchive.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-servicearchive.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-servicearchive.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-servicearchive.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-servicearchive.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-servicearchive.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-servicearchive.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-servicearchive.1-9-0"
date="2011-12-14">
<Change>Added support for runtime resources</Change>
</Changeset>
<Changeset
component="org.gcube.portlets-admin.resource-management-portlet-servicearchive.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>

48
distro/descriptor.xml Normal file
View File

@ -0,0 +1,48 @@
<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>INSTALL</include>
<include>MAINTAINERS</include>
<include>changelog.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>
<file>
<source>${distroDirectory}/svnpath.txt</source>
<outputDirectory>/${artifactId}</outputDirectory>
<filtered>true</filtered>
</file>
</files>
</assembly>

25
distro/profile.xml Normal file
View File

@ -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>

1
distro/svnpath.txt Normal file
View File

@ -0,0 +1 @@
${scm.url}

338
pom.xml Normal file
View File

@ -0,0 +1,338 @@
<?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>4.0.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>gCube Resource Management Portlet</name>
<description>
Cube 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.4.0</gwtVersion>
<guice.version>3.0</guice.version>
<distroDirectory>distro</distroDirectory>
<!-- GWT needs at least java 1.6 -->
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
<!-- This dependency is needed and is need on TOP to use GWT UI BInder
without old Xerces version of gCore complaining -->
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.9.1</version>
<scope>provided</scope>
</dependency>
<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>com.sencha.gxt</groupId>
<artifactId>gxt</artifactId>
<version>2.2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.applicationsupportlayer</groupId>
<artifactId>aslcore</artifactId>
<version>[3.2.0-SNAPSHOT, 4.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>home-library</artifactId>
<version>[4.3.0-SNAPSHOT, 5.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>home-library-jcr</artifactId>
<version>[1.3.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.applicationsupportlayer</groupId>
<artifactId>accesslogger</artifactId>
<version>[1.2.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>gcube-widgets</artifactId>
<version>[1.4.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>guided-tour-widget</artifactId>
<version>[1.2.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.portal</groupId>
<artifactId>custom-portal-handler</artifactId>
<version>[1.2.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>gcf</artifactId>
<version>[1.4.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.resourcemanagement</groupId>
<artifactId>resource-manager-stubs</artifactId>
<version>[2.0.1-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.resourcemanagement</groupId>
<artifactId>ghnmanager-stubs</artifactId>
<version>[1.5.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.portlets.admin</groupId>
<artifactId>rmp-common-library</artifactId>
<version>[1.1.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>org.gcube.portlets.admin</groupId>
<artifactId>ishealth-monitor-widget</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>org.gcube.portlets.admin</groupId>
<artifactId>resource-sweeper-widget</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>org.gcube.portlets.admin</groupId>
<artifactId>software-upload-wizard</artifactId>
<version>[1.1.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>com.allen-sauer.gwt.log</groupId>
<artifactId>gwt-log</artifactId>
<version>3.1.7</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>javax.mail-api</artifactId>
<version>1.4.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.liferay.portal</groupId>
<artifactId>portal-service</artifactId>
<version>6.0.6</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.4</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.4</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>javax.portlet</groupId>
<artifactId>portlet-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
<!-- Apache commons -->
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.4.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
<classifier>sources</classifier>
<scope>test</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>2.4.0</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>
<runTarget>Messages.html</runTarget>
<hostedWebapp>${webappDirectory}</hostedWebapp>
</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.6</source>
<target>1.6</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>

View File

@ -0,0 +1,720 @@
/****************************************************************************
* 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.ActivationRecordVMForm;
import org.gcube.portlets.admin.resourcemanagement.client.forms.genericresources.DeployVirtualCollection;
import org.gcube.portlets.admin.resourcemanagement.client.forms.genericresources.GenericResourceCMForm;
import org.gcube.portlets.admin.resourcemanagement.client.forms.genericresources.GenericResourceTreeManagerForm;
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.resourcemanagement.shared.Configuration;
import org.gcube.portlets.admin.resourcemanagement.shared.utils.DelayedOperation;
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.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 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 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(53, "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, "ResourceNavigation", LayoutRegion.WEST) {
@Override
public void init() {
ConsoleMessageBroker.log(this, "Initializing west panel");
this.setCollapsible(true);
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("Applying super user mode", UIIdentifiers.MAIN_CONTAINER_VIEWPORT_ID);
if (pwd != null && pwd.equals(Configuration.SUPER_USER_CODE)) {
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);
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 activation record from plugins
MenuItem createARTM = new MenuItem("Activation Record for Tree Manager") {
protected void onClick(final ComponentEvent be) {
super.onClick(be);
if (SupportedOperations.GENERIC_RESOURCE_CREATE.isAllowed(StatusHandler.getStatus().getCredentials())) {
new GenericResourceTreeManagerForm().show();
} else {
MessageBox.alert("Activation Record for TM", "You are not allowed to execute this operation", null);
}
};
};
createARTM.setIconStyle("pluginTM-icon");
createMnu.add(createARTM);
// Create activation record from plugins
MenuItem createACM = new MenuItem("Activation Record for Content Manager") {
protected void onClick(final ComponentEvent be) {
super.onClick(be);
if (SupportedOperations.GENERIC_RESOURCE_CREATE.isAllowed(StatusHandler.getStatus().getCredentials())) {
new GenericResourceCMForm().show();
} else {
MessageBox.alert("Activation Record for CM", "You are not allowed to execute this operation", null);
}
};
};
createACM.setIconStyle("pluginCM-icon");
createMnu.add(createACM);
// Create activation record from VM
MenuItem createVM = new MenuItem("Activation Record for View Manager") {
protected void onClick(final ComponentEvent be) {
super.onClick(be);
if (SupportedOperations.GENERIC_RESOURCE_CREATE.isAllowed(StatusHandler.getStatus().getCredentials())) {
//MessageBox.alert("Activation Record for VM", "Operation not implemented yet.", null);
new ActivationRecordVMForm().show();
} else {
MessageBox.alert("Activation Record for VM", "You are not allowed to execute this operation", null);
}
};
};
createVM.setIconStyle("pluginVM-icon");
createMnu.add(createVM);
// 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>Bugs</b> can be submitted <a href=\"https://support.d4science.research-infrastructures.eu/\">here</a>.</p>" +
"<p><b>Notice:</b> specify this Component: <br/><i>portlets/admin/ResourceManagementPortlet</i></p>" +
"<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("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"));
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:&nbsp;&nbsp;"));
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("&nbsp;&nbsp;Loaded Resources:&nbsp;&nbsp;"));
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);
}
}

View File

@ -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);
}
}

View File

@ -0,0 +1,420 @@
/****************************************************************************
= * 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: ActivationRecordVMForm.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.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.utils.OpCommands;
import org.gcube.resourcemanagement.support.client.utils.StatusHandler;
import org.gcube.resourcemanagement.support.client.views.ResourceTypeDecorator;
import org.gcube.resourcemanagement.support.client.views.validators.SelectValidator;
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.Style.HorizontalAlignment;
import com.extjs.gxt.ui.client.Style.Scroll;
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.HorizontalPanel;
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.ComboBox;
import com.extjs.gxt.ui.client.widget.form.Field;
import com.extjs.gxt.ui.client.widget.form.FieldSet;
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.form.ComboBox.TriggerAction;
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.FormLayout;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.rpc.AsyncCallback;
enum StaticFields {
VIEW_NAME("name", "e.g.: the name of the property", "e.g.: put here the name"),
METADATA_NAME("schemaName", "e.g.: metadata prefix", "e.g.: FARM_dc"),
METADATA_LANG("language", "e.g.: metadata language", "e.g.: en"),
METADATA_SCHEMA("schemaURI", "e.g.: metadata schema", "e.g.: http://193.43.36.238:8282/fi/figis/devcon/schema/dc/qualifieddc.xsd"),
IS_EDITABLE("isEditable", "e.g.: editable", "e.g.: true"),
IS_INDEXABLE("isIndexable", "e.g.: indexable", "e.g.: true"),
IS_USER_COLLECTION("isUserCollection", "e.g.: user collection", "e.g.: true");
private String name = null;
private String description = null;
private String value = null;
private StaticFields(final String name, final String description, final String value) {
this.name = name;
this.description = description;
this.value = value;
}
public String getName() {
return name;
}
public String getDescription() {
return description;
}
public String getValue() {
return value;
}
}
public class ActivationRecordVMForm extends Dialog {
private FormData formData = null;
private FormPanel form = null;
public ActivationRecordVMForm() {
this.setLayout(new FitLayout());
this.setHeading("Activation Record for VM");
this.setModal(true);
this.setWidth(700);
this.setHeight(500);
this.setResizable(false);
this.getButtonBar().removeAll();
this.setHideOnButtonClick(true);
}
@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 void addStaticProperty(final String pfield, final String pdescription, final String pvalue) {
final FieldSet fieldSet = new FieldSet();
fieldSet.setLayout(new FormLayout());
fieldSet.setHeading("Property");
fieldSet.setCollapsible(false);
TextField<String> name = new TextField<String>();
name.setFieldLabel("Name");
name.setValue(pfield);
name.setEnabled(false);
name.setAllowBlank(false);
fieldSet.add(name, formData);
TextField<String> description = new TextField<String>();
description.setFieldLabel("Description");
description.setEmptyText(pdescription);
description.setAllowBlank(true);
fieldSet.add(description, formData);
TextField<String> value = new TextField<String>();
value.setFieldLabel("Value");
value.setEmptyText(pvalue);
value.setAllowBlank(false);
fieldSet.add(value, formData);
form.add(fieldSet, formData);
fieldSet.recalculate();
this.doLayout(true);
}
private void addProperty() {
final FieldSet fieldSet = new FieldSet();
fieldSet.setLayout(new FormLayout());
fieldSet.setHeading("Property");
fieldSet.setCollapsible(false);
TextField<String> name = new TextField<String>();
name.setFieldLabel("Name");
name.setAllowBlank(false);
fieldSet.add(name, formData);
TextField<String> description = new TextField<String>();
description.setFieldLabel("Description");
description.setAllowBlank(true);
fieldSet.add(description, formData);
TextField<String> value = new TextField<String>();
value.setFieldLabel("Value");
value.setAllowBlank(false);
fieldSet.add(value, formData);
final HorizontalPanel buttonPanel = new HorizontalPanel();
Button addButton = new Button("Add New Property") {
@Override
protected void onClick(final ComponentEvent ce) {
addProperty();
}
};
addButton.setIconStyle("new-icon");
buttonPanel.add(addButton);
Button delButton = new Button("Remove This Property") {
@Override
protected void onClick(final ComponentEvent ce) {
form.remove(fieldSet);
}
};
delButton.setIconStyle("delete-icon");
buttonPanel.add(delButton);
fieldSet.add(buttonPanel, formData);
form.add(fieldSet, formData);
fieldSet.recalculate();
this.doLayout(true);
}
private void createForm() {
form = new FormPanel();
form.setFrame(true);
form.setAutoWidth(true);
//form.setLayout(new FlowLayout());
form.setScrollMode(Scroll.AUTO);
form.setHeaderVisible(false);
form.getHeader().setStyleName("x-hide-panel-header");
TextField<String> resID = new TextField<String>();
resID.setFieldLabel("Resource ID");
resID.setEnabled(false);
resID.setAllowBlank(true); // is required
resID.setEmptyText("<generated by Resource Manager>");
form.add(resID, formData);
TextField<String> resName = new TextField<String>();
resName.setFieldLabel("Resource Name");
resName.setValue("VMRecord");
resName.setEnabled(false);
//resName.setValidator(new StringValidator(20, false));
resName.setAllowBlank(false); // is required
form.add(resName, formData);
TextField<String> resType = new TextField<String>();
resType.setFieldLabel("Secondary type");
resType.setValue("ActivationRecord");
resType.setEnabled(false);
// resType.setValidator(new StringValidator(20, false));
resType.setAllowBlank(false); // is required
form.add(resType, formData);
TextArea description = new TextArea();
description.setFieldLabel("Description");
form.add(description, formData);
ComboBox<ModelData> pluginSelect = new ComboBox<ModelData>();
ListStore<ModelData> storePlugin = new ListStore<ModelData>();
storePlugin.add(new AtomicTreeNode("Metadata"));
storePlugin.add(new AtomicTreeNode("Annotation"));
pluginSelect.setStore(storePlugin);
pluginSelect.setFieldLabel("Plugin Kind:");
pluginSelect.setEmptyText("Select a plugin...");
pluginSelect.setTypeAhead(true);
pluginSelect.setTriggerAction(TriggerAction.ALL);
pluginSelect.setDisplayField("name");
pluginSelect.setForceSelection(true);
form.add(pluginSelect, formData);
// The select for collections
ComboBox<ResourceDescriptor> collectionSelect = new ComboBox<ResourceDescriptor>();
ListStore<ResourceDescriptor> store = new ListStore<ResourceDescriptor>();
try {
store.add(new ResourceDescriptor("type", "subtype", "ID", "the name"));
} catch (InvalidParameterException e) {
e.printStackTrace();
}
collectionSelect.setStore(store);
collectionSelect.setFieldLabel("Collection");
collectionSelect.setEmptyText("Select a collection...");
collectionSelect.setDisplayField("name");
collectionSelect.setTypeAhead(true);
collectionSelect.setTriggerAction(TriggerAction.ALL);
collectionSelect.setForceSelection(true);
collectionSelect.setData("text", "Select a collection");
form.add(collectionSelect, formData);
loadCollections(StatusHandler.getStatus().getCurrentScope(), collectionSelect);
// -- ENDOF The select for collections
// Inserts the static fields
for (StaticFields entry : StaticFields.values()) {
this.addStaticProperty(entry.getName(), entry.getDescription(), entry.getValue());
}
HorizontalPanel buttonPanel = new HorizontalPanel();
Button addButton = new Button("Add New Property") {
@Override
protected void onClick(final ComponentEvent ce) {
addProperty();
}
};
addButton.setIconStyle("new-icon");
buttonPanel.add(addButton);
form.add(buttonPanel, formData);
Button submitBtn = new Button("Submit") {
@Override
protected void onClick(final ComponentEvent ce) {
super.onClick(ce);
if (!form.isValid()) {
return;
}
List<Field<?>> fields = form.getFields();
// Creation mode
// the parameter in position 0 is the
// auto-generated ID.
String resName = fields.get(1).getRawValue();
String resType = fields.get(2).getRawValue();
String description = fields.get(3).getRawValue();
String plugin = fields.get(4).getRawValue() + "Plugin";
String viewType = fields.get(4).getRawValue() + "View";
String viewID = generateID();
String collectionID = ((ResourceDescriptor) fields.get(5).getValue()).getID();
// builds a list of tuples each one representing a single property
// properties are supposed to be represented by three fields each one.
List<Tuple<String>> properties = new Vector<Tuple<String>>();
if (fields.size() > StaticFields.values().length - 1) {
for (int i = StaticFields.values().length - 1; i < fields.size(); i = i + 3) {
properties.add(new Tuple<String>(
fields.get(i).getRawValue().trim(),
(fields.get(i + 1).getRawValue() != null) ? fields.get(i + 1).getRawValue().trim() : "", // description can be null
fields.get(i + 2).getRawValue().trim()));
}
} else {
MessageBox.alert("Create Activation Form for VM", "No properties defined", null);
return;
}
StringBuilder body = new StringBuilder();
body.append("<ns4:Record xmlns:ns4=\"http://gcube-system.org/namespaces/common\" xmlns:ns3=\"http://gcube-system.org/namespaces/contentmanagement/contentmanager\" xmlns:ns2=\"http://gcube-system.org/namespaces/contentmanagement/viewmanager\">");
body.append("<createdBy xmlns:ns4=\"http://gcube-system.org/namespaces/common\" xmlns:ns3=\"http://gcube-system.org/namespaces/contentmanagement/contentmanager\" xmlns:ns2=\"http://gcube-system.org/namespaces/contentmanagement/viewmanager\">ResourceManagementPortlet</createdBy>");
body.append("<plugin xmlns:ns4=\"http://gcube-system.org/namespaces/common\" xmlns:ns3=\"http://gcube-system.org/namespaces/contentmanagement/contentmanager\" xmlns:ns2=\"http://gcube-system.org/namespaces/contentmanagement/viewmanager\">" + plugin + "</plugin>");
body.append("<view xmlns:ns4=\"http://gcube-system.org/namespaces/common\" xmlns:ns3=\"http://gcube-system.org/namespaces/contentmanagement/contentmanager\" xmlns:ns2=\"http://gcube-system.org/namespaces/contentmanagement/viewmanager\">");
body.append("<ns2:id xmlns:ns4=\"http://gcube-system.org/namespaces/common\" xmlns:ns3=\"http://gcube-system.org/namespaces/contentmanagement/contentmanager\" xmlns:ns2=\"http://gcube-system.org/namespaces/contentmanagement/viewmanager\">" + viewID + "</ns2:id>");
body.append("<ns2:collectionID xmlns:ns4=\"http://gcube-system.org/namespaces/common\" xmlns:ns3=\"http://gcube-system.org/namespaces/contentmanagement/contentmanager\" xmlns:ns2=\"http://gcube-system.org/namespaces/contentmanagement/viewmanager\">" + collectionID + "</ns2:collectionID>");
body.append("<ns2:type xmlns:ns4=\"http://gcube-system.org/namespaces/common\" xmlns:ns3=\"http://gcube-system.org/namespaces/contentmanagement/contentmanager\" xmlns:ns2=\"http://gcube-system.org/namespaces/contentmanagement/viewmanager\">" + viewType + "</ns2:type>");
body.append("<ns2:predicate xmlns:ns4=\"http://gcube-system.org/namespaces/common\" xmlns:ns3=\"http://gcube-system.org/namespaces/contentmanagement/contentmanager\" xmlns:ns2=\"http://gcube-system.org/namespaces/contentmanagement/viewmanager\" />");
body.append("<ns2:description xmlns:ns4=\"http://gcube-system.org/namespaces/common\" xmlns:ns3=\"http://gcube-system.org/namespaces/contentmanagement/contentmanager\" xmlns:ns2=\"http://gcube-system.org/namespaces/contentmanagement/viewmanager\">" + fields.get(4).getRawValue() + " view for collection " + collectionID + "</ns2:description>");
body.append("<ns2:cardinality xmlns:ns4=\"http://gcube-system.org/namespaces/common\" xmlns:ns3=\"http://gcube-system.org/namespaces/contentmanagement/contentmanager\" xmlns:ns2=\"http://gcube-system.org/namespaces/contentmanagement/viewmanager\">0</ns2:cardinality>");
body.append("<ns2:lastUpdate xmlns:ns4=\"http://gcube-system.org/namespaces/common\" xmlns:ns3=\"http://gcube-system.org/namespaces/contentmanagement/contentmanager\" xmlns:ns2=\"http://gcube-system.org/namespaces/contentmanagement/viewmanager\">" + "2010-10-25T14:01:55.948+00:00" + "</ns2:lastUpdate>");
for (Tuple<String> prop : properties) {
body.append("<ns2:property xmlns:ns4=\"http://gcube-system.org/namespaces/common\" xmlns:ns3=\"http://gcube-system.org/namespaces/contentmanagement/contentmanager\" xmlns:ns2=\"http://gcube-system.org/namespaces/contentmanagement/viewmanager\">");
body.append("<ns2:name xmlns:ns4=\"http://gcube-system.org/namespaces/common\" xmlns:ns3=\"http://gcube-system.org/namespaces/contentmanagement/contentmanager\" xmlns:ns2=\"http://gcube-system.org/namespaces/contentmanagement/viewmanager\">" + prop.get(0) + "</ns2:name>");
body.append("<ns2:description xmlns:ns4=\"http://gcube-system.org/namespaces/common\" xmlns:ns3=\"http://gcube-system.org/namespaces/contentmanagement/contentmanager\" xmlns:ns2=\"http://gcube-system.org/namespaces/contentmanagement/viewmanager\">" + prop.get(1) + "</ns2:description>");
body.append("<ns2:value xmlns:ns4=\"http://gcube-system.org/namespaces/common\" xmlns:ns3=\"http://gcube-system.org/namespaces/contentmanagement/contentmanager\" xmlns:ns2=\"http://gcube-system.org/namespaces/contentmanagement/viewmanager\">" + prop.get(2) + "</ns2:value>");
body.append("</ns2:property>");
}
body.append("</view>");
body.append("</ns4:Record>");
OpCommands.doCreateGenericResource(viewID, resName, description, body.toString(), 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);
}
private String generateID() {
char[] s = new char[36];
String itoh = "0123456789abcdef";
// Make array of random hex digits. The UUID only has 32 digits in it, but we
// allocate an extra items to make room for the '-'s we'll be inserting.
for (int i = 0; i < 36; i++) {
s[i] = (char) Math.floor(Math.random() * 0x10);
}
// Conform to RFC-4122, section 4.4
s[14] = 4; // Set 4 high bits of time_high field to version
s[19] = (char) ((s[19] & 0x3) | 0x8); // Specify 2 high bits of clock sequence
// Convert to hex chars
for (int i = 0; i < 36; i++) {
s[i] = itoh.charAt((int) s[i]);
}
// Insert '-'s
s[8] = s[13] = s[18] = s[23] = '-';
return new String(s);
}
private void loadCollections(final String scope, final ComboBox<ResourceDescriptor> combo) {
ProxyRegistry.getProxyInstance().getResourcesModel(scope,
ResourceTypeDecorator.GenericResource.name(),
"GCUBECollection",
null,
new AsyncCallback<List<ResourceDescriptor>>() {
public void onSuccess(final List<ResourceDescriptor> result) {
combo.getStore().removeAll();
combo.getStore().add(result);
combo.setValidator(new SelectValidator(false));
combo.setAllowBlank(false);
combo.setTriggerAction(TriggerAction.ALL);
combo.recalculate();
Commands.showPopup("Collection load", "Loaded (" + result.size() + ") Collections");
}
public void onFailure(final Throwable e) {
MessageBox.alert("Error getting collections", e.getMessage(), null);
}
});
}
}

View File

@ -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());
}
});
}
}

View File

@ -0,0 +1,329 @@
/****************************************************************************
* 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: GenericResourcePluginForm.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.HashMap;
import java.util.Map;
import org.gcube.portlets.admin.resourcemanagement.client.remote.ProxyRegistry;
import org.gcube.portlets.admin.resourcemanagement.client.utils.OpCommands;
import org.gcube.resourcemanagement.support.client.views.validators.SelectValidator;
import org.gcube.resourcemanagement.support.shared.plugins.GenericResourcePlugin;
import org.gcube.resourcemanagement.support.shared.types.Tuple;
import org.gcube.resourcemanagement.support.shared.types.datamodel.AtomicTreeNode;
import com.extjs.gxt.ui.client.Style.Scroll;
import com.extjs.gxt.ui.client.data.ModelData;
import com.extjs.gxt.ui.client.event.ComponentEvent;
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.widget.Component;
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.ComboBox;
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
import com.extjs.gxt.ui.client.widget.form.Field;
import com.extjs.gxt.ui.client.widget.form.FieldSet;
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.FlowLayout;
import com.extjs.gxt.ui.client.widget.layout.FormData;
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.rpc.AsyncCallback;
public class GenericResourceCMForm extends Dialog {
private FormData formData = null;
private FormPanel form = null;
private FieldSet pluginFieldSet = null;
private String selectedPlugin = null;
private Map<String, GenericResourcePlugin> loadedPlugins = null;
private TextField<String> resName = null;
public GenericResourceCMForm() {
this.setLayout(new FitLayout());
this.setHeading("Generic Resource Creation (Plugin)");
this.setModal(true);
this.setWidth(700);
this.setHeight(500);
this.setResizable(false);
this.getButtonBar().removeAll();
this.setHideOnButtonClick(true);
}
@Override
protected final void onRender(final Element parent, final int index) {
super.onRender(parent, index);
formData = new FormData("-20");
createForm();
createPluginForm();
this.add(form);
this.initButtons();
this.recalculate();
this.doLayout(true);
this.form.mask("Loading plugins...");
// Gets the plugins
ProxyRegistry.getProxyInstance().getGenericResourcePlugins(new AsyncCallback<Map<String, GenericResourcePlugin>>() {
public void onSuccess(final Map<String, GenericResourcePlugin> result) {
addPluginSelect(result);
form.unmask();
}
public void onFailure(final Throwable caught) {
MessageBox.alert("Create Generic Resource (Plugin)",
"Received an exception: " + caught.getMessage(), null);
form.unmask();
}
});
}
public final void closeDialog() {
this.hide();
}
private void setPluginFields(final GenericResourcePlugin plugin) {
if (plugin.getParams().size() == 0) {
return;
}
Component select = pluginFieldSet.getItem(0);
pluginFieldSet.removeAll();
pluginFieldSet.add(select);
for (GenericResourcePlugin.Field field : plugin.getParams()) {
if (field.getType() == GenericResourcePlugin.FieldType.string) {
TextField<String> toAdd = new TextField<String>();
toAdd.setFieldLabel(field.getLabel() + (field.isRequired() ? "*" : ""));
toAdd.setName(field.getName());
//toAdd.setValidator(new StringValidator(128, !field.isRequired()));
toAdd.setAllowBlank(!field.isRequired()); // is required
toAdd.setValue(field.getDefaultValue());
pluginFieldSet.add(toAdd, formData);
pluginFieldSet.recalculate();
this.doLayout(true);
}
}
}
private void addPluginSelect(final Map<String, GenericResourcePlugin> plugins) {
ListStore<ModelData> store = new ListStore<ModelData>();
for (String pluginName : plugins.keySet()) {
store.add(new AtomicTreeNode(pluginName));
}
ComboBox<ModelData> combo = new ComboBox<ModelData>();
combo.setFieldLabel("Plugin");
combo.addSelectionChangedListener(new SelectionChangedListener<ModelData>() {
@Override
public void selectionChanged(final SelectionChangedEvent<ModelData> se) {
if (se != null &&
se.getSelection() != null
&& se.getSelection() instanceof ArrayList) {
@SuppressWarnings("rawtypes")
String selection = ((ArrayList) se.getSelection()).get(0).toString();
selectedPlugin = selection;
setPluginFields(loadedPlugins.get(selection));
}
}
});
combo.setEmptyText("Select a plugin...");
combo.setDisplayField("name");
combo.setStore(store);
combo.setTypeAhead(true);
combo.setValidator(new SelectValidator(false));
combo.setAllowBlank(false);
combo.setForceSelection(true);
combo.setTriggerAction(TriggerAction.ALL);
combo.recalculate();
pluginFieldSet.recalculate();
pluginFieldSet.add(combo, formData);
this.doLayout(true);
this.loadedPlugins = plugins;
}
private void createForm() {
form = new FormPanel();
form.setFrame(true);
form.setAutoWidth(true);
form.setHeaderVisible(false);
form.getHeader().setStyleName("x-hide-panel-header");
form.setLayout(new FlowLayout());
form.setScrollMode(Scroll.AUTO);
FieldSet formHead = new FieldSet();
formHead.setHeading("Basic parameters");
formHead.setCollapsible(true);
FormLayout layout = new FormLayout();
layout.setLabelWidth(90);
formHead.setLayout(layout);
TextField<String> resID = new TextField<String>();
resID.setFieldLabel("Resource ID");
// resID.setValidator(new StringValidator(64, false));
resID.setAllowBlank(false); // is required
// If in editing mode
resID.setEmptyText("<generated by Resource Manager>");
resID.setEnabled(false);
formHead.add(resID, formData);
this.resName = new TextField<String>();
resName.setFieldLabel("Resource Name");
// resName.setValidator(new StringValidator(64, false));
resName.setAllowBlank(false); // is required
resName.setValue("CMSRecord");
resName.setEnabled(false);
formHead.add(resName, formData);
ComboBox<AtomicTreeNode> resType = new ComboBox<AtomicTreeNode>();
ListStore<AtomicTreeNode> storePlugin = new ListStore<AtomicTreeNode>();
storePlugin.add(new AtomicTreeNode("ActivationRecord"));
storePlugin.add(new AtomicTreeNode("VirtualCollection"));
resType.setStore(storePlugin);
resType.setFieldLabel("Secondary Type");
//resType.setEmptyText("Select a subtype...");
resType.setValue(storePlugin.getAt(0));
resType.setDisplayField("name");
resType.setAllowBlank(false);
resType.setTypeAhead(true);
resType.setTriggerAction(TriggerAction.ALL);
resType.setForceSelection(true);
resType.addSelectionChangedListener(new SelectionChangedListener<AtomicTreeNode>() {
@Override
public void selectionChanged(final SelectionChangedEvent<AtomicTreeNode> se) {
// The usual casting trick for fixing invalid class specification
// of generic return in models.
if (se.getSelection().get(0).getName().equals("VirtualCollection")) {
resName.setFieldLabel("Collection Name");
resName.setValue(null);
resName.setEnabled(true);
} else {
resName.setFieldLabel("Resource Name");
resName.setValue("CMSRecord");
resName.setEnabled(false);
}
}
});
formHead.add(resType, formData);
TextArea description = new TextArea();
description.setFieldLabel("Description");
description.setPreventScrollbars(false);
//description.setHeight(50);
formHead.add(description, formData);
form.add(formHead);
}
private void createPluginForm() {
this.pluginFieldSet = new FieldSet();
pluginFieldSet.setHeading("Plugin parameters");
pluginFieldSet.setCollapsible(true);
FormLayout layout = new FormLayout();
layout.setLabelWidth(110);
pluginFieldSet.setLayout(layout);
form.add(pluginFieldSet);
}
public final void initButtons() {
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());
}
String resName = values.get(1);
String resType = values.get(2);
String description = values.get(3);
StringBuilder body = new StringBuilder();
body.append("<ns3:Record xmlns:ns3=\"http://gcube-system.org/namespaces/common\" xmlns:ns2=\"http://gcube-system.org/namespaces/contentmanagement/contentmanager\">");
body.append("<createdBy xmlns:ns3=\"http://gcube-system.org/namespaces/common\" xmlns:ns2=\"http://gcube-system.org/namespaces/contentmanagement/contentmanager\">ResourceManagementPortlet</createdBy>");
body.append("<parameters xmlns:ns3=\"http://gcube-system.org/namespaces/common\" xmlns:ns2=\"http://gcube-system.org/namespaces/contentmanagement/contentmanager\">");
body.append("<broadcast xmlns:ns3=\"http://gcube-system.org/namespaces/common\" xmlns:ns2=\"http://gcube-system.org/namespaces/contentmanagement/contentmanager\">true</broadcast>");
if (selectedPlugin == null) {
return;
}
GenericResourcePlugin plugin = loadedPlugins.get(selectedPlugin);
body.append("<ns4:" + plugin.getType() + " xmlns:ns3=\"http://gcube-system.org/namespaces/common\" xmlns:ns2=\"http://gcube-system.org/namespaces/contentmanagement/contentmanager\"" + plugin.getNamespace() + ">");
Map<String, Object> submitted = new HashMap<String, Object>();
for (Field<?> field : form.getFields()) {
submitted.put(field.getName(), field.getRawValue());
}
if (plugin.getParams() != null && plugin.getParams().size() > 0) {
for (GenericResourcePlugin.Field field : plugin.getParams()) {
try {
String tag = field.getName();
String value = submitted.get(tag).toString();
if (value != null && value.trim().length() > 0) {
body.append("<" + tag + ">" + value + "</" + tag + ">");
}
} catch (RuntimeException e) {
// parsing errors will be skipped
}
}
}
body.append("</ns4:" + plugin.getType() + ">");
body.append("<plugin xmlns:ns3=\"http://gcube-system.org/namespaces/common\" xmlns:ns2=\"http://gcube-system.org/namespaces/contentmanagement/contentmanager\">" + plugin.getName() + "</plugin>");
body.append("</parameters>");
body.append("</ns3:Record>");
OpCommands.doCreateGenericResource(null, resName, description, body.toString(), resType);
closeDialog();
}
};
this.form.addButton(submitBtn);
this.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);
}
}

View File

@ -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);
}
}

View File

@ -0,0 +1,343 @@
/****************************************************************************
* 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: GenericResourceTreeManagerForm.java
****************************************************************************
* @author <a href="mailto:assante@isti.cnr.it">Massimiliano Assante</a>
***************************************************************************/
package org.gcube.portlets.admin.resourcemanagement.client.forms.genericresources;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import org.gcube.portlets.admin.resourcemanagement.client.remote.ProxyRegistry;
import org.gcube.portlets.admin.resourcemanagement.client.utils.OpCommands;
import org.gcube.resourcemanagement.support.client.views.validators.SelectValidator;
import org.gcube.resourcemanagement.support.shared.plugins.TMPluginFormField;
import org.gcube.resourcemanagement.support.shared.types.Tuple;
import org.gcube.resourcemanagement.support.shared.types.datamodel.AtomicTreeNode;
import com.extjs.gxt.ui.client.Style.Scroll;
import com.extjs.gxt.ui.client.data.ModelData;
import com.extjs.gxt.ui.client.event.ComponentEvent;
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.widget.Component;
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.ComboBox;
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
import com.extjs.gxt.ui.client.widget.form.Field;
import com.extjs.gxt.ui.client.widget.form.FieldSet;
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.FlowLayout;
import com.extjs.gxt.ui.client.widget.layout.FormData;
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.rpc.AsyncCallback;
/**
*
* @author Massimiliano Assante, ISTI-CNR
* @version 1.0 Oct 2012
*
*/
public class GenericResourceTreeManagerForm extends Dialog {
private FormData formData = null;
private FormPanel form = null;
private FieldSet pluginFieldSet = null;
private String selectedPlugin = null;
private HashMap<String, ArrayList<TMPluginFormField>> loadedPlugins = null;
private TextField<String> resName = null;
public GenericResourceTreeManagerForm() {
this.setLayout(new FitLayout());
this.setHeading("Generic Resource Creation (TM Plugin)");
this.setModal(true);
this.setWidth(700);
this.setHeight(500);
this.setResizable(false);
this.getButtonBar().removeAll();
this.setHideOnButtonClick(true);
}
@Override
protected final void onRender(final Element parent, final int index) {
super.onRender(parent, index);
formData = new FormData("-20");
createForm();
createPluginForm();
this.add(form);
this.initButtons();
this.recalculate();
this.doLayout(true);
this.form.mask("Loading plugins...");
// Gets the plugins
ProxyRegistry.getProxyInstance().getGenericResourceTreeMagnagerPlugins(new AsyncCallback<HashMap<String, ArrayList<TMPluginFormField>>>() {
@Override
public void onSuccess(HashMap<String, ArrayList<TMPluginFormField>> result) {
addPluginSelect(result);
form.unmask();
}
@Override
public void onFailure(final Throwable caught) {
MessageBox.alert("Create Generic Resource (Tree Manager Plugin)",
"Received an exception: " + caught.getMessage(), null);
form.unmask();
}
});
}
public final void closeDialog() {
this.hide();
}
private void setPluginFields(final ArrayList<TMPluginFormField> fields) {
if (fields.size() == 0) {
return;
}
Component select = pluginFieldSet.getItem(0);
pluginFieldSet.removeAll();
pluginFieldSet.add(select);
for (TMPluginFormField field : fields) {
TextField<String> toAdd = new TextField<String>();
toAdd.setFieldLabel(field.getLabel() + (field.isRequired() ? "*" : ""));
toAdd.setName(field.getLabel());
//toAdd.setValidator(new StringValidator(128, !field.isRequired()));
toAdd.setAllowBlank(!field.isRequired()); // is required
toAdd.setValue(field.getDefaultValue() + (field.isRepeatable() ? "," + field.getDefaultValue() + "2 (Repeatable, use comma to separate " + field.getLabel() + ")" : ""));
pluginFieldSet.add(toAdd, formData);
pluginFieldSet.recalculate();
this.doLayout(true);
}
}
private void addPluginSelect(final HashMap<String, ArrayList<TMPluginFormField>> plugins) {
ListStore<ModelData> store = new ListStore<ModelData>();
for (String pluginName : plugins.keySet()) {
store.add(new AtomicTreeNode(pluginName));
}
ComboBox<ModelData> combo = new ComboBox<ModelData>();
combo.setFieldLabel("Plugin");
combo.addSelectionChangedListener(new SelectionChangedListener<ModelData>() {
@Override
public void selectionChanged(final SelectionChangedEvent<ModelData> se) {
if (se != null &&
se.getSelection() != null
&& se.getSelection() instanceof ArrayList) {
@SuppressWarnings("rawtypes")
String selection = ((ArrayList) se.getSelection()).get(0).toString();
selectedPlugin = selection;
setPluginFields(loadedPlugins.get(selection));
}
}
});
combo.setEmptyText("Select a plugin...");
combo.setDisplayField("name");
combo.setStore(store);
combo.setTypeAhead(true);
combo.setValidator(new SelectValidator(false));
combo.setAllowBlank(false);
combo.setForceSelection(true);
combo.setTriggerAction(TriggerAction.ALL);
combo.recalculate();
pluginFieldSet.recalculate();
pluginFieldSet.add(combo, formData);
this.doLayout(true);
this.loadedPlugins = plugins;
}
private void createForm() {
form = new FormPanel();
form.setFrame(true);
form.setAutoWidth(true);
form.setHeaderVisible(false);
form.getHeader().setStyleName("x-hide-panel-header");
form.setLayout(new FlowLayout());
form.setScrollMode(Scroll.AUTO);
FieldSet formHead = new FieldSet();
formHead.setHeading("Basic parameters");
formHead.setCollapsible(true);
FormLayout layout = new FormLayout();
layout.setLabelWidth(90);
formHead.setLayout(layout);
TextField<String> resID = new TextField<String>();
resID.setFieldLabel("Resource ID");
// resID.setValidator(new StringValidator(64, false));
resID.setAllowBlank(false); // is required
// If in editing mode
resID.setEmptyText("<generated by Resource Manager>");
resID.setEnabled(false);
formHead.add(resID, formData);
this.resName = new TextField<String>();
resName.setFieldLabel("Resource Name");
// resName.setValidator(new StringValidator(64, false));
resName.setAllowBlank(false); // is required
resName.setValue("TMRecord");
resName.setEnabled(false);
formHead.add(resName, formData);
ComboBox<AtomicTreeNode> resType = new ComboBox<AtomicTreeNode>();
ListStore<AtomicTreeNode> storePlugin = new ListStore<AtomicTreeNode>();
storePlugin.add(new AtomicTreeNode("ActivationRecord"));
resType.setStore(storePlugin);
resType.setFieldLabel("Secondary Type");
//resType.setEmptyText("Select a subtype...");
resType.setValue(storePlugin.getAt(0));
resType.setDisplayField("name");
resType.setAllowBlank(false);
resType.setEditable(false);
resType.setTypeAhead(false);
resType.setTriggerAction(TriggerAction.ALL);
resType.setForceSelection(true);
resType.addSelectionChangedListener(new SelectionChangedListener<AtomicTreeNode>() {
@Override
public void selectionChanged(final SelectionChangedEvent<AtomicTreeNode> se) {
// The usual casting trick for fixing invalid class specification
// of generic return in models.
if (se.getSelection().get(0).getName().equals("VirtualCollection")) {
resName.setFieldLabel("Collection Name");
resName.setValue(null);
resName.setEnabled(true);
} else {
resName.setFieldLabel("Resource Name");
resName.setValue("TMRecord");
resName.setEnabled(false);
}
}
});
formHead.add(resType, formData);
TextArea description = new TextArea();
description.setFieldLabel("Description");
description.setPreventScrollbars(false);
//description.setHeight(50);
formHead.add(description, formData);
form.add(formHead);
}
private void createPluginForm() {
this.pluginFieldSet = new FieldSet();
pluginFieldSet.setHeading("Plugin parameters");
pluginFieldSet.setCollapsible(true);
FormLayout layout = new FormLayout();
layout.setLabelWidth(110);
pluginFieldSet.setLayout(layout);
form.add(pluginFieldSet);
}
public final void initButtons() {
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());
}
String resName = values.get(1);
String resType = values.get(2);
String description = values.get(3);
StringBuilder body = new StringBuilder();
body.append("<ns3:Record xmlns:ns3=\"http://gcube-system.org/namespaces/common\" xmlns:ns2=\"http://gcube-system.org/namespaces/data/tm\">");
body.append("<createdBy xmlns:ns3=\"http://gcube-system.org/namespaces/common\" xmlns:ns2=\"http://gcube-system.org/namespaces/data/tm\">ResourceManagementPortlet</createdBy>");
body.append("<parameters xmlns:ns3=\"http://gcube-system.org/namespaces/common\" xmlns:ns2=\"http://gcube-system.org/namespaces/data/tm\">");
body.append("<broadcast xmlns:ns3=\"http://gcube-system.org/namespaces/common\" xmlns:ns2=\"http://gcube-system.org/namespaces/data/tm\">true</broadcast>");
if (selectedPlugin == null) {
return;
}
ArrayList<TMPluginFormField> fields = loadedPlugins.get(selectedPlugin);
body.append("<speciesRequest>");
Map<String, Object> submitted = new HashMap<String, Object>();
for (Field<?> field : form.getFields()) {
submitted.put(field.getName(), field.getRawValue());
}
if (fields != null && fields.size() > 0) {
for (TMPluginFormField field : fields) {
try {
String tag = field.getLabel();
String value = submitted.get(tag).toString();
if (value != null && value.trim().length() > 0) {
if (value.split(",").length > 0) {
String[] toAdd = value.split(",");
for (int i = 0; i < toAdd.length; i++) {
body.append("<" + tag + ">" + toAdd[i] + "</" + tag + ">");
}
}
else
body.append("<" + tag + ">" + value + "</" + tag + ">");
}
} catch (RuntimeException e) {
// parsing errors will be skipped
}
}
}
body.append("</speciesRequest>");
body.append("<plugin xmlns:ns3=\"http://gcube-system.org/namespaces/common\" xmlns:ns2=\"http://gcube-system.org/namespaces/data/tm\">" + selectedPlugin + "</plugin>");
body.append("</parameters>");
body.append("</ns3:Record>");
OpCommands.doCreateGenericResource(null, resName, description, body.toString(), resType);
closeDialog();
}
};
this.form.addButton(submitBtn);
this.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);
}
}

View File

@ -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;
}
}

View File

@ -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.plugins.TMPluginFormField;
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 {
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;
HashMap<String, ArrayList<TMPluginFormField>> getGenericResourceTreeMagnagerPlugins() throws Exception;
/***********************************************************
* RESOURCE OPERATIONS
**********************************************************/
void doOperation(SupportedOperations opCode, String scope, List<ResourceDescriptor> resources)
throws Exception;
}

View File

@ -0,0 +1,125 @@
/****************************************************************************
* 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.plugins.TMPluginFormField;
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 getGenericResourceTreeMagnagerPlugins(
AsyncCallback<HashMap<String, ArrayList<TMPluginFormField>>> callback);
}

View File

@ -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);
}
};
}

View File

@ -0,0 +1,532 @@
/****************************************************************************
* 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.Configuration;
import org.gcube.portlets.admin.resourcemanagement.shared.exceptions.WidgetNotRegistered;
import org.gcube.portlets.admin.resourcemanagement.shared.utils.DelayedOperation;
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 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.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, final String resourceType, final String resourceID) {
StatusHandler.getStatus().setCurrentScope(scope);
StatusHandler.getStatus().setCurrentResourceType(resourceType);
Commands.mask(
"Getting Profile Details for " + 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 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();
}
}

View File

@ -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.";
}

View File

@ -0,0 +1,290 @@
/****************************************************************************
* 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: OpCommands.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.portlets.admin.resourcemanagement.shared.utils.DelayedOperation;
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 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.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);
}
}
/*************************************************************
* 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);
}
}
});
}
}
}

View File

@ -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;
}
}

View File

@ -0,0 +1,723 @@
/****************************************************************************
* 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.get(0).equals("ACK")) {
MessageBox.info("Remove From Scope",
"The required remove from scope operation has been applied.<br/>", null);
} else {
MessageBox.alert("Remove from Scope",
"The required remove from scope operation has NOT been applied.<br/>" +
result.get(0),
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");
}
loadRuntimeResourcePortlet(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;
}
String location;
/**
* Redirect to Runtime Resource Portlet
* @param idToEdit
*/
public void loadRuntimeResourcePortlet(String idToEdit){
getUrl();
// Window.alert(location);
if (location.endsWith("/") || location.endsWith("#")) { //standalone
location = com.google.gwt.user.client.Window.Location.getProtocol() +"//"+ com.google.gwt.user.client.Window.Location.getHost() + "/runtime-resource?pid=126&lifecycle=0&state=maximized&modes=view&doAsId=10136&refererPlid=10139&rid="+idToEdit+"&authzToken=101334249&curscope="+StatusHandler.getStatus().getCurrentScope();
//GWT.log("OPEN " + location);
getURL(location);
}
else { //portal
getUrl();
location += "/../runtime-resource?pid=126&lifecycle=0&state=maximized&modes=view&doAsId=10136&refererPlid=10139&rid="+idToEdit+"&authzToken=101334249&curscope="+StatusHandler.getStatus().getCurrentScope();
Window.open(location, "_self", "");
}
}
public static native void getURL(String url)/*-{
$wnd.open(url,'target=_blank')
}-*/;
/**
* Get URL from browser
*/
public native void getUrl()/*-{
this.@org.gcube.portlets.admin.resourcemanagement.client.views.resourcedetails.ContextMenuFactory::location = $wnd.location.href;
}-*/;
}

View File

@ -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);
}
}

View File

@ -0,0 +1,422 @@
/****************************************************************************
* 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.portlets.admin.software_upload_wizard.client.AppController;
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.GridEvent;
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.event.shared.HandlerManager;
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.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("Enables/Disables grouping by " + this.collapsibleColumn);
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 grid");
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);
// OpCommands.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);
}
// Adds toolbar button for software upload wizard (SUW)
if (resType.equals(ResourceTypeDecorator.Service.name()) &&
SupportedOperations.SERVICE_DEPLOY.isAllowed(StatusHandler.getStatus().getCredentials())) {
this.getToolBar().add(new SeparatorToolItem());
ToolButton doAddSoftware = new ToolButton("add-software-icon") {
protected void onClick(final ComponentEvent be) {
super.onClick(be);
GWT.runAsync(AppController.class, new RunAsyncCallback() {
@Override
public void onSuccess() {
String currentScope = StatusHandler.getStatus().getCurrentScope();
HandlerManager eventBus = new HandlerManager(null);
AppController appViewer = new AppController(eventBus, currentScope);
//AppController appViewer = new AppController(eventBus);
appViewer.go();
}
public void onFailure(Throwable reason) {
Window.alert("There are networks problem, please check your connection.");
}
});
};
};
doAddSoftware.setToolTip("Upload software");
this.getToolBar().add(doAddSoftware);
this.getToolBar().add(new SeparatorToolItem());
}
}
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);
}
}
}

View File

@ -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;
}
}
}

View File

@ -0,0 +1,218 @@
/****************************************************************************
* 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).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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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;
}
}

View File

@ -0,0 +1,117 @@
/****************************************************************************
* 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);
}
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();
}

View File

@ -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);
}
}

View File

@ -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";
}

View File

@ -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;
}
}
}

View File

@ -0,0 +1,177 @@
/****************************************************************************
* 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 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.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 String 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 String type, final String text) {
setId(id);
setText(text);
this.type = type;
}
/**
* 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);
int splitTextTo = 16;
String style = "background:#ffc; display:block; margin-left: 15px; margin-top: 10px; " +
"padding:3px; width: 120px; height: 120px;font-family:'Reenie Beanie',arial,sans-serif; font-size:19px;line-height:1;" +
"-moz-box-shadow:5px 5px 7px rgba(33,33,33,1);"+
"-webkit-box-shadow: 5px 5px 7px rgba(33,33,33,.7);"+
"box-shadow: 5px 5px 7px rgba(33,33,33,.7); " +
"";
//add the (fake) randomly tilted effect
int rd = index + 1;
if (rd % 2 == 0) { //even
style += "-o-transform:rotate(5deg); -webkit-transform:rotate(5deg); -moz-transform:rotate(5deg); position:relative;";
} else if (rd % 3 == 0) { // 3 times
style += "-o-transform:rotate(-3deg); -webkit-transform:rotate(-3deg); -moz-transform:rotate(-3deg); position:relative; top: -5px; ";
} else { //antyhing else
style += "-o-transform:rotate(2deg); -webkit-transform:rotate(2deg); -moz-transform:rotate(2deg); position:relative;";
}
String fontStyle = "font-family:'Reenie Beanie',arial,sans-serif; font-size:20px; padding: 5px; overflow-x: hidden; overflow-y: hidden;";
setElement(DOM.createElement("dt"), target, index);
El a = el().createChild("<div style=\""+ style +"\"><a href='#'></a></div>");
iconEl = a.createChild("<h2>"+type+"</h2>");
El txt = a.createChild("<div style=\""+fontStyle+"\" align=\"center\"></div>");
String toShow = "";
if (text.length() / splitTextTo > 0) {
int iterateTo = ((text.length() / splitTextTo) < 4) ? (text.length() / splitTextTo) : 3;
for (int i = 0; i < iterateTo; i++)
toShow += text.substring(i*splitTextTo, (i+1)*splitTextTo) + " ";
if (iterateTo < 4)
toShow += text.substring((text.length() / splitTextTo)*splitTextTo,text.length());
}
else
toShow = text;
if (txt != null) {
txt.setInnerHtml(toShow);
}
el().updateZIndex(0);
sinkEvents(Event.ONCLICK);
if (icon != null) {
setIcon(icon);
}
}
}

View File

@ -0,0 +1,177 @@
/****************************************************************************
* 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.portlets.admin.resourcemanagement.shared.Configuration;
import org.gcube.resourcemanagement.support.client.views.ResourceTypeDecorator;
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;
import com.google.gwt.core.client.GWT;
/**
* @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();
}
};
GWT.log("TITLE: " + title);
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;
}
}

View File

@ -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();
}
}

View File

@ -0,0 +1,99 @@
/****************************************************************************
* 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 org.gcube.portlets.admin.resourcemanagement.client.widgets.console.ConsoleMessageBroker;
import org.gcube.portlets.admin.resourcemanagement.shared.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;
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);
}
}

View File

@ -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());
}
}

View File

@ -0,0 +1,55 @@
package org.gcube.portlets.admin.resourcemanagement.server;
import java.util.List;
import org.gcube.common.core.contexts.GHNContext;
import org.gcube.common.core.informationsystem.client.ISClient;
import org.gcube.common.core.informationsystem.client.XMLResult;
import org.gcube.common.core.informationsystem.client.queries.GCUBEGenericQuery;
import org.gcube.common.core.scope.GCUBEScope;
public class QueryTest {
public static void main(String[] args) throws Exception {
List<XMLResult> results = null;
ISClient client = GHNContext.getImplementation(ISClient.class);
GCUBEGenericQuery isQuery = null;
isQuery = client.getQuery(GCUBEGenericQuery.class);
String query = "declare namespace gc = 'http://gcube-system.org/namespaces/common/core/porttypes/GCUBEProvider'; " +
" declare namespace wmns= 'http://gcube-system.org/namespaces/contentmanagement/viewmanager'; " +
" for $outer in collection(\"/db/Properties\")//Document, $res in $outer/Data " +
" where $res/gc:ServiceClass/string() eq 'ContentManagement' and count($res//wmns:View)>0 " +
" and $res/gc:ServiceName/string() eq 'ViewManager'" +
"return " +
" <Resource> " +
" {$outer//Document/ID} " +
" {$outer//Document/Source} " +
" {$outer//Document/SourceKey} " +
" <ServiceClass>{$outer//Document/Data/child::*[local-name()='ServiceClass']/text()}</ServiceClass> " +
" <ServiceName>{$outer//Document/Data/child::*[local-name()='ServiceName']/text()}</ServiceName> " +
" <SubType>{$outer//Document/Data/child::*[local-name()='ServiceClass']/text()}</SubType> " +
" {$outer//Document/TerminationTimeHuman} "+
" {$outer//Document/LastUpdateHuman} " +
" <RI>{$outer//Document/Data/child::*[local-name()='RI']/text()}</RI> " +
" <Type>WSResource</Type> "+
" <scopes>{$outer//Document/Data/child::*[local-name()='Scope']/text()}</scopes> "+
" </Resource>";
System.out.println(query);
isQuery.setExpression(query);
results = client.execute(isQuery, GCUBEScope.getScope("/gcube/devNext"));
for (XMLResult elem : results) {
try {
System.out.println(elem.toString());
} catch (IndexOutOfBoundsException e) {
// ignore exception
}
}
}
}

View File

@ -0,0 +1,215 @@
/****************************************************************************
* 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.core.scope.GCUBEScope;
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.managers.resources.ViewManager;
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.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."));
GCUBEScope gscope = ScopeManager.getScope(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);
}
}
}
}

View File

@ -0,0 +1,507 @@
/****************************************************************************
* 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 java.io.File;
import java.security.InvalidParameterException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Vector;
import javax.servlet.http.HttpSession;
import org.gcube.common.core.contexts.GHNContext;
import org.gcube.common.core.informationsystem.client.ISClient;
import org.gcube.common.core.informationsystem.client.QueryParameter;
import org.gcube.common.core.informationsystem.client.XMLResult;
import org.gcube.common.core.informationsystem.client.queries.GCUBEGenericQuery;
import org.gcube.common.core.scope.GCUBEScope;
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.portlets.admin.resourcemanagement.shared.exceptions.InvalidPermissionsException;
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.operations.SupportedOperations;
import org.gcube.resourcemanagement.support.shared.plugins.GenericResourcePlugin;
import org.gcube.resourcemanagement.support.shared.plugins.TMPluginFormField;
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.vremanagement.resourcemanager.stubs.reporting.ReportingPortType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
/**
* @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 getRepositoryUpdgradeDirPath() {
String startDirectory = getServletFSPath();
return startDirectory + File.separator + "reports";
}
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);
GCUBEScope targetScope = ScopeManager.getScope(scope);
GCUBEScope sourceScope = ScopeManager.getScope(status.getCurrentScope());
String reportID = ManagementUtils.addToExistingScope(type,
resourceIDs.toArray(new String[]{}),
sourceScope,
targetScope);
ReportingPortType manager =
ResourceFactory.createResourceManager(type).getReportResourceManager(targetScope);
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);
GCUBEScope targetScope = ScopeManager.getScope(scope);
GCUBEScope sourceScope = ScopeManager.getScope(status.getCurrentScope());
return new Tuple<String>(ManagementUtils.removeFromExistingScope(type,
resourceIDs.toArray(new String[]{}),
sourceScope,
targetScope));
}
public final String deploy(final List<String> ghnsID, final List<String> servicesID) throws Exception {
try {
GCUBEScope sourceScope = ScopeManager.getScope(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())) {
GCUBEScope sourceScope = ScopeManager.getScope(scope);
ReportingPortType manager =
ResourceFactory.createResourceManager(AllowedResourceTypes.Service).getReportResourceManager(sourceScope);
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");
GWT.log("The CONTEXT PATH is: " + this.getScopeDataPath());
Vector<String> retval = new Vector<String>();
try {
Map<String, GCUBEScope> scopes = ScopeManager.getAvailableScopes();
for (GCUBEScope scope : scopes.values()) {
//if ((scope.getType().compareTo(Type.INFRASTRUCTURE) == 0)
// || (scope.getType().compareTo(Type.VO) == 0)) {
retval.add(scope.toString());
//}
}
return retval;
} catch (Exception e) {
retval.add("/gcube");
retval.add("/gcube/devsec");
}
return retval;
}
public final List<String> getAvailableAddScopes() {
List<String> retval = new Vector<String>();
try {
GCUBEScope currScope = ScopeManager.getScope(this.getCurrentStatus().getCurrentScope());
List<String> scopes = this.getAvailableScopes();
for (String scope : scopes) {
GCUBEScope trgScope = ScopeManager.getScope(scope);
if (trgScope.isEnclosedIn(currScope)) {
retval.add(trgScope.toString());
}
}
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 {
GCUBEScope gscope = ScopeManager.getScope(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,
ScopeManager.getScope(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()),
ScopeManager.getScope(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 GCUBEScope scope, final String resID)
throws Exception {
ISClient client = GHNContext.getImplementation(ISClient.class);
GCUBEGenericQuery isQuery = null;
isQuery = client.getQuery(GCUBEGenericQuery.class);
isQuery.setExpression(QueryLoader.getQuery(QueryLocation.GET_RESOURCE_BYID));
isQuery.addParameters(
new QueryParameter("RES_ID", resID),
new QueryParameter("RES_TYPE", ResourceTypeDecorator.GenericResource.name())
);
List<XMLResult> results = client.execute(isQuery, scope);
if (results != null && results.size() > 0) {
ResourceDescriptor retval = new ResourceDescriptor();
XMLResult node = results.get(0);
List<String> currValue = null;
currValue = node.evaluate("/Resource/ID/text()");
if (currValue != null && currValue.size() > 0) {
retval.setID(currValue.get(0));
}
currValue = node.evaluate("/Resource/Profile/Name/text()");
if (currValue != null && currValue.size() > 0) {
retval.setName(currValue.get(0));
}
currValue = node.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 = node.evaluate("/Resource/Profile/Description/text()");
if (currValue != null && currValue.size() > 0) {
retval.set("Description", currValue.get(0));
} else {
retval.set("Description", "");
}
currValue = node.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(ScopeManager.getScope(scope), type, subType, additionalMaps);
}
public final List<String> getWSResources(final String scope) {
try {
return ISClientRequester.getWSResources(ScopeManager.getScope(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()),
ScopeManager.getScope(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(),
ScopeManager.getScope(scope),
type,
resID);
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,
ScopeManager.getScope(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"));
GCUBEScope sourceScope = ScopeManager.getScope(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()));
}
public final HashMap<String, ArrayList<TMPluginFormField>> getGenericResourceTreeMagnagerPlugins() throws Exception {
return ISClientRequester.getGenericResourceTreeManagerPlugins(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());
}
}
}

View File

@ -0,0 +1,165 @@
/****************************************************************************
* 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: MailSender.java
****************************************************************************
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
***************************************************************************/
package org.gcube.portlets.admin.resourcemanagement.server.gcube.services;
import java.io.File;
import java.util.Date;
import java.util.List;
import java.util.Properties;
import java.util.StringTokenizer;
import java.util.Vector;
import javax.activation.DataHandler;
import javax.activation.FileDataSource;
import javax.mail.Authenticator;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Multipart;
import javax.mail.NoSuchProviderException;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
import org.gcube.resourcemanagement.support.server.utils.ServerConsole;
/**
* @author Daniele Strollo (ISTI-CNR)
*
*/
public class MailSender {
private static final String LOG_PREFIX = "[RPM-SENDMAIL]";
/**
* Given a list of addresses in the form addr1;addr2...
* builds the list of InternetAddress to use to send mail.
* @param toParse a string of email addresses of the form addr1;addr2...
* @return the array of converted valid email addresses
*/
private static InternetAddress[] buildAddress(final String toParse) {
if (toParse == null || toParse.trim().length() == 0) {
return null;
}
List<InternetAddress> toReturn = new Vector<InternetAddress>();
StringTokenizer parser = new StringTokenizer(toParse, ";");
while (parser.hasMoreTokens()) {
try {
toReturn.add(new InternetAddress(parser.nextToken()));
} catch (AddressException e) {
ServerConsole.error(LOG_PREFIX, e);
}
}
return toReturn.toArray(new InternetAddress[]{});
}
public static void sendMail(
final String sender,
final String target,
final String cc,
final String subject,
final String bodyText,
final String[] attachments) throws Exception {
if ((target == null || target.trim().length() == 0)
&& (cc == null || cc.trim().length() == 0)) {
ServerConsole.warn(LOG_PREFIX, "No valid mail recipients specified.");
return;
}
Properties properties = new Properties();
properties.setProperty("mail.transport.protocol", "smtp");
properties.put("mail.host", "smtp.isti.cnr.it");
properties.put("mail.port", "587");
properties.put("mail.auth", "true");
properties.put("mail.smtps.auth", "true");
properties.put("mail.smtp.auth", "true");
Session session = Session.getDefaultInstance(properties,
new Authenticator() {
public PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication("smtp-user", "UiBe7chae7eh");
}
});
Transport transport = null;
try {
transport = session.getTransport();
} catch (NoSuchProviderException e) {
throw e;
}
try {
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(sender));
// MAIL - TO
InternetAddress[] addressTo = MailSender.buildAddress(target);
if (addressTo != null) {
message.setRecipients(Message.RecipientType.TO, addressTo);
}
// MAIL - CC
InternetAddress[] addressCC = MailSender.buildAddress(cc);
if (addressCC != null) {
message.setRecipients(Message.RecipientType.CC, addressCC);
}
message.setSubject(subject);
message.setSentDate(new Date());
//
// Set the email message text.
//
MimeBodyPart messagePart = new MimeBodyPart();
messagePart.setText(bodyText);
//
// Set the email attachment file
//
Multipart multipart = new MimeMultipart();
multipart.addBodyPart(messagePart);
for (String filename : attachments) {
MimeBodyPart attachmentPart = new MimeBodyPart();
FileDataSource fileDataSource = new FileDataSource(filename) {
@Override
public String getContentType() {
return "application/octet-stream";
}
};
attachmentPart.setDataHandler(new DataHandler(fileDataSource));
attachmentPart.setFileName(new File(filename).getName());
multipart.addBodyPart(attachmentPart);
}
message.setContent(multipart);
transport.connect();
// FIXME waiting new mail implementation (skipping liferay mail.jar) with CC support.
transport.sendMessage(message,
message.getRecipients(Message.RecipientType.TO));
transport.close();
} catch (MessagingException e) {
e.printStackTrace();
}
}
}

View File

@ -0,0 +1,164 @@
/****************************************************************************
* 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.liferay.LiferayRoleManager;
import org.gcube.vomanagement.usermanagement.impl.liferay.LiferayUserManager;
import org.gcube.vomanagement.usermanagement.model.RoleModel;
import org.gcube.vomanagement.usermanagement.model.UserModel;
/**
* @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<RoleModel> roles = null;
// Gets the user email. If not provided the default one will be used.
// The mail will be store inside the session.
UserModel umodel = uman.getUserByScreenName(username);
session.setAttribute(USER_EMAIL_KEY, umodel.getEmail());
roles = rman.listRolesByUserAndGroup(
String.valueOf(aslSession.getGroupId()),
uman.getUserByScreenName(username).getUserId());
for (RoleModel 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);
}
}
}

View File

@ -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));
}
}

View File

@ -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";
}

View File

@ -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
}
}

View File

@ -0,0 +1,39 @@
/****************************************************************************
* 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: Configuration.java
****************************************************************************
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
***************************************************************************/
package org.gcube.portlets.admin.resourcemanagement.shared;
/**
* The client side UI configuration.
* @author Daniele Strollo (ISTI-CNR)
*/
public class Configuration {
// Delay of popups in mills
public static final int popupDelay = 4000;
// Configuration parameters that can be changed through options
// menu.
public static boolean openProfileOnLoad = false;
public static boolean allowMultipleProfiles = false;
//public static String scopeFile = null;
public static final String SUPER_USER_CODE = "gcube2010";
/*
* Forces to use flash based charts also in portal mode.
* Due to conflicts in the portal with the flash based
* charts this functionality usually is avoided.
*/
public static final boolean DISABLE_FLASH = false;
}

View File

@ -0,0 +1,44 @@
/****************************************************************************
* 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: InvalidPermissionsException.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 InvalidPermissionsException extends Exception implements IsSerializable {
private static final long serialVersionUID = 1L;
public InvalidPermissionsException() {
super();
}
public InvalidPermissionsException(String message, Throwable cause) {
super(message, cause);
}
public InvalidPermissionsException(String message) {
super(message);
}
public InvalidPermissionsException(Throwable cause) {
super(cause);
}
}

View File

@ -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);
}
}

View File

@ -0,0 +1,57 @@
/****************************************************************************
* 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: DelayedOperation.java
****************************************************************************
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
***************************************************************************/
package org.gcube.portlets.admin.resourcemanagement.shared.utils;
import com.google.gwt.user.client.Timer;
/**
* Performs a delayed action on client side.
* Usage:
* <pre>
* new DelayedOperation() {
* // @Override
* public void doJob() {
* // Here the code...
* }
* }.start(5000); // the operation will start after 5 secs.
* </pre>
* @author Daniele Strollo (ISTI-CNR)
*/
public abstract class DelayedOperation {
public final void start(final int delayMills) {
Timer t = new Timer() {
@Override
public void run() {
doJob();
}
};
t.schedule(delayMills);
}
public final void loop(final int delayMills) {
Timer t = new Timer() {
@Override
public void run() {
doJob();
this.schedule(delayMills);
}
};
t.schedule(delayMills);
}
public abstract void doJob();
}

View File

@ -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();
}
}

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='resourcemanagementportlet'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />
<!-- We need the JUnit module in the main module, -->
<!-- otherwise eclipse complains (Google plugin bug?) -->
<inherits name='com.google.gwt.junit.JUnit' />
<!-- <set-property name="user.agent" value="gecko1_8" /> -->
<inherits name='org.gcube.resourcemanagement.support.Resource_support' />
<!-- Other module inherits -->
<inherits name='com.extjs.gxt.ui.GXT' />
<inherits name='com.extjs.gxt.themes.Themes' />
<!-- inherits Software Uplad Widget -->
<inherits
name='org.gcube.portlets.admin.software_upload_wizard.SoftwareUploadWizard' />
<!-- 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' />
<entry-point
class='org.gcube.portlets.admin.resourcemanagement.client.ResourceManagementPortlet' />
<!-- Specify the paths for translatable code -->
<source path='client' />
<source path='shared' />
</module>

View File

@ -0,0 +1,311 @@
/* Comment import to style regular, uncomment if deploying on openbio or d4science.org */
/*@import url(openbio.css);*/
/*@import url(d4scienceOrg.css);*/
/* Fix the scrollbar background style*/
.x-progress-text div {
background-color: transparent !important;
font-size: 11px;
font-weight: bold;
}
.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;
}
.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;
}
.resources-icon {
background-image: url(images/icons/world.png) !important;
}
.wsresources-icon {
background-image: url(images/icons/page_white_world.png) !important;
}
.ghn-icon {
background-image: url(images/icons/server.png) !important;
}
.defaultleaf-icon {
background-image: url(images/icons/grid.png) !important;
}
.collection-icon {
background-image: url(images/icons/folder_database.png) !important;
}
.genericresource-icon {
background-image: url(images/icons/plugin.png) !important;
}
.runtimeresource-icon {
background-image: url(images/icons/application_cascade.png) !important;
}
.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;
}
.runninginstance-icon {
background-image: url(images/icons/cog_go.png) !important;
}
.service-icon {
background-image: url(images/icons/cog.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;
}

View File

@ -0,0 +1,118 @@
<!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>
<style>
a:hover {
opacity: 0.7;
}
.footer {
margin-top: 10px;
position: relative;
width: 100%;
background-color: #99CC33;
clear: both;
color: #FFFFFF;
height: 20px;
text-align: center;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 1em;
font-size-adjust: none;
font-style: normal;
font-variant: normal;
font-weight: normal;
}
.ec {
font-family: arial, sans-serif;
position: relative;
width: 100%;
background-color: white;
clear: both;
text-align: center;
}
.slogan {
font-family: arial, sans-serif;
color: #666666;
font-size: 12px;
text-align: right;
border-bottom: 1px solid #DDDDDD;
}
</style>
<!-- -->
<!-- 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 TOPMARGIN=0 LEFTMARGIN=0>
<table class="slogan" cellspacing="0" cellpadding="0" border="0"
width="100%" height="20px">
<tr>
<td colspan="2" height="5" bgcolor="#3399CC" />
</tr>
<tr>
<td colspan="2" height="5" bgcolor="#000080" />
</tr>
<tr>
<td align="left">&nbsp;&nbsp;<img style="padding-top: 5px;" src="mask_images/D4ScienceInfrastructure.png" />
</td>
<td align="right">&nbsp;&nbsp;<a target="_blank" href="http://www.gcube-system.org"><img style="padding-top: 5px;" src="mask_images/gCube.png" /></a>
</td>
</tr>
</table>
<div style="display: block">
<div style="margin-top: 5px; margin-left: 5px;" id="MyUniqueDIV"></div>
<div class="footer">
</div>
<div class="ec"><a style="color: #FFFFFF;"
href="http://europa.eu/index_en.htm" target="_blank" linkindex="36"
set="yes"><img hspace="5" align="absmiddle"
src="mask_images/eu.jpg" alt="EU" /></a> <a style="color: #FFFFFF;"
href="http://cordis.europa.eu/fp7/ict/e-infrastructure/home_en.html"
target="_blank" linkindex="37" set="yes"><img hspace="5"
align="absmiddle" src="mask_images/e_infrastructure.gif"
alt="FP7 e-Infrastructures" /></a> <a style="color: #FFFFFF;"
href="http://cordis.europa.eu/fp7/capacities/home_en.html"
target="_blank" linkindex="38" set="yes"><img hspace="5"
align="absmiddle" src="mask_images/7_capacities.gif"
alt="FP7 Capacities programme" /></a></div>
</div>
</body>
</html>

View File

@ -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>

View File

@ -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>

View File

@ -0,0 +1,18 @@
<%@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" />
<script type="text/javascript" language="javascript" src="<%=request.getContextPath()%>/resourcemanagementportlet/resourcemanagementportlet.nocache.js"></script>
<div id="MyUniqueDIV" class="portlet-wrapper"></div>

View File

@ -0,0 +1,8 @@
<?xml version="1.0"?>
<!DOCTYPE display PUBLIC "-//Liferay//DTD Display 5.2.0//EN" "http://www.liferay.com/dtd/liferay-display_5_2_0.dtd">
<display>
<category name="gCube Applications">
<portlet id="resources-management" />
</category>
</display>

View File

@ -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=

View File

@ -0,0 +1,28 @@
<?xml version="1.0"?>
<!DOCTYPE liferay-portlet-app PUBLIC "-//Liferay//DTD Portlet Application 5.2.0//EN" "http://www.liferay.com/dtd/liferay-portlet-app_5_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>

View File

@ -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>

View File

@ -0,0 +1,72 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_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>
<!-- SUW -->
<filter>
<filter-name>guiceFilter</filter-name>
<filter-class>com.google.inject.servlet.GuiceFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>guiceFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>org.gcube.portlets.admin.software_upload_wizard.server.BootstrapListener</listener-class>
</listener>
<!-- 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>

View File

@ -0,0 +1,56 @@
<?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/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/Ecosystem</name>
<src>ServiceMap_Ecosystem.xml</src>
<scope>/d4science.research-infrastructures.eu/Ecosystem</scope>
</vo>
<vo>
<name>d4science/EUBrazilOpenBio</name>
<src>ServiceMap_EUBrazilOpenBio.xml</src>
<scope>/d4science.research-infrastructures.eu/EUBrazilOpenBio</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>
</vos>
</infrastructure>
</infrastructures>

View File

@ -0,0 +1,56 @@
<?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/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/Ecosystem</name>
<src>ServiceMap_Ecosystem.xml</src>
<scope>/d4science.research-infrastructures.eu/Ecosystem</scope>
</vo>
<vo>
<name>d4science/EUBrazilOpenBio</name>
<src>ServiceMap_EUBrazilOpenBio.xml</src>
<scope>/d4science.research-infrastructures.eu/EUBrazilOpenBio</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>
</vos>
</infrastructure>
</infrastructures>

View File

@ -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>&#xA;</xsl:text>
<xsl:comment>
<xsl:text> converted by xmlverbatim.xsl 1.1, (c) O. Becker </xsl:text>
</xsl:comment>
<xsl:text>&#xA;</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>&#xA;</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="'&#xA0;&#xA0;&#xA0;'" />
<xsl:if test="$indent-elements">
<br/>
<xsl:value-of select="$indent" />
</xsl:if>
<xsl:text>&lt;</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>=&quot;&quot;</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>&gt;</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>&lt;/</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>&gt;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text> /&gt;</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="not(parent::*)"><br /><xsl:text>&#xA;</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>=&quot;</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>&quot;</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>=&quot;</xsl:text>
<span class="xmlverb-ns-uri">
<xsl:value-of select="."/>
</span>
<xsl:text>&quot;</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>&lt;!--</xsl:text>
<span class="xmlverb-comment">
<xsl:call-template name="preformatted-output">
<xsl:with-param name="text" select="." />
</xsl:call-template>
</span>
<xsl:text>--&gt;</xsl:text>
<xsl:if test="not(parent::*)"><br /><xsl:text>&#xA;</xsl:text></xsl:if>
</xsl:template>
<!-- processing instructions -->
<xsl:template match="processing-instruction()" mode="xmlverb">
<xsl:text>&lt;?</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>?&gt;</xsl:text>
<xsl:if test="not(parent::*)"><br /><xsl:text>&#xA;</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="'&gt;'" />
<xsl:with-param name="to" select="'&amp;gt;'" />
<xsl:with-param name="value">
<xsl:call-template name="replace-substring">
<xsl:with-param name="from" select="'&lt;'" />
<xsl:with-param name="to" select="'&amp;lt;'" />
<xsl:with-param name="value">
<xsl:call-template name="replace-substring">
<xsl:with-param name="from"
select="'&amp;'" />
<xsl:with-param name="to"
select="'&amp;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="'&#xA;'" />
<xsl:with-param name="to" select="'&amp;#xA;'" />
<xsl:with-param name="value">
<xsl:call-template name="replace-substring">
<xsl:with-param name="from"
select="'&quot;'" />
<xsl:with-param name="to"
select="'&amp;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 &nbsp;, tab as 8 &nbsp;
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,' ','&#xA0;')" />
<xsl:with-param name="from" select="'&#9;'" />
<xsl:with-param name="to"
select="'&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;'" />
</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,'&#xA;')">
<xsl:value-of select="substring-before($text,'&#xA;')" />
<br />
<xsl:text>&#xA;</xsl:text>
<xsl:call-template name="output-nl">
<xsl:with-param name="text"
select="substring-after($text,'&#xA;')" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

View File

@ -0,0 +1,33 @@
# The user and its credentials
# Possible values for credentials:
# [USER,ADMIN,DEBUG]
USER_CREDENTIALS = ADMIN
# 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

View File

@ -0,0 +1,10 @@
#wrapper {
font: 11px/1.5 "Lucida Grande", "Lucida Sans Unicode", Arial, Verdana, sans-serif;
margin: 0 auto;
width: 90% !important;
}
#bottombar {
margin: 0 auto;
width: 100% !important;
}

File diff suppressed because it is too large Load Diff

View File

@ -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;
}

View File

@ -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;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 996 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 967 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 513 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 842 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 992 B

Some files were not shown because too many files have changed in this diff Show More