Initial import from private svn
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/widgets/ws-thredds-sync-widget@164683 82a268e6-3cf1-43bd-a215-b396298e98cfpull/1/head
parent
ae86eb84dc
commit
7488d32cd1
@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry including="**/*.java" kind="src" output="target/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" 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 excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||
<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"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>ws-thredds-sync-widget</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.common.project.facet.core.builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.gwtplugins.gdt.eclipse.core.webAppProjectValidator</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.gwtplugins.gwt.eclipse.core.gwtProjectValidator</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.validation.validationbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
||||
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
||||
<nature>com.gwtplugins.gwt.eclipse.core.gwtNature</nature>
|
||||
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src/main/webapp"/>
|
||||
<classpathentry excluding="**/bower_components/*|**/node_modules/*|**/*.min.js" kind="src" path="target/m2e-wtp/web-resources"/>
|
||||
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
|
||||
<attributes>
|
||||
<attribute name="hide" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
|
||||
<classpathentry kind="output" path=""/>
|
||||
</classpath>
|
@ -0,0 +1,4 @@
|
||||
eclipse.preferences.version=1
|
||||
lastWarOutDir=/home/francesco-mangiacrapa/eclipse-oxygen/ws-thredds-sync-widget/target/ws-thredds-sync-widget-0.0.1-SNAPSHOT
|
||||
warSrcDir=src/main/webapp
|
||||
warSrcDirIsOutput=false
|
@ -0,0 +1,6 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding//src/main/java=UTF-8
|
||||
encoding//src/main/resources=UTF-8
|
||||
encoding//src/test/java=UTF-8
|
||||
encoding//src/test/resources=UTF-8
|
||||
encoding/<project>=UTF-8
|
@ -0,0 +1,8 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
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.8
|
@ -0,0 +1,4 @@
|
||||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
resolveWorkspaceProjects=true
|
||||
version=1
|
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||
<wb-module deploy-name="ws-thredds-sync-widget-0.0.1-SNAPSHOT">
|
||||
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
||||
<property name="context-root" value="ws-thredds-sync-widget"/>
|
||||
<property name="java-output-path" value="/ws-thredds-sync-widget/target/ws-thredds-sync-widget-0.0.1-SNAPSHOT/WEB-INF/classes"/>
|
||||
</wb-module>
|
||||
</project-modules>
|
@ -0,0 +1,7 @@
|
||||
<root>
|
||||
<facet id="jst.jaxrs">
|
||||
<node name="libprov">
|
||||
<attribute name="provider-id" value="jaxrs-no-op-library-provider"/>
|
||||
</node>
|
||||
</facet>
|
||||
</root>
|
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<faceted-project>
|
||||
<fixed facet="wst.jsdt.web"/>
|
||||
<installed facet="jst.web" version="2.3"/>
|
||||
<installed facet="com.gwtplugins.gwt.facet" version="1.0"/>
|
||||
<installed facet="wst.jsdt.web" version="1.0"/>
|
||||
<installed facet="java" version="1.7"/>
|
||||
<installed facet="jst.jaxrs" version="2.0"/>
|
||||
</faceted-project>
|
@ -0,0 +1 @@
|
||||
org.eclipse.wst.jsdt.launching.baseBrowserLibrary
|
@ -0,0 +1 @@
|
||||
Window
|
@ -0,0 +1,2 @@
|
||||
disabled=06target
|
||||
eclipse.preferences.version=1
|
@ -0,0 +1 @@
|
||||
${gcube.license}
|
@ -0,0 +1,60 @@
|
||||
The gCube System - ${name}
|
||||
--------------------------------------------------
|
||||
|
||||
${description}
|
||||
|
||||
|
||||
${gcube.description}
|
||||
|
||||
${gcube.funding}
|
||||
|
||||
|
||||
Version
|
||||
--------------------------------------------------
|
||||
|
||||
${version} (${buildDate})
|
||||
|
||||
Please see the file named "changelog.xml" in this directory for the release notes.
|
||||
|
||||
|
||||
Authors
|
||||
--------------------------------------------------
|
||||
|
||||
* Francesco Mangiacrapa (francesco.mangiacrapa-AT-isti.cnr.it), Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" - CNR, Pisa (Italy).
|
||||
|
||||
Maintainers
|
||||
-----------
|
||||
|
||||
* Francesco Mangiacrapa (francesco.mangiacrapa-AT-isti.cnr.it), Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" - CNR, Pisa (Italy).
|
||||
|
||||
Download information
|
||||
--------------------------------------------------
|
||||
|
||||
Source code is available from SVN:
|
||||
${scm.url}
|
||||
|
||||
Binaries can be downloaded from the gCube website:
|
||||
${gcube.website}
|
||||
|
||||
|
||||
Installation
|
||||
--------------------------------------------------
|
||||
|
||||
|
||||
Documentation
|
||||
--------------------------------------------------
|
||||
|
||||
Documentation is available on-line in the gCube Wiki:
|
||||
${gcube.wikiRoot}/gcube/GCube_Widgets_Store
|
||||
|
||||
Support
|
||||
--------------------------------------------------
|
||||
|
||||
Bugs and support requests can be reported in the gCube issue tracking tool:
|
||||
${gcube.issueTracking}
|
||||
|
||||
|
||||
Licensing
|
||||
--------------------------------------------------
|
||||
|
||||
This software is licensed under the terms you may find in the file named "LICENSE" in this directory.
|
@ -0,0 +1,6 @@
|
||||
<ReleaseNotes>
|
||||
<Changeset component="org.gcube.portlets-widgets.ws-thredds-sync-widget.1-0-0"
|
||||
date="2018-02-07">
|
||||
<Change>First Release</Change>
|
||||
</Changeset>
|
||||
</ReleaseNotes>
|
@ -0,0 +1,32 @@
|
||||
<assembly
|
||||
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
|
||||
<id>servicearchive</id>
|
||||
<formats>
|
||||
<format>tar.gz</format>
|
||||
</formats>
|
||||
<baseDirectory>/</baseDirectory>
|
||||
<fileSets>
|
||||
<fileSet>
|
||||
<directory>${distroDirectory}</directory>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
<useDefaultExcludes>true</useDefaultExcludes>
|
||||
<includes>
|
||||
<include>README</include>
|
||||
<include>LICENSE</include>
|
||||
<include>changelog.xml</include>
|
||||
<include>profile.xml</include>
|
||||
</includes>
|
||||
<fileMode>755</fileMode>
|
||||
<filtered>true</filtered>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
<files>
|
||||
<file>
|
||||
<source>target/${build.finalName}.${project.packaging}</source>
|
||||
<outputDirectory>/${artifactId}</outputDirectory>
|
||||
</file>
|
||||
|
||||
</files>
|
||||
</assembly>
|
@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<ID></ID>
|
||||
<Type>Library</Type>
|
||||
<Profile>
|
||||
<Description>${description}</Description>
|
||||
<Class>PortletsWidgets</Class>
|
||||
<Name>${artifactId}</Name>
|
||||
<Version>1.0.0</Version>
|
||||
<Packages>
|
||||
<Software>
|
||||
<Name>${artifactId}</Name>
|
||||
<Version>${version}</Version>
|
||||
<MavenCoordinates>
|
||||
<groupId>${groupId}</groupId>
|
||||
<artifactId>${artifactId}</artifactId>
|
||||
<version>${version}</version>
|
||||
</MavenCoordinates>
|
||||
<Files>
|
||||
<File>${build.finalName}.jar</File>
|
||||
</Files>
|
||||
</Software>
|
||||
</Packages>
|
||||
</Profile>
|
||||
</Resource>
|
@ -0,0 +1,232 @@
|
||||
<?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.widgets</groupId>
|
||||
<artifactId>ws-thredds-sync-widget</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>ws-thredds-sync-widget</name>
|
||||
<description>
|
||||
gCube ws-thredds-sync-widget is a widget to use and interact with ws-thredds facility in order to syncronize the Workspace folders with Thredds Reporitory folders
|
||||
</description>
|
||||
|
||||
<scm>
|
||||
<connection>scm:svn:http://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/${project.artifactId}</connection>
|
||||
<developerConnection>scm:https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/${project.artifactId}</developerConnection>
|
||||
<url>http://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/${project.artifactId}</url>
|
||||
</scm>
|
||||
|
||||
<properties>
|
||||
<!-- Convenience property to set the GWT version -->
|
||||
<gwtVersion>2.7.0</gwtVersion>
|
||||
<distroDirectory>distro</distroDirectory>
|
||||
<!-- GWT needs at least java 1.6 -->
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<!-- <additionalparam>-Xdoclint:none</additionalparam> -->
|
||||
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.gcube.distribution</groupId>
|
||||
<artifactId>maven-portal-bom</artifactId>
|
||||
<version>LATEST</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.google.gwt</groupId>
|
||||
<artifactId>gwt-user</artifactId>
|
||||
<version>${gwtVersion}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.gwtbootstrap</groupId>
|
||||
<artifactId>gwt-bootstrap</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- PORTAL MANAGER -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.common.portal</groupId>
|
||||
<artifactId>portal-manager</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.liferay.portal</groupId>
|
||||
<artifactId>portal-service</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- User Management Core -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.dvos</groupId>
|
||||
<artifactId>usermanagement-core</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.portal</groupId>
|
||||
<artifactId>ws-synchronized-module-library</artifactId>
|
||||
<version>[0.0.1-SNAPSHOT, 1.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency> -->
|
||||
<!-- <groupId>org.gcube.spatial-data</groupId> -->
|
||||
<!-- <artifactId>ws-thredds</artifactId> -->
|
||||
<!-- <version>[0.0.1-SNAPSHOT, 1.0.0-SNAPSHOT)</version> -->
|
||||
<!-- <scope>compile</scope> -->
|
||||
<!-- </dependency> -->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>authorization-client</artifactId>
|
||||
<version>[2.0.0-SNAPSHOT, 3-0-0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<!-- LOGGER -->
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.11</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/java</directory>
|
||||
<includes>
|
||||
<include>**/*.*</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>${maven.compiler.source}</source>
|
||||
<target>${maven.compiler.target}</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>test-jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.12</version>
|
||||
<configuration>
|
||||
<skipTests>true</skipTests>
|
||||
</configuration>
|
||||
</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>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>2.2</version>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>${distroDirectory}/descriptor.xml</descriptor>
|
||||
</descriptors>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>fully.qualified.MainClass</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>servicearchive</id>
|
||||
<phase>install</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- GWT Maven Plugin - not needed -->
|
||||
<!-- GWT Maven Plugin -->
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>gwt-maven-plugin</artifactId>
|
||||
<version>${gwtVersion}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<!-- <goal>compile</goal> -->
|
||||
<!-- <goal>test</goal> -->
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module rename-to='WsThreddsWidget'>
|
||||
<!-- Inherit the core Web Toolkit stuff. -->
|
||||
<inherits name='com.google.gwt.user.User' />
|
||||
|
||||
<!-- Inherit the default GWT style sheet. You can change -->
|
||||
<!-- the theme of your GWT application by uncommenting -->
|
||||
<!-- any one of the following lines. -->
|
||||
<inherits name='com.google.gwt.user.theme.standard.Standard' />
|
||||
<inherits name="com.github.gwtbootstrap.Bootstrap" />
|
||||
<inherits name="org.gcube.portal.wssynclibrary.WsSyncLibrary" />
|
||||
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
|
||||
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
|
||||
|
||||
<!-- Other module inherits -->
|
||||
|
||||
<!-- Specify the app entry point class. -->
|
||||
<!-- <entry-point class='org.gcube.portlets.widgets.wsthreddssync.client.WsThreddsWidget'
|
||||
/> -->
|
||||
|
||||
<!-- Specify the application specific style sheet. -->
|
||||
<stylesheet src='WsThreddsWidget.css' />
|
||||
|
||||
<!-- Specify the paths for translatable code -->
|
||||
<source path='client' />
|
||||
<source path='shared' />
|
||||
|
||||
</module>
|
@ -0,0 +1,35 @@
|
||||
package org.gcube.portlets.widgets.wsthreddssync.client;
|
||||
//package org.gcube.portlets.widgets.wsthreddssync.client;
|
||||
//
|
||||
//import org.gcube.portlets.widgets.wsthreddssync.client.rpc.ThreddsWorkspaceSyncService;
|
||||
//import org.gcube.portlets.widgets.wsthreddssync.client.rpc.ThreddsWorkspaceSyncServiceAsync;
|
||||
//
|
||||
//import com.google.gwt.core.client.EntryPoint;
|
||||
//import com.google.gwt.core.client.GWT;
|
||||
//
|
||||
//// TODO: Auto-generated Javadoc
|
||||
///**
|
||||
// * Entry point classes define <code>onModuleLoad()</code>.
|
||||
// *
|
||||
// * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
// * Feb 14, 2018
|
||||
// */
|
||||
//public class WsThreddsSyncWidget implements EntryPoint {
|
||||
// /**
|
||||
// * The message displayed to the user when the server cannot be reached or
|
||||
// * returns an error.
|
||||
// */
|
||||
// private static final String SERVER_ERROR = "An error occurred while "
|
||||
// + "attempting to contact the server. Please check your network "
|
||||
// + "connection and try again.";
|
||||
//
|
||||
// /** The ws thredds sync service. */
|
||||
// private final ThreddsWorkspaceSyncServiceAsync wsThreddsSyncService = GWT.create(ThreddsWorkspaceSyncService.class);
|
||||
//
|
||||
// /**
|
||||
// * This is the entry point method.
|
||||
// */
|
||||
// public void onModuleLoad() {
|
||||
//
|
||||
// }
|
||||
//}
|
@ -0,0 +1,164 @@
|
||||
package org.gcube.portlets.widgets.wsthreddssync.client;
|
||||
|
||||
import org.gcube.portal.wssynclibrary.shared.thredds.ThSyncStatus;
|
||||
import org.gcube.portlets.widgets.wsthreddssync.client.event.PerformDoSyncEvent;
|
||||
import org.gcube.portlets.widgets.wsthreddssync.client.event.PerformDoSyncEventHandler;
|
||||
import org.gcube.portlets.widgets.wsthreddssync.client.event.ShowMonitorSyncStatusEvent;
|
||||
import org.gcube.portlets.widgets.wsthreddssync.client.event.ShowMonitorSyncStatusEventHandler;
|
||||
import org.gcube.portlets.widgets.wsthreddssync.client.rpc.ThreddsWorkspaceSyncServiceAsync;
|
||||
import org.gcube.portlets.widgets.wsthreddssync.client.view.LoaderIcon;
|
||||
import org.gcube.portlets.widgets.wsthreddssync.client.view.WsThreddsWidgetViewManager;
|
||||
import org.gcube.portlets.widgets.wsthreddssync.client.view.binder.MonitorFolderSyncStatusView;
|
||||
import org.gcube.portlets.widgets.wsthreddssync.shared.WsFolder;
|
||||
import org.gcube.portlets.widgets.wsthreddssync.shared.WsThreddsSynchFolderConfiguration;
|
||||
import org.gcube.portlets.widgets.wsthreddssync.shared.WsThreddsSynchFolderDescriptor;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Modal;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.shared.HandlerManager;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class WsThreddsWidget.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Feb 14, 2018
|
||||
*/
|
||||
public class WsThreddsWidget {
|
||||
|
||||
/** The ws thredds sync service. */
|
||||
public static final ThreddsWorkspaceSyncServiceAsync wsThreddsSyncService = ThreddsWorkspaceSyncServiceAsync.Util.getInstance();
|
||||
|
||||
/** The Constant eventBus. */
|
||||
public final static HandlerManager eventBus = new HandlerManager(null);
|
||||
|
||||
private WsThreddsWidgetViewManager viewManager = new WsThreddsWidgetViewManager();
|
||||
|
||||
/**
|
||||
* This is the entry point method.
|
||||
*/
|
||||
public WsThreddsWidget() {
|
||||
bindEvents();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Bind events.
|
||||
*/
|
||||
private void bindEvents() {
|
||||
|
||||
eventBus.addHandler(PerformDoSyncEvent.TYPE, new PerformDoSyncEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onPerformDoSync(PerformDoSyncEvent performDoSyncEvent) {
|
||||
|
||||
if(performDoSyncEvent.getFolder()!=null)
|
||||
|
||||
performFolderSync(performDoSyncEvent.getFolder(), performDoSyncEvent.getConf());
|
||||
}
|
||||
});
|
||||
|
||||
eventBus.addHandler(ShowMonitorSyncStatusEvent.TYPE, new ShowMonitorSyncStatusEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onShowMonitorSyncStatus(ShowMonitorSyncStatusEvent showSyncStatusEvent) {
|
||||
|
||||
if(showSyncStatusEvent.getFolder()!=null)
|
||||
|
||||
viewManager.showMonitorSyncToFolder(showSyncStatusEvent.getFolder());
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show sync folder info.
|
||||
*
|
||||
* @param folder the folder
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
public void showSyncFolderInfo(final WsFolder folder) throws Exception {
|
||||
|
||||
if(folder==null || folder.getFolderId()==null)
|
||||
throw new Exception("Invalid parameter folder null");
|
||||
|
||||
|
||||
MonitorFolderSyncStatusView monitor = viewManager.getMonitor(folder);
|
||||
|
||||
//SHOWING CURRENT ACTIVE MONITOR
|
||||
if(monitor!=null) {
|
||||
GWT.log("Monitor for folder: "+folder.getFolderId() +" exists showing it..");
|
||||
viewManager.showMonitorSyncToFolder(folder);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
GWT.log("Performing isItemSynched: "+folder.getFolderId());
|
||||
final Modal box = new Modal(true);
|
||||
box.setTitle("Checking configurations...");
|
||||
LoaderIcon loader = new LoaderIcon("Checking folder configurations...");
|
||||
box.add(loader);
|
||||
|
||||
WsThreddsWidget.wsThreddsSyncService.isItemSynched(folder.getFolderId(), new AsyncCallback<WsThreddsSynchFolderDescriptor>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(WsThreddsSynchFolderDescriptor result) {
|
||||
box.hide();
|
||||
//GWT.log("WsThreddsSynchFolderDescriptor result: "+result);
|
||||
viewManager.showThreddsFolderInfo(folder, result);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
viewManager.cancelMonitor(folder);
|
||||
box.hide();
|
||||
// TODO Auto-generated method stub
|
||||
Window.alert(caught.getMessage());
|
||||
}
|
||||
});
|
||||
|
||||
box.show();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Perform folder sync.
|
||||
*
|
||||
* @param folder the folder
|
||||
* @param config the config
|
||||
*/
|
||||
private void performFolderSync(final WsFolder folder, WsThreddsSynchFolderConfiguration config) {
|
||||
|
||||
GWT.log("Performing doSyncFolder on: "+folder);
|
||||
final Modal box = new Modal(true);
|
||||
box.setTitle("Starting synchronization...");
|
||||
LoaderIcon loader = new LoaderIcon("Inizializiting synchronization to the folder: "+folder.getFoderName());
|
||||
box.add(loader);
|
||||
|
||||
wsThreddsSyncService.doSyncFolder(folder.getFolderId(), config, new AsyncCallback<ThSyncStatus>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
Window.alert(caught.getMessage());
|
||||
viewManager.cancelMonitor(folder);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(ThSyncStatus result) {
|
||||
box.hide();
|
||||
GWT.log("Updating sync status: "+result);
|
||||
viewManager.showMonitorSyncToFolder(folder);
|
||||
|
||||
}
|
||||
});
|
||||
box.show();
|
||||
}
|
||||
}
|
@ -0,0 +1,150 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.wsthreddssync.client.dialog;
|
||||
|
||||
|
||||
import org.gcube.portlets.widgets.wsthreddssync.client.resource.Icons;
|
||||
|
||||
import com.google.gwt.dom.client.Style.Unit;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.resources.client.ImageResource;
|
||||
import com.google.gwt.user.client.ui.Button;
|
||||
import com.google.gwt.user.client.ui.DialogBox;
|
||||
import com.google.gwt.user.client.ui.DockPanel;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
|
||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||
import com.google.gwt.user.client.ui.Image;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
|
||||
/**
|
||||
* The Class DialogConfirm.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Feb 19, 2015
|
||||
*/
|
||||
public class DialogConfirm extends DialogBox implements ClickHandler {
|
||||
|
||||
private DockPanel dock = new DockPanel();
|
||||
private Button yesButton;
|
||||
private VerticalPanel vpContainer;
|
||||
private ImageResource loading = Icons.ICONS.loading();
|
||||
private HorizontalPanel hpButtons = new HorizontalPanel();
|
||||
private Button noButton;
|
||||
/**
|
||||
* Instantiates a new dialog confirm.
|
||||
*
|
||||
* @param img the img
|
||||
* @param caption the caption
|
||||
* @param text the text
|
||||
*/
|
||||
public DialogConfirm(Image img, String caption, String text) {
|
||||
getElement().setClassName("gwt-DialogBoxNew");
|
||||
dock.setSpacing(4);
|
||||
dock.setWidth("100%");
|
||||
setText(caption);
|
||||
// setHeading(caption);
|
||||
|
||||
yesButton = new Button("Yes");
|
||||
noButton = new Button("No", this);
|
||||
|
||||
noButton.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
hide();
|
||||
}
|
||||
});
|
||||
|
||||
vpContainer = new VerticalPanel();
|
||||
vpContainer.getElement().getStyle().setMargin(20.0, Unit.PX);
|
||||
vpContainer.add(new HTML(text));
|
||||
hpButtons = new HorizontalPanel();
|
||||
hpButtons.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
|
||||
// hpButtons.getElement().getStyle().setMarginTop(20.0, Unit.PX);
|
||||
hpButtons.setSpacing(3);
|
||||
yesButton.getElement().getStyle().setMarginRight(20.0, Unit.PX);
|
||||
hpButtons.add(yesButton);
|
||||
hpButtons.add(noButton);
|
||||
|
||||
dock.add(hpButtons, DockPanel.SOUTH);
|
||||
dock.setCellHorizontalAlignment(hpButtons, DockPanel.ALIGN_CENTER);
|
||||
|
||||
if (img != null)
|
||||
dock.add(img, DockPanel.WEST);
|
||||
|
||||
dock.add(vpContainer, DockPanel.CENTER);
|
||||
setWidget(dock);
|
||||
// add(dock);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.google.gwt.event.dom.client.ClickHandler#onClick(com.google.gwt.event
|
||||
* .dom.client.ClickEvent)
|
||||
*/
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
// hide();
|
||||
}
|
||||
|
||||
/**
|
||||
* Loader.
|
||||
*
|
||||
* @param message the message
|
||||
*/
|
||||
public void loader(String message){
|
||||
try{
|
||||
dock.remove(hpButtons);
|
||||
}catch(Exception e){}
|
||||
vpContainer.clear();
|
||||
HorizontalPanel hpMask = new HorizontalPanel();
|
||||
hpMask.add(new Image(loading));
|
||||
HTML html = new HTML(message);
|
||||
html.getElement().getStyle().setMarginLeft(5, Unit.PX);
|
||||
hpMask.add(html);
|
||||
vpContainer.add(hpMask);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the to center panel.
|
||||
*
|
||||
* @param w the w
|
||||
*/
|
||||
public void addToCenterPanel(Widget w) {
|
||||
vpContainer.add(w);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the dock.
|
||||
*
|
||||
* @return the dock
|
||||
*/
|
||||
public DockPanel getDock() {
|
||||
return dock;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the yes button.
|
||||
*
|
||||
* @return the yes button
|
||||
*/
|
||||
public Button getYesButton() {
|
||||
return yesButton;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the no button.
|
||||
*
|
||||
* @return the no button
|
||||
*/
|
||||
public Button getNoButton() {
|
||||
return noButton;
|
||||
}
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.wsthreddssync.client.dialog;
|
||||
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.user.client.ui.Button;
|
||||
import com.google.gwt.user.client.ui.DialogBox;
|
||||
import com.google.gwt.user.client.ui.DockPanel;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.Image;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class DialogResult.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Jan 19, 2018
|
||||
*/
|
||||
public class DialogResult extends DialogBox implements ClickHandler {
|
||||
|
||||
/** The dock. */
|
||||
private DockPanel dock = new DockPanel();
|
||||
|
||||
/** The close button. */
|
||||
private Button closeButton;
|
||||
|
||||
/**
|
||||
* Instantiates a new dialog result.
|
||||
*
|
||||
* @param img the img
|
||||
* @param title the title
|
||||
* @param msg the msg
|
||||
*/
|
||||
public DialogResult(Image img, String title, String msg) {
|
||||
getElement().setClassName("gwt-DialogBoxNew");
|
||||
setText(title);
|
||||
closeButton = new Button("Close", this);
|
||||
dock.setSpacing(4);
|
||||
dock.setWidth("100%");
|
||||
dock.add(new HTML(msg), DockPanel.CENTER);
|
||||
|
||||
dock.add(closeButton, DockPanel.SOUTH);
|
||||
if(img!=null)
|
||||
dock.add(img, DockPanel.WEST);
|
||||
|
||||
dock.setCellHorizontalAlignment(closeButton, DockPanel.ALIGN_RIGHT);
|
||||
setWidget(dock);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the close button.
|
||||
*
|
||||
* @return the closeButton
|
||||
*/
|
||||
public Button getCloseButton() {
|
||||
return closeButton;
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.google.gwt.event.dom.client.ClickHandler#onClick(com.google.gwt.event.dom.client.ClickEvent)
|
||||
*/
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
hide();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the to center panel.
|
||||
*
|
||||
* @param w the w
|
||||
*/
|
||||
public void addToCenterPanel(Widget w){
|
||||
dock.add(w, DockPanel.CENTER);
|
||||
}
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
package org.gcube.portlets.widgets.wsthreddssync.client.event;
|
||||
|
||||
import org.gcube.portlets.widgets.wsthreddssync.shared.WsFolder;
|
||||
import org.gcube.portlets.widgets.wsthreddssync.shared.WsThreddsSynchFolderConfiguration;
|
||||
|
||||
import com.google.gwt.event.shared.GwtEvent;
|
||||
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class PerformDoSyncEvent.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Feb 15, 2018
|
||||
*/
|
||||
public class PerformDoSyncEvent extends GwtEvent<PerformDoSyncEventHandler> {
|
||||
|
||||
/** The type. */
|
||||
public static Type<PerformDoSyncEventHandler> TYPE = new Type<PerformDoSyncEventHandler>();
|
||||
private WsThreddsSynchFolderConfiguration conf;
|
||||
private WsFolder folder;
|
||||
|
||||
|
||||
/**
|
||||
* Instantiates a new perform do sync event.
|
||||
*
|
||||
* @param folder the folder
|
||||
* @param conf the conf
|
||||
*/
|
||||
public PerformDoSyncEvent(WsFolder folder, WsThreddsSynchFolderConfiguration conf) {
|
||||
this.folder = folder;
|
||||
this.conf = conf;
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
|
||||
*/
|
||||
@Override
|
||||
public Type<PerformDoSyncEventHandler> getAssociatedType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler)
|
||||
*/
|
||||
@Override
|
||||
protected void dispatch(PerformDoSyncEventHandler handler) {
|
||||
handler.onPerformDoSync(this);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the conf.
|
||||
*
|
||||
* @return the conf
|
||||
*/
|
||||
public WsThreddsSynchFolderConfiguration getConf() {
|
||||
return conf;
|
||||
|
||||
}
|
||||
|
||||
public WsFolder getFolder() {
|
||||
return folder;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package org.gcube.portlets.widgets.wsthreddssync.client.event;
|
||||
|
||||
import com.google.gwt.event.shared.EventHandler;
|
||||
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Interface PerformDoSyncEventHandler.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Feb 15, 2018
|
||||
*/
|
||||
public interface PerformDoSyncEventHandler extends EventHandler {
|
||||
|
||||
|
||||
/**
|
||||
* On change status.
|
||||
*
|
||||
* @param courseChangeStatusEvent the course change status event
|
||||
*/
|
||||
void onPerformDoSync(PerformDoSyncEvent courseChangeStatusEvent);
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package org.gcube.portlets.widgets.wsthreddssync.client.event;
|
||||
|
||||
import org.gcube.portlets.widgets.wsthreddssync.shared.WsFolder;
|
||||
|
||||
import com.google.gwt.event.shared.GwtEvent;
|
||||
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class PerformDoSyncEvent.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Feb 15, 2018
|
||||
*/
|
||||
public class ShowMonitorSyncStatusEvent extends GwtEvent<ShowMonitorSyncStatusEventHandler> {
|
||||
|
||||
/** The type. */
|
||||
public static Type<ShowMonitorSyncStatusEventHandler> TYPE = new Type<ShowMonitorSyncStatusEventHandler>();
|
||||
private WsFolder folder;
|
||||
|
||||
|
||||
/**
|
||||
* Instantiates a new perform do sync event.
|
||||
*
|
||||
* @param folder the folder
|
||||
* @param conf the conf
|
||||
*/
|
||||
public ShowMonitorSyncStatusEvent(WsFolder folder) {
|
||||
this.folder = folder;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
|
||||
*/
|
||||
@Override
|
||||
public Type<ShowMonitorSyncStatusEventHandler> getAssociatedType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler)
|
||||
*/
|
||||
@Override
|
||||
protected void dispatch(ShowMonitorSyncStatusEventHandler handler) {
|
||||
handler.onShowMonitorSyncStatus(this);
|
||||
}
|
||||
|
||||
public WsFolder getFolder() {
|
||||
return folder;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package org.gcube.portlets.widgets.wsthreddssync.client.event;
|
||||
|
||||
import com.google.gwt.event.shared.EventHandler;
|
||||
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Interface ShowMonitorSyncStatusEventHandler.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Feb 16, 2018
|
||||
*/
|
||||
public interface ShowMonitorSyncStatusEventHandler extends EventHandler {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* On show sync status.
|
||||
*
|
||||
* @param showSyncStatusEvent the show sync status event
|
||||
*/
|
||||
void onShowMonitorSyncStatus(ShowMonitorSyncStatusEvent showSyncStatusEvent);
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.wsthreddssync.client.resource;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.resources.client.ClientBundle;
|
||||
import com.google.gwt.resources.client.ImageResource;
|
||||
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Interface Icons.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Feb 7, 2018
|
||||
*/
|
||||
public interface Icons extends ClientBundle {
|
||||
|
||||
/** The Constant ICONS. */
|
||||
public static final Icons ICONS = GWT.create(Icons.class);
|
||||
|
||||
/**
|
||||
* Loading.
|
||||
*
|
||||
* @return the image resource
|
||||
*/
|
||||
@Source("loading.gif")
|
||||
ImageResource loading();
|
||||
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
@ -0,0 +1,27 @@
|
||||
package org.gcube.portlets.widgets.wsthreddssync.client.rpc;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portal.wssynclibrary.shared.ItemNotSynched;
|
||||
import org.gcube.portal.wssynclibrary.shared.thredds.ThSyncStatus;
|
||||
import org.gcube.portlets.widgets.wsthreddssync.shared.GcubeVRE;
|
||||
import org.gcube.portlets.widgets.wsthreddssync.shared.WsThreddsSynchFolderConfiguration;
|
||||
import org.gcube.portlets.widgets.wsthreddssync.shared.WsThreddsSynchFolderDescriptor;
|
||||
|
||||
import com.google.gwt.user.client.rpc.RemoteService;
|
||||
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
|
||||
|
||||
/**
|
||||
* The client side stub for the RPC service.
|
||||
*/
|
||||
@RemoteServiceRelativePath("wsthreddssync")
|
||||
public interface ThreddsWorkspaceSyncService extends RemoteService {
|
||||
|
||||
WsThreddsSynchFolderDescriptor isItemSynched(String folderId) throws ItemNotSynched, Exception;
|
||||
|
||||
ThSyncStatus doSyncFolder(final String folderId, WsThreddsSynchFolderConfiguration clientConfig) throws Exception;
|
||||
|
||||
ThSyncStatus monitorSyncStatus(String folderId) throws ItemNotSynched, Exception;
|
||||
|
||||
List<GcubeVRE> getListOfVREsForLoggedUser() throws Exception;
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package org.gcube.portlets.widgets.wsthreddssync.client.rpc;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portal.wssynclibrary.shared.thredds.ThSyncStatus;
|
||||
import org.gcube.portlets.widgets.wsthreddssync.shared.GcubeVRE;
|
||||
import org.gcube.portlets.widgets.wsthreddssync.shared.WsThreddsSynchFolderConfiguration;
|
||||
import org.gcube.portlets.widgets.wsthreddssync.shared.WsThreddsSynchFolderDescriptor;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
|
||||
public interface ThreddsWorkspaceSyncServiceAsync
|
||||
{
|
||||
|
||||
/**
|
||||
* Utility class to get the RPC Async interface from client-side code
|
||||
*/
|
||||
public static final class Util
|
||||
{
|
||||
private static ThreddsWorkspaceSyncServiceAsync instance;
|
||||
|
||||
public static final ThreddsWorkspaceSyncServiceAsync getInstance()
|
||||
{
|
||||
if ( instance == null )
|
||||
{
|
||||
instance = (ThreddsWorkspaceSyncServiceAsync) GWT.create( ThreddsWorkspaceSyncService.class );
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
private Util()
|
||||
{
|
||||
// Utility class should not be instantiated
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void isItemSynched(String folderId, AsyncCallback<WsThreddsSynchFolderDescriptor> callback);
|
||||
|
||||
|
||||
void doSyncFolder(String folderId, WsThreddsSynchFolderConfiguration clientConfig, AsyncCallback<ThSyncStatus> callback);
|
||||
|
||||
|
||||
void monitorSyncStatus(String folderId, AsyncCallback<ThSyncStatus> callback);
|
||||
|
||||
|
||||
void getListOfVREsForLoggedUser(AsyncCallback<List<GcubeVRE>> callback);
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package org.gcube.portlets.widgets.wsthreddssync.client.view;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class FormatUtil.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Feb 16, 2018
|
||||
*/
|
||||
public class FormatUtil {
|
||||
|
||||
|
||||
/**
|
||||
* Truncate a string and add an ellipsis ('...') to the end if it exceeds the
|
||||
* specified length.
|
||||
*
|
||||
* @param value the string to truncate
|
||||
* @param len the maximum length to allow before truncating
|
||||
* @return the converted text
|
||||
*/
|
||||
public static String ellipse(String value, int len) {
|
||||
if (value != null && value.length() > len) {
|
||||
return value.substring(0, len - 3) + "...";
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the folder title.
|
||||
*
|
||||
* @param folderName the folder name
|
||||
* @param maxSize the max size
|
||||
* @return the folder title
|
||||
*/
|
||||
public static String getFolderTitle(String folderName, int maxSize){
|
||||
String title = folderName!=null&&folderName.length()>0?folderName:"";
|
||||
return FormatUtil.ellipse(title, maxSize);
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.wsthreddssync.client.view;
|
||||
|
||||
import org.gcube.portlets.widgets.wsthreddssync.client.resource.Icons;
|
||||
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||
import com.google.gwt.user.client.ui.Image;
|
||||
|
||||
/**
|
||||
* The Class LoaderIcon.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Feb 19, 2015
|
||||
*/
|
||||
public class LoaderIcon extends HorizontalPanel{
|
||||
|
||||
|
||||
private Image imgLoading = new Image(Icons.ICONS.loading());
|
||||
private HTML txtLoading = new HTML("");
|
||||
|
||||
/**
|
||||
* Instantiates a new loader icon.
|
||||
*
|
||||
* @param txtHTML the txt html
|
||||
*/
|
||||
public LoaderIcon(String txtHTML) {
|
||||
this();
|
||||
setText(txtHTML);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new loader icon.
|
||||
*/
|
||||
public LoaderIcon() {
|
||||
setStyleName("marginTop20");
|
||||
add(imgLoading);
|
||||
add(txtLoading);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the text.
|
||||
*
|
||||
* @param txtHTML the new text
|
||||
*/
|
||||
public void setText(String txtHTML){
|
||||
txtLoading.setHTML("<span style=\"margin-left:5px; vertical-align:middle;\">"+txtHTML+"</span>");
|
||||
}
|
||||
|
||||
/**
|
||||
* Show.
|
||||
*
|
||||
* @param bool the bool
|
||||
*/
|
||||
public void show(boolean bool){
|
||||
this.setVisible(bool);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,359 @@
|
||||
package org.gcube.portlets.widgets.wsthreddssync.client.view;
|
||||
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.portal.wssynclibrary.shared.thredds.Status;
|
||||
import org.gcube.portal.wssynclibrary.shared.thredds.ThSyncStatus;
|
||||
import org.gcube.portlets.widgets.wsthreddssync.client.WsThreddsWidget;
|
||||
import org.gcube.portlets.widgets.wsthreddssync.client.event.PerformDoSyncEvent;
|
||||
import org.gcube.portlets.widgets.wsthreddssync.client.event.ShowMonitorSyncStatusEvent;
|
||||
import org.gcube.portlets.widgets.wsthreddssync.client.view.binder.AbstractViewDialogBox;
|
||||
import org.gcube.portlets.widgets.wsthreddssync.client.view.binder.CreateThreddsConfigurationView;
|
||||
import org.gcube.portlets.widgets.wsthreddssync.client.view.binder.MonitorFolderSyncStatusView;
|
||||
import org.gcube.portlets.widgets.wsthreddssync.client.view.binder.ShowThreddsFolderInfoView;
|
||||
import org.gcube.portlets.widgets.wsthreddssync.shared.WsFolder;
|
||||
import org.gcube.portlets.widgets.wsthreddssync.shared.WsThreddsSynchFolderConfiguration;
|
||||
import org.gcube.portlets.widgets.wsthreddssync.shared.WsThreddsSynchFolderDescriptor;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Alert;
|
||||
import com.github.gwtbootstrap.client.ui.Modal;
|
||||
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
||||
import com.google.gwt.core.shared.GWT;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.user.client.Timer;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.Button;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class WsThreddsWidgetViewManager.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Feb 19, 2018
|
||||
*/
|
||||
public class WsThreddsWidgetViewManager {
|
||||
|
||||
private Map<String, MonitorFolderSyncStatusView> mapMonitor = new HashMap<String, MonitorFolderSyncStatusView>();
|
||||
|
||||
|
||||
/**
|
||||
* Instantiates a new ws thredds widget view manager.
|
||||
*/
|
||||
public WsThreddsWidgetViewManager() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Cancel monitor.
|
||||
*
|
||||
* @param folder the folder
|
||||
*/
|
||||
public void cancelMonitor(WsFolder folder) {
|
||||
try {
|
||||
MonitorFolderSyncStatusView monitorView = getMonitor(folder);
|
||||
if(monitorView.getSchedulerTime()!=null) {
|
||||
GWT.log("Removed sheduler time on folder: "+folder.getFolderId());
|
||||
monitorView.getSchedulerTime().cancel();
|
||||
}
|
||||
GWT.log("Removed monitor on folder: "+folder.getFolderId());
|
||||
mapMonitor.remove(folder.getFolderId());
|
||||
}catch (Exception e) {
|
||||
GWT.log("Error on removing map monitor for id: "+folder.getFolderId());;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the monitor.
|
||||
*
|
||||
* @param folder the folder
|
||||
* @return the monitor
|
||||
*/
|
||||
public MonitorFolderSyncStatusView getMonitor(WsFolder folder){
|
||||
|
||||
if(folder==null)
|
||||
return null;
|
||||
|
||||
return mapMonitor.get(folder.getFolderId());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Save monitor.
|
||||
*
|
||||
* @param folder the folder
|
||||
* @param monitor the monitor
|
||||
*/
|
||||
private void saveMonitor(WsFolder folder, MonitorFolderSyncStatusView monitor) {
|
||||
mapMonitor.put(folder.getFolderId(), monitor);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show monitor sync to folder.
|
||||
*
|
||||
* @param folder the folder
|
||||
*/
|
||||
public void showMonitorSyncToFolder(final WsFolder folder) {
|
||||
|
||||
final Modal box = new Modal(true);
|
||||
box.addStyleName("ws-thredds-modal-body");
|
||||
box.setTitle("Monitor transferring of: "+FormatUtil.getFolderTitle(folder.getFoderName(), 20));
|
||||
box.setWidth(800);
|
||||
//box.setHeight("600px");
|
||||
//box.setHeight("700px");
|
||||
//box.getElement().getStyle().setZIndex(10000);
|
||||
MonitorFolderSyncStatusView monitorView = getMonitor(folder);
|
||||
|
||||
final MonitorFolderSyncStatusView theMonitor = monitorView;
|
||||
|
||||
final AbstractViewDialogBox panelView = new AbstractViewDialogBox() {
|
||||
|
||||
@Override
|
||||
public void closeHandler() {
|
||||
box.hide();
|
||||
if(theMonitor!=null && theMonitor.getSchedulerTime()!=null)
|
||||
theMonitor.getSchedulerTime().cancel();
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
if(monitorView==null) {
|
||||
|
||||
monitorView = new MonitorFolderSyncStatusView() {
|
||||
|
||||
@Override
|
||||
public void submitHandler() {
|
||||
//TODO CLIENT SIDE?
|
||||
cancelMonitor(folder);
|
||||
box.hide();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setError(boolean visible, String error) {
|
||||
panelView.setError(visible, error);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
//Removing old monitor
|
||||
cancelMonitor(folder);
|
||||
//Creating new one
|
||||
final MonitorFolderSyncStatusView currentMonitor = monitorView;
|
||||
|
||||
|
||||
Timer schedulingTimer = new Timer() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
WsThreddsWidget.wsThreddsSyncService.monitorSyncStatus(folder.getFolderId(), new AsyncCallback<ThSyncStatus>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
cancelMonitor(folder);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(ThSyncStatus status) {
|
||||
|
||||
currentMonitor.updateStatusView(folder, status);
|
||||
|
||||
if(status!=null && status.getProcessStatus()!=null) {
|
||||
|
||||
if(status.getProcessStatus().getStatus().equals(Status.COMPLETED)) {
|
||||
GWT.log("Sync completed cancel the polling: "+status);
|
||||
cancelMonitor(folder);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
schedulingTimer.scheduleRepeating(2000);
|
||||
currentMonitor.setScheduler(schedulingTimer);
|
||||
saveMonitor(folder, currentMonitor);
|
||||
|
||||
panelView.addViewAsWidget(monitorView);
|
||||
box.add(panelView);
|
||||
box.show();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show create configuration folder.
|
||||
*
|
||||
* @param folder the folder
|
||||
* @param conf the conf
|
||||
*/
|
||||
public void showCreateConfigurationFolder(final WsFolder folder, WsThreddsSynchFolderDescriptor conf){
|
||||
|
||||
final Modal box = new Modal(true);
|
||||
box.setTitle("Create Thredds Sync Configuration for: "+FormatUtil.getFolderTitle(folder.getFoderName(), 20));
|
||||
//box.getElement().getStyle().setZIndex(10000);
|
||||
|
||||
final AbstractViewDialogBox panelView = new AbstractViewDialogBox() {
|
||||
|
||||
@Override
|
||||
public void closeHandler() {
|
||||
box.hide();
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
CreateThreddsConfigurationView createThreddsConfiguration = new CreateThreddsConfigurationView(folder.getFolderId()) {
|
||||
|
||||
@Override
|
||||
public void submitHandler() {
|
||||
box.hide();
|
||||
WsThreddsSynchFolderConfiguration conf = new WsThreddsSynchFolderConfiguration();
|
||||
conf.setFilter(null);
|
||||
conf.setRemotePath(getRemotePath());
|
||||
conf.setCatalogName(getCatalogueName());
|
||||
conf.setTheVRE(getSelectedVRE());
|
||||
WsThreddsWidget.eventBus.fireEvent(new PerformDoSyncEvent(folder, conf));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setError(boolean visible, String error) {
|
||||
panelView.setError(visible, error);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
panelView.addViewAsWidget(createThreddsConfiguration);
|
||||
box.add(panelView);
|
||||
box.show();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show thredds folder info.
|
||||
*
|
||||
* @param folder the folder
|
||||
* @param folderDescriptor the folder descriptor
|
||||
*/
|
||||
public void showThreddsFolderInfo(final WsFolder folder, final WsThreddsSynchFolderDescriptor folderDescriptor){
|
||||
GWT.log("ShowThreddsFolderInfo folder: "+folder);
|
||||
GWT.log("WsThreddsSynchFolderDescriptor is: "+folderDescriptor);
|
||||
|
||||
final Modal box = new Modal(true);
|
||||
//box.setWidth(WIDHT_DIALOG+"px");
|
||||
box.setTitle("Thredds Sync Information for: "+FormatUtil.getFolderTitle(folder.getFoderName(), 20));
|
||||
//box.getElement().getStyle().setZIndex(10000);
|
||||
|
||||
final AbstractViewDialogBox panelView = new AbstractViewDialogBox() {
|
||||
|
||||
@Override
|
||||
public void closeHandler() {
|
||||
box.hide();
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
boolean isCreateConfiguration = folderDescriptor==null?true:false;
|
||||
|
||||
|
||||
ShowThreddsFolderInfoView folderInfo = new ShowThreddsFolderInfoView(folder.getFolderId(), isCreateConfiguration) {
|
||||
|
||||
@Override
|
||||
public void submitHandler(SUBMIT_ACTION action) {
|
||||
|
||||
if(action==null)
|
||||
return;
|
||||
|
||||
switch (action) {
|
||||
|
||||
case CREATE_UPDATE_CONFIGURATION:
|
||||
if(folderDescriptor==null) {
|
||||
GWT.log("Performing a create configuration");
|
||||
//PERFORM A CREATE CONFIGURATION (AT FIRST TIME), THE CONFIGURATION DOES NOT EXITS
|
||||
showCreateConfigurationFolder(folder, null);
|
||||
|
||||
}
|
||||
// else {
|
||||
// GWT.log("Performing an updated configuration");
|
||||
// //PERFORM AN UPDATE CONFIGURATION. THE CONFIGURATION EXIST
|
||||
// //BeanConverter.toWsThreddsFolderConfig(t, vre);
|
||||
// showCreateConfigurationFolder(folder, result);
|
||||
// }
|
||||
//
|
||||
|
||||
break;
|
||||
case DO_SYNC:
|
||||
GWT.log("Performing a do sync using server folder configuration");
|
||||
//PERFORM A DO SYNC BUT NOT AT FIRST TIME
|
||||
WsThreddsWidget.eventBus.fireEvent(new PerformDoSyncEvent(folder, null));
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public void setError(boolean visible, String error) {
|
||||
panelView.setError(visible, error);
|
||||
}
|
||||
};
|
||||
|
||||
folderInfo.updateViewToResult(folder, folderDescriptor);
|
||||
|
||||
if(isCreateConfiguration) {
|
||||
folderInfo.getMainPanel().setVisible(false);
|
||||
folderInfo.setError(true, "This Folder is not sychronized. Do you want create a configuration?");
|
||||
folderInfo.getPager().getLeft().setText("Create Configuration");
|
||||
// folderInfo.getPager().getLeft().setText("Create Configuration");
|
||||
// folderInfo.getPager().getLeft().addClickHandler(new ClickHandler() {
|
||||
//
|
||||
// @Override
|
||||
// public void onClick(ClickEvent event) {
|
||||
// }
|
||||
// });
|
||||
}else {
|
||||
//USER CAN PERFORM DO SYNC
|
||||
//MOREOVER, HE/SHE COULD UPDATE THE CONFIGURATION BUT IT IS NOT SUPPORTED SERVER-SIDE
|
||||
folderInfo.getPager().getLeft().setVisible(false);
|
||||
|
||||
if(folderDescriptor.getServerFolderDescriptor().isLocked()) {
|
||||
VerticalPanel v = new VerticalPanel();
|
||||
Alert alert = new Alert("Current Folder synchronization is locked by another proccess. Do you want see synchronization status?");
|
||||
alert.setClose(true);
|
||||
alert.setType(AlertType.INFO);
|
||||
|
||||
Button butt = new Button("Show Status");
|
||||
butt.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
WsThreddsWidget.eventBus.fireEvent(new ShowMonitorSyncStatusEvent(folder));
|
||||
}
|
||||
});
|
||||
|
||||
v.add(alert);
|
||||
v.add(butt);
|
||||
box.add(v);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
panelView.addViewAsWidget(folderInfo);
|
||||
box.add(panelView);
|
||||
box.show();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,157 @@
|
||||
package org.gcube.portlets.widgets.wsthreddssync.client.view.binder;
|
||||
|
||||
|
||||
import org.gcube.portlets.widgets.wsthreddssync.client.view.LoaderIcon;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Alert;
|
||||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
import com.github.gwtbootstrap.client.ui.FluidRow;
|
||||
import com.github.gwtbootstrap.client.ui.base.AlertBase;
|
||||
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.ScrollPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class AbstractViewDialogBox.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Jan 8, 2018
|
||||
*/
|
||||
public abstract class AbstractViewDialogBox extends Composite {
|
||||
|
||||
/** The ui binder. */
|
||||
private static AbstractViewDialogBoxUiBinder uiBinder =
|
||||
GWT.create(AbstractViewDialogBoxUiBinder.class);
|
||||
|
||||
/** The default width. */
|
||||
public static int DEFAULT_WIDTH = 500;
|
||||
|
||||
/**
|
||||
* The Interface AbstractViewDialogBoxUiBinder.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Jan 9, 2018
|
||||
*/
|
||||
interface AbstractViewDialogBoxUiBinder
|
||||
extends UiBinder<Widget, AbstractViewDialogBox> {
|
||||
}
|
||||
|
||||
|
||||
/** The button close dialog. */
|
||||
@UiField
|
||||
Button button_close_dialog;
|
||||
|
||||
/** The field root panel. */
|
||||
@UiField
|
||||
HTMLPanel field_root_panel;
|
||||
|
||||
/** The scroll panel. */
|
||||
@UiField
|
||||
ScrollPanel scroll_panel;
|
||||
|
||||
/** The validator field. */
|
||||
@UiField
|
||||
FluidRow validator_field;
|
||||
|
||||
/** The loader icon. */
|
||||
private LoaderIcon loaderIcon = new LoaderIcon();
|
||||
|
||||
/** The alert error. */
|
||||
protected Alert alertError = new Alert();
|
||||
|
||||
|
||||
/** The alert info. */
|
||||
protected AlertBase alertInfo = new Alert();
|
||||
|
||||
/**
|
||||
* Close handler.
|
||||
*/
|
||||
public abstract void closeHandler();
|
||||
|
||||
/**
|
||||
* Because this class has a default constructor, it can
|
||||
* be used as a binder template. In other words, it can be used in other
|
||||
* *.ui.xml files as follows:
|
||||
* <ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||
* xmlns:g="urn:import:**user's package**">
|
||||
* <g:**UserClassName**>Hello!</g:**UserClassName>
|
||||
* </ui:UiBinder>
|
||||
* Note that depending on the widget that is used, it may be necessary to
|
||||
* implement HasHTML instead of HasText.
|
||||
*/
|
||||
public AbstractViewDialogBox() {
|
||||
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
//setWidth(DEFAULT_WIDTH+"px");
|
||||
|
||||
alertError.setType(AlertType.ERROR);
|
||||
alertError.setVisible(false);
|
||||
alertError.setClose(false);
|
||||
validator_field.add(alertError);
|
||||
|
||||
showLoading(false, "");
|
||||
field_root_panel.add(loaderIcon);
|
||||
|
||||
bindEvents();
|
||||
}
|
||||
|
||||
/**
|
||||
* Bind events.
|
||||
*/
|
||||
private void bindEvents() {
|
||||
|
||||
button_close_dialog.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
closeHandler();
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the view as widget.
|
||||
*
|
||||
* @param child the child
|
||||
*/
|
||||
public void addViewAsWidget(Widget child) {
|
||||
|
||||
scroll_panel.add(child);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show loading.
|
||||
*
|
||||
* @param visible the visible
|
||||
* @param text the text
|
||||
*/
|
||||
public void showLoading(boolean visible, String text){
|
||||
loaderIcon.setVisible(visible);
|
||||
loaderIcon.setText(text);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the error.
|
||||
*
|
||||
* @param visible the visible
|
||||
* @param error the error
|
||||
*/
|
||||
public void setError(boolean visible, String error) {
|
||||
alertError.setVisible(visible);
|
||||
alertError.setText(error==null?"":error);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
||||
<ui:style>
|
||||
</ui:style>
|
||||
<g:HTMLPanel ui:field="field_root_panel">
|
||||
<g:ScrollPanel ui:field="scroll_panel">
|
||||
</g:ScrollPanel>
|
||||
<b:FluidRow ui:field="validator_field"></b:FluidRow>
|
||||
<g:HorizontalPanel>
|
||||
<b:Button type="LINK" ui:field="button_close_dialog" visible="false">Close</b:Button>
|
||||
</g:HorizontalPanel>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
@ -0,0 +1,216 @@
|
||||
package org.gcube.portlets.widgets.wsthreddssync.client.view.binder;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.portlets.widgets.wsthreddssync.client.WsThreddsWidget;
|
||||
import org.gcube.portlets.widgets.wsthreddssync.shared.GcubeVRE;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.ControlGroup;
|
||||
import com.github.gwtbootstrap.client.ui.ListBox;
|
||||
import com.github.gwtbootstrap.client.ui.Pager;
|
||||
import com.github.gwtbootstrap.client.ui.TextBox;
|
||||
import com.github.gwtbootstrap.client.ui.constants.ControlGroupType;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class CreateThreddsConfigurationView.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Feb 15, 2018
|
||||
*/
|
||||
public abstract class CreateThreddsConfigurationView extends Composite {
|
||||
|
||||
/** The ui binder. */
|
||||
private static CreateThreddsConfigurationViewUiBinder uiBinder =
|
||||
GWT.create(CreateThreddsConfigurationViewUiBinder.class);
|
||||
|
||||
|
||||
/**
|
||||
* The Interface CreateFolderConfigurationToThreddsSyncUiBinder.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Feb 14, 2018
|
||||
*/
|
||||
interface CreateThreddsConfigurationViewUiBinder
|
||||
extends UiBinder<Widget, CreateThreddsConfigurationView> {
|
||||
}
|
||||
|
||||
/** The pager. */
|
||||
@UiField
|
||||
Pager pager;
|
||||
|
||||
|
||||
/** The field course desciption. */
|
||||
@UiField
|
||||
ListBox field_select_vre;
|
||||
|
||||
|
||||
/** The field catalogue name. */
|
||||
@UiField
|
||||
TextBox field_catalogue_name;
|
||||
|
||||
/** The field folder name. */
|
||||
@UiField
|
||||
TextBox field_remote_path;
|
||||
|
||||
|
||||
/** The cg catalogue name. */
|
||||
@UiField
|
||||
ControlGroup cg_catalogue_name;
|
||||
|
||||
/** The cg folder name. */
|
||||
@UiField
|
||||
ControlGroup cg_remote_path;
|
||||
|
||||
|
||||
/** The folder id. */
|
||||
private String folderId;
|
||||
|
||||
/** The map VR es. */
|
||||
private Map<String, GcubeVRE> mapVREs = new HashMap<String, GcubeVRE>();
|
||||
|
||||
|
||||
/**
|
||||
* Submit handler.
|
||||
*/
|
||||
public abstract void submitHandler();
|
||||
|
||||
/**
|
||||
* Sets the error.
|
||||
*
|
||||
* @param visible the visible
|
||||
* @param error the error
|
||||
*/
|
||||
public abstract void setError(boolean visible, String error);
|
||||
|
||||
|
||||
/**
|
||||
* Because this class has a default constructor, it can
|
||||
* be used as a binder template. In other words, it can be used in other
|
||||
* *.ui.xml files as follows:
|
||||
* <ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||
* xmlns:g="urn:import:**user's package**">
|
||||
* <g:**UserClassName**>Hello!</g:**UserClassName>
|
||||
* </ui:UiBinder>
|
||||
* Note that depending on the widget that is used, it may be necessary to
|
||||
* implement HasHTML instead of HasText.
|
||||
*
|
||||
* @param folderId the folder id
|
||||
*/
|
||||
public CreateThreddsConfigurationView(String folderId) {
|
||||
this.folderId = folderId;
|
||||
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
|
||||
pager.getLeft().setVisible(false);
|
||||
|
||||
pager.getRight().addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
setError(false, "");
|
||||
boolean isValid = validateSubmit();
|
||||
if(isValid)
|
||||
submitHandler();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
WsThreddsWidget.wsThreddsSyncService.getListOfVREsForLoggedUser(new AsyncCallback<List<GcubeVRE>>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<GcubeVRE> result) {
|
||||
|
||||
|
||||
for (GcubeVRE gcubeVRE : result) {
|
||||
mapVREs.put(gcubeVRE.getVreScope(), gcubeVRE);
|
||||
field_select_vre.addItem(gcubeVRE.getVreScope(), gcubeVRE.getVreName());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Validate submit.
|
||||
*
|
||||
* @return true, if successful
|
||||
*/
|
||||
protected boolean validateSubmit() {
|
||||
cg_catalogue_name.setType(ControlGroupType.NONE);
|
||||
cg_remote_path.setType(ControlGroupType.NONE);
|
||||
|
||||
if(field_catalogue_name.getValue()==null || field_catalogue_name.getValue().isEmpty()){
|
||||
cg_catalogue_name.setType(ControlGroupType.ERROR);
|
||||
setError(true, "Catalogue Name is required");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(field_remote_path.getValue()==null || field_remote_path.getValue().isEmpty()){
|
||||
cg_remote_path.setType(ControlGroupType.ERROR);
|
||||
setError(true, "Remote Path field is required");
|
||||
return false;
|
||||
}else if(field_remote_path.getValue().startsWith("/")){
|
||||
cg_remote_path.setType(ControlGroupType.ERROR);
|
||||
setError(true, "Remote Path must be a relative URL. It does not start with '/'");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the remote path.
|
||||
*
|
||||
* @return the remote path
|
||||
*/
|
||||
public String getRemotePath() {
|
||||
return field_remote_path.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the catalogue name.
|
||||
*
|
||||
* @return the catalogue name
|
||||
*/
|
||||
public String getCatalogueName(){
|
||||
return field_catalogue_name.getValue();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the unit description.
|
||||
*
|
||||
* @return the unit description
|
||||
*/
|
||||
public GcubeVRE getSelectedVRE(){
|
||||
String item = field_select_vre.getSelectedItemText();
|
||||
String text = field_select_vre.getSelectedValue();
|
||||
return mapVREs.get(item);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
||||
<ui:style>
|
||||
.noBorder {
|
||||
border: 0px;
|
||||
}
|
||||
</ui:style>
|
||||
<g:HTMLPanel>
|
||||
<g:HTMLPanel ui:field="form_unit_fields">
|
||||
<b:Form type="HORIZONTAL">
|
||||
<b:Fieldset styleName="{style.noBorder}">
|
||||
<b:ControlGroup ui:field="cg_catalogue_name">
|
||||
<b:ControlLabel for="cl_catalogue_name">Catalogue Name</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox placeholder="Type the Catalogue Name..."
|
||||
b:id="field_catalogue_name" ui:field="field_catalogue_name"></b:TextBox>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
|
||||
<b:ControlGroup ui:field="cg_unit_description">
|
||||
<b:ControlLabel for="cl_course_description">Publish in the VRE</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:ListBox name="Select a VRE..."
|
||||
b:id="field_select_vre" ui:field="field_select_vre">
|
||||
</b:ListBox>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
|
||||
<b:ControlGroup ui:field="cg_remote_path">
|
||||
<b:ControlLabel for="cl_remote_path">Remote Path</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox placeholder="Type the Remote Path..."
|
||||
title="This is the Remote Path" b:id="field_remote_path"
|
||||
ui:field="field_remote_path"></b:TextBox>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
</b:Fieldset>
|
||||
</b:Form>
|
||||
</g:HTMLPanel>
|
||||
<b:Pager left="Older" right="Create Configuration and Do Sync" aligned="true"
|
||||
ui:field="pager" />
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
@ -0,0 +1,274 @@
|
||||
package org.gcube.portlets.widgets.wsthreddssync.client.view.binder;
|
||||
|
||||
|
||||
import org.gcube.portal.wssynclibrary.shared.thredds.Status;
|
||||
import org.gcube.portal.wssynclibrary.shared.thredds.ThProcessStatus;
|
||||
import org.gcube.portal.wssynclibrary.shared.thredds.ThSyncStatus;
|
||||
import org.gcube.portlets.widgets.wsthreddssync.client.view.LoaderIcon;
|
||||
import org.gcube.portlets.widgets.wsthreddssync.shared.WsFolder;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Alert;
|
||||
import com.github.gwtbootstrap.client.ui.Pager;
|
||||
import com.github.gwtbootstrap.client.ui.ProgressBar;
|
||||
import com.github.gwtbootstrap.client.ui.TextArea;
|
||||
import com.github.gwtbootstrap.client.ui.TextBox;
|
||||
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
||||
import com.github.gwtbootstrap.client.ui.constants.ResizeType;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.Timer;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class ShowThreddsFolderInfoView.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Feb 15, 2018
|
||||
*/
|
||||
public abstract class MonitorFolderSyncStatusView extends Composite {
|
||||
|
||||
//private static final String DATE_FORMAT_YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
|
||||
|
||||
|
||||
public static final String TRANSFERRING_STATE = "Transferring state: ";
|
||||
|
||||
private static final String UNKNOWN = "UNKNOWN";
|
||||
|
||||
/** The ui binder. */
|
||||
private static MonitorFolderSyncStatusViewUiBinder uiBinder =
|
||||
GWT.create(MonitorFolderSyncStatusViewUiBinder.class);
|
||||
|
||||
/**
|
||||
* The Interface ShowThreddsFolderInfoViewUiBinder.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Feb 15, 2018
|
||||
*/
|
||||
interface MonitorFolderSyncStatusViewUiBinder
|
||||
extends UiBinder<Widget, MonitorFolderSyncStatusView> {
|
||||
}
|
||||
|
||||
|
||||
@UiField
|
||||
Pager pager;
|
||||
|
||||
@UiField
|
||||
ProgressBar progress_percentage;
|
||||
|
||||
|
||||
@UiField
|
||||
TextArea field_current_message;
|
||||
|
||||
@UiField
|
||||
TextBox field_queued_items;
|
||||
|
||||
|
||||
@UiField
|
||||
TextBox field_transferred_items;
|
||||
|
||||
|
||||
@UiField
|
||||
TextBox field_number_error;
|
||||
|
||||
@UiField
|
||||
TextArea field_history_messages;
|
||||
|
||||
@UiField
|
||||
HTMLPanel form_monitor_thredds_transfer;
|
||||
|
||||
@UiField
|
||||
HTMLPanel field_loader;
|
||||
|
||||
private WsFolder folder;
|
||||
|
||||
|
||||
/** The scheduler time. */
|
||||
private Timer schedulerTime;
|
||||
|
||||
|
||||
/**
|
||||
* Submit handler.
|
||||
*/
|
||||
public abstract void submitHandler();
|
||||
|
||||
/**
|
||||
* Sets the error.
|
||||
*
|
||||
* @param visible the visible
|
||||
* @param error the error
|
||||
*/
|
||||
public abstract void setError(boolean visible, String error);
|
||||
|
||||
|
||||
/**
|
||||
* Because this class has a default constructor, it can
|
||||
* be used as a binder template. In other words, it can be used in other
|
||||
* *.ui.xml files as follows:
|
||||
* <ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||
* xmlns:g="urn:import:**user's package**">
|
||||
* <g:**UserClassName**>Hello!</g:**UserClassName>
|
||||
* </ui:UiBinder>
|
||||
* Note that depending on the widget that is used, it may be necessary to
|
||||
* implement HasHTML instead of HasText.
|
||||
*/
|
||||
public MonitorFolderSyncStatusView() {
|
||||
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
|
||||
pager.getLeft().setVisible(false);
|
||||
|
||||
pager.getRight().addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
setError(false, "");
|
||||
submitHandler();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
field_history_messages.setHeight("200px");
|
||||
field_history_messages.setResize(ResizeType.BOTH);
|
||||
field_current_message.setHeight("80px");
|
||||
field_current_message.setResize(ResizeType.BOTH);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update status view.
|
||||
*
|
||||
* @param folder the folder
|
||||
* @param syncStatus the sync status
|
||||
*/
|
||||
public void updateStatusView(WsFolder folder, ThSyncStatus syncStatus) {
|
||||
|
||||
field_loader.clear();
|
||||
LoaderIcon loader = new LoaderIcon("Waiting...");
|
||||
field_loader.add(loader);
|
||||
|
||||
this.folder = folder;
|
||||
this.field_current_message.setValue(UNKNOWN);
|
||||
setFieldValue(this.field_number_error, UNKNOWN);
|
||||
setFieldValue(this.field_queued_items, UNKNOWN);
|
||||
setFieldValue(this.field_transferred_items, UNKNOWN);
|
||||
this.field_history_messages.setValue(UNKNOWN);
|
||||
|
||||
if(folder==null || syncStatus==null || syncStatus.getProcessStatus()==null) {
|
||||
//setError(true, "Sync status error: either folder does not exist or the status is null");
|
||||
GWT.log("Sync status error: either folder does not exist or the status is null");
|
||||
return;
|
||||
}
|
||||
|
||||
ThProcessStatus process = syncStatus.getProcessStatus();
|
||||
|
||||
if(process.getPercentCompleted()>=0)
|
||||
progress_percentage.setPercent((int)process.getPercentCompleted()*100);
|
||||
|
||||
if(process.getStatus()!=null)
|
||||
|
||||
if(syncStatus.getProcessStatus().getStatus()!=null) {
|
||||
loader.setText(syncStatus.getProcessStatus().getStatus().toString());
|
||||
|
||||
switch (syncStatus.getProcessStatus().getStatus()) {
|
||||
case INITIALIZING:
|
||||
field_loader.clear();
|
||||
field_loader.add(new LoaderIcon(TRANSFERRING_STATE+Status.INITIALIZING.toString()));
|
||||
break;
|
||||
|
||||
case ONGOING:
|
||||
field_loader.clear();
|
||||
field_loader.add(new LoaderIcon(TRANSFERRING_STATE+Status.ONGOING.toString()));
|
||||
break;
|
||||
case WARNINGS:
|
||||
field_loader.clear();
|
||||
field_loader.add(new LoaderIcon(TRANSFERRING_STATE+Status.WARNINGS.toString()));
|
||||
break;
|
||||
case COMPLETED:
|
||||
field_loader.clear();
|
||||
Alert alert = new Alert("Transferring " +Status.COMPLETED.toString());
|
||||
alert.setClose(false);
|
||||
alert.setType(AlertType.SUCCESS);
|
||||
field_loader.add(alert);
|
||||
break;
|
||||
|
||||
case STOPPED:
|
||||
field_loader.clear();
|
||||
Alert alert1 = new Alert("Transferring " +Status.STOPPED.toString());
|
||||
alert1.setClose(false);
|
||||
alert1.setType(AlertType.WARNING);
|
||||
field_loader.add(alert1);
|
||||
//progress_percentage.setVisible(false);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(process.getCurrentMessage()!=null)
|
||||
this.field_current_message.setValue(process.getCurrentMessage());
|
||||
|
||||
if(process.getErrorCount()!=null)
|
||||
this.field_number_error.setValue(process.getErrorCount().toString());
|
||||
|
||||
|
||||
if(process.getQueuedTransfers()!=null)
|
||||
this.field_queued_items.setValue(process.getQueuedTransfers().toString());
|
||||
|
||||
if(process.getServedTransfers()!=null)
|
||||
this.field_transferred_items.setValue(process.getServedTransfers().toString());
|
||||
|
||||
if(process.getLogBuilder()!=null)
|
||||
this.field_history_messages.setValue(process.getLogBuilder().toString());
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the field value.
|
||||
*
|
||||
* @param box the box
|
||||
* @param value the value
|
||||
*/
|
||||
private void setFieldValue(TextBox box, String value) {
|
||||
box.setValue(value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Validate submit.
|
||||
*
|
||||
* @return true, if successful
|
||||
*/
|
||||
protected boolean validateSubmit() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the scheduler.
|
||||
*
|
||||
* @param schedulingTimer the new scheduler
|
||||
*/
|
||||
public void setScheduler(Timer schedulingTimer) {
|
||||
this.schedulerTime = schedulingTimer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the scheduling time.
|
||||
*
|
||||
* @return the scheduling time
|
||||
*/
|
||||
public Timer getSchedulerTime() {
|
||||
return schedulerTime;
|
||||
}
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
||||
<ui:style>
|
||||
.noBorder {
|
||||
border: 0px;
|
||||
}
|
||||
|
||||
.myWidth {
|
||||
width: 500px;
|
||||
}
|
||||
|
||||
.myPaddingLeft{
|
||||
padding-left: 180px;
|
||||
}
|
||||
.myLittleWidth {
|
||||
width: 20px;
|
||||
}
|
||||
|
||||
.myFormWidth {
|
||||
width: 750px;
|
||||
}
|
||||
</ui:style>
|
||||
<g:VerticalPanel>
|
||||
<g:HTMLPanel ui:field="form_monitor_thredds_transfer">
|
||||
<g:HTMLPanel ui:field="field_loader">
|
||||
</g:HTMLPanel>
|
||||
<b:ProgressBar type="DEFAULT" color="INFO" percent="0"
|
||||
ui:field="progress_percentage" />
|
||||
<b:Row addStyleNames="{style.myPaddingLeft}">
|
||||
<b:Column size="2">
|
||||
<b:ControlGroup ui:field="cg_queued_items">
|
||||
<b:ControlLabel for="cl_queued_items">Items in queue</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox b:id="field_queued_items" ui:field="field_queued_items"
|
||||
readOnly="true" addStyleNames="{style.myLittleWidth}"></b:TextBox>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
</b:Column>
|
||||
<b:Column size="2">
|
||||
<b:ControlGroup ui:field="cg_transferred_items">
|
||||
<b:ControlLabel for="cl_transferred_items">Transferred items</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox b:id="field_transferred_items" ui:field="field_transferred_items"
|
||||
readOnly="true" addStyleNames="{style.myLittleWidth}">
|
||||
</b:TextBox>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
</b:Column>
|
||||
<b:Column size="2">
|
||||
<b:ControlGroup ui:field="cg_number_error">
|
||||
<b:ControlLabel for="cl_number_error">Number of Errors</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox b:id="field_number_error" ui:field="field_number_error"
|
||||
readOnly="true" addStyleNames="{style.myLittleWidth}"></b:TextBox>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
</b:Column>
|
||||
</b:Row>
|
||||
<b:Form type="HORIZONTAL" addStyleNames="{style.myFormWidth}">
|
||||
<b:Fieldset styleName="{style.noBorder}">
|
||||
<!-- <b:ControlGroup ui:field="cg_status"> -->
|
||||
<!-- <b:ControlLabel for="cl_status">Status</b:ControlLabel> -->
|
||||
<!-- <b:Controls> -->
|
||||
<!-- <b:TextBox b:id="field_status" ui:field="field_status" -->
|
||||
<!-- readOnly="true" addStyleNames="{style.myWidth}"></b:TextBox> -->
|
||||
<!-- </b:Controls> -->
|
||||
<!-- </b:ControlGroup> -->
|
||||
<b:ControlGroup ui:field="cg_current_message">
|
||||
<b:ControlLabel for="cl_current_message">Status Message</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextArea b:id="field_current_message" ui:field="field_current_message"
|
||||
readOnly="true" addStyleNames="{style.myWidth}"></b:TextArea>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
|
||||
<b:ControlGroup ui:field="cg_history_messages">
|
||||
<b:ControlLabel for="cl_history_messages">Transfer History</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextArea b:id="field_history_messages" ui:field="field_history_messages"
|
||||
readOnly="true" addStyleNames="{style.myWidth}"></b:TextArea>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
|
||||
<!-- <b:ControlGroup ui:field="cg_last_sync"> -->
|
||||
<!-- <b:ControlLabel for="cl_last_sync">Last Sync Time</b:ControlLabel> -->
|
||||
<!-- <b:Controls> -->
|
||||
<!-- <b:TextBox b:id="field_last_sync" ui:field="field_last_sync" -->
|
||||
<!-- readOnly="true"></b:TextBox> -->
|
||||
<!-- </b:Controls> -->
|
||||
<!-- </b:ControlGroup> -->
|
||||
</b:Fieldset>
|
||||
</b:Form>
|
||||
</g:HTMLPanel>
|
||||
<b:Pager left="" right="Close Monitor" aligned="true"
|
||||
ui:field="pager" />
|
||||
</g:VerticalPanel>
|
||||
</ui:UiBinder>
|
@ -0,0 +1,320 @@
|
||||
package org.gcube.portlets.widgets.wsthreddssync.client.view.binder;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.portal.wssynclibrary.shared.thredds.ThProcessDescriptor;
|
||||
import org.gcube.portal.wssynclibrary.shared.thredds.ThSyncFolderDescriptor;
|
||||
import org.gcube.portal.wssynclibrary.shared.thredds.ThSynchFolderConfiguration;
|
||||
import org.gcube.portlets.widgets.wsthreddssync.client.WsThreddsWidget;
|
||||
import org.gcube.portlets.widgets.wsthreddssync.shared.GcubeVRE;
|
||||
import org.gcube.portlets.widgets.wsthreddssync.shared.WsFolder;
|
||||
import org.gcube.portlets.widgets.wsthreddssync.shared.WsThreddsSynchFolderDescriptor;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.ControlGroup;
|
||||
import com.github.gwtbootstrap.client.ui.ListBox;
|
||||
import com.github.gwtbootstrap.client.ui.Pager;
|
||||
import com.github.gwtbootstrap.client.ui.TextBox;
|
||||
import com.github.gwtbootstrap.client.ui.constants.ControlGroupType;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class ShowThreddsFolderInfoView.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Feb 15, 2018
|
||||
*/
|
||||
public abstract class ShowThreddsFolderInfoView extends Composite {
|
||||
|
||||
private static final String DATE_FORMAT_YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
|
||||
|
||||
|
||||
/** The ui binder. */
|
||||
private static ShowThreddsFolderInfoViewUiBinder uiBinder =
|
||||
GWT.create(ShowThreddsFolderInfoViewUiBinder.class);
|
||||
|
||||
/**
|
||||
* The Interface ShowThreddsFolderInfoViewUiBinder.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Feb 15, 2018
|
||||
*/
|
||||
interface ShowThreddsFolderInfoViewUiBinder
|
||||
extends UiBinder<Widget, ShowThreddsFolderInfoView> {
|
||||
}
|
||||
|
||||
|
||||
@UiField
|
||||
TextBox field_folder_status;
|
||||
|
||||
@UiField
|
||||
ListBox field_select_vre;
|
||||
|
||||
|
||||
@UiField
|
||||
TextBox field_catalogue_name;
|
||||
|
||||
|
||||
@UiField
|
||||
TextBox field_remote_path;
|
||||
|
||||
@UiField
|
||||
TextBox field_folder_path;
|
||||
|
||||
|
||||
@UiField
|
||||
TextBox field_folder_locked;
|
||||
|
||||
|
||||
/*@UiField
|
||||
TextBox field_last_sync;
|
||||
*/
|
||||
|
||||
|
||||
@UiField
|
||||
ControlGroup cg_catalogue_name;
|
||||
|
||||
|
||||
@UiField
|
||||
ControlGroup cg_remote_path;
|
||||
|
||||
@UiField
|
||||
HTMLPanel form_unit_fields;
|
||||
|
||||
@UiField
|
||||
Pager pager;
|
||||
|
||||
|
||||
|
||||
/** The folder id. */
|
||||
private String folderId;
|
||||
|
||||
/** The map VR es. */
|
||||
private Map<String, GcubeVRE> mapVREs = new HashMap<String, GcubeVRE>();
|
||||
|
||||
|
||||
private boolean isCreateConfiguration;
|
||||
|
||||
|
||||
public static enum SUBMIT_ACTION {CREATE_UPDATE_CONFIGURATION, DO_SYNC};
|
||||
|
||||
/**
|
||||
* Submit handler.
|
||||
*/
|
||||
public abstract void submitHandler(SUBMIT_ACTION action);
|
||||
|
||||
/**
|
||||
* Sets the error.
|
||||
*
|
||||
* @param visible the visible
|
||||
* @param error the error
|
||||
*/
|
||||
public abstract void setError(boolean visible, String error);
|
||||
|
||||
|
||||
/**
|
||||
* Because this class has a default constructor, it can
|
||||
* be used as a binder template. In other words, it can be used in other
|
||||
* *.ui.xml files as follows:
|
||||
* <ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||
* xmlns:g="urn:import:**user's package**">
|
||||
* <g:**UserClassName**>Hello!</g:**UserClassName>
|
||||
* </ui:UiBinder>
|
||||
* Note that depending on the widget that is used, it may be necessary to
|
||||
* implement HasHTML instead of HasText.
|
||||
*
|
||||
* @param folderId the folder id
|
||||
* @param isCreateConfiguration the is create configuration
|
||||
*/
|
||||
public ShowThreddsFolderInfoView(String folderId, boolean isCreateConfiguration) {
|
||||
this.folderId = folderId;
|
||||
this.isCreateConfiguration = isCreateConfiguration;
|
||||
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
|
||||
pager.getLeft().addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
setError(false, "");
|
||||
submitHandler(SUBMIT_ACTION.CREATE_UPDATE_CONFIGURATION);
|
||||
}
|
||||
});
|
||||
|
||||
pager.getRight().addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
setError(false, "");
|
||||
//boolean isValid = validateSubmit();
|
||||
//if(isValid)
|
||||
submitHandler(SUBMIT_ACTION.DO_SYNC);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
if(isCreateConfiguration) {
|
||||
WsThreddsWidget.wsThreddsSyncService.getListOfVREsForLoggedUser(new AsyncCallback<List<GcubeVRE>>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<GcubeVRE> result) {
|
||||
|
||||
|
||||
for (GcubeVRE gcubeVRE : result) {
|
||||
mapVREs.put(gcubeVRE.getVreScope(), gcubeVRE);
|
||||
field_select_vre.addItem(gcubeVRE.getVreScope(), gcubeVRE.getVreName());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Update view to result.
|
||||
*
|
||||
* @param folder the folder
|
||||
* @param syncFolderDesc the sync folder desc
|
||||
*/
|
||||
public void updateViewToResult(WsFolder folder, WsThreddsSynchFolderDescriptor syncFolderDesc) {
|
||||
|
||||
this.field_select_vre.clear();
|
||||
|
||||
if(syncFolderDesc==null) {
|
||||
pager.getRight().setVisible(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if(syncFolderDesc.getSyncStatus()!=null) {
|
||||
this.field_folder_status.setValue(syncFolderDesc.getSyncStatus().toString());
|
||||
}
|
||||
|
||||
if(syncFolderDesc.getSelectedVRE()!=null) {
|
||||
this.field_select_vre.addItem(syncFolderDesc.getSelectedVRE().getVreScope(), syncFolderDesc.getSelectedVRE().getVreName());
|
||||
this.field_select_vre.setValue(0, syncFolderDesc.getSelectedVRE().getVreName());
|
||||
this.field_select_vre.setSelectedValue(syncFolderDesc.getSelectedVRE().getVreName());
|
||||
}
|
||||
|
||||
ThSyncFolderDescriptor sfd = syncFolderDesc.getServerFolderDescriptor();
|
||||
if(sfd!=null) {
|
||||
|
||||
this.field_folder_path.setValue(sfd.getFolderPath());
|
||||
this.field_folder_path.setTitle(sfd.getFolderPath());
|
||||
this.field_folder_locked.setValue(sfd.isLocked()+"");
|
||||
|
||||
ThSynchFolderConfiguration config = sfd.getConfiguration();
|
||||
|
||||
if(config!=null) {
|
||||
this.field_catalogue_name.setValue(config.getToCreateCatalogName());
|
||||
this.field_catalogue_name.setTitle(config.getToCreateCatalogName());
|
||||
this.field_remote_path.setValue(config.getRemotePath());
|
||||
this.field_remote_path.setTitle(config.getRemotePath());
|
||||
}
|
||||
|
||||
|
||||
ThProcessDescriptor lpd = sfd.getLocalProcessDescriptor();
|
||||
if(lpd!=null) {
|
||||
//this.field_last_sync.setValue(DateTimeFormat.getFormat(DATE_FORMAT_YYYY_MM_DD_HH_MM_SS).format(new Date(lpd.getLaunchTime())));
|
||||
ThSynchFolderConfiguration sc = lpd.getSynchConfiguration();
|
||||
if(sc!=null) {
|
||||
|
||||
//this.field_select_vre.setValue(sc.get, value);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isCreateConfiguration() {
|
||||
return isCreateConfiguration;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Validate submit.
|
||||
*
|
||||
* @return true, if successful
|
||||
*/
|
||||
protected boolean validateSubmit() {
|
||||
cg_catalogue_name.setType(ControlGroupType.NONE);
|
||||
cg_remote_path.setType(ControlGroupType.NONE);
|
||||
|
||||
if(field_catalogue_name.getValue()==null || field_catalogue_name.getValue().isEmpty()){
|
||||
cg_catalogue_name.setType(ControlGroupType.ERROR);
|
||||
setError(true, "Unit Title field is required");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(field_remote_path.getValue()==null || field_remote_path.getValue().isEmpty()){
|
||||
cg_remote_path.setType(ControlGroupType.ERROR);
|
||||
setError(true, "Folder Name field is required");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the remote path.
|
||||
*
|
||||
* @return the remote path
|
||||
*/
|
||||
public String getRemotePath() {
|
||||
return field_remote_path.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the catalogue name.
|
||||
*
|
||||
* @return the catalogue name
|
||||
*/
|
||||
public String getCatalogueName(){
|
||||
return field_catalogue_name.getValue();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the unit description.
|
||||
*
|
||||
* @return the unit description
|
||||
*/
|
||||
public GcubeVRE getSelectedVRE(){
|
||||
String item = field_select_vre.getSelectedItemText();
|
||||
String text = field_select_vre.getSelectedValue();
|
||||
return mapVREs.get(item);
|
||||
}
|
||||
|
||||
|
||||
public Pager getPager() {
|
||||
return pager;
|
||||
}
|
||||
|
||||
public HTMLPanel getMainPanel(){
|
||||
return form_unit_fields;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
||||
<ui:style>
|
||||
.noBorder {
|
||||
border: 0px;
|
||||
}
|
||||
</ui:style>
|
||||
<g:HTMLPanel>
|
||||
<g:HTMLPanel ui:field="form_unit_fields">
|
||||
<b:Form type="HORIZONTAL">
|
||||
<b:Fieldset styleName="{style.noBorder}">
|
||||
<b:ControlGroup ui:field="cg_folder_status">
|
||||
<b:ControlLabel for="cl_folder_status">Sync Status</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox b:id="field_folder_status" ui:field="field_folder_status"
|
||||
readOnly="true"></b:TextBox>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
<b:ControlGroup ui:field="cg_folder_path">
|
||||
<b:ControlLabel for="cl_folder_path">Folder Path</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox b:id="field_catalogue_name" ui:field="field_folder_path"
|
||||
readOnly="true"></b:TextBox>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
<b:ControlGroup ui:field="cg_folder_locked">
|
||||
<b:ControlLabel for="cl_folder_locked">Locked</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox b:id="field_folder_locked" ui:field="field_folder_locked"
|
||||
readOnly="true"></b:TextBox>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
<b:ControlGroup ui:field="cg_catalogue_name">
|
||||
<b:ControlLabel for="cl_catalogue_name">Catalogue Name</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox b:id="field_catalogue_name" ui:field="field_catalogue_name"
|
||||
readOnly="true"></b:TextBox>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
|
||||
<b:ControlGroup ui:field="cg_unit_description">
|
||||
<b:ControlLabel for="cl_course_description">Published in the VRE</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:ListBox b:id="field_select_vre" ui:field="field_select_vre">
|
||||
</b:ListBox>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
|
||||
<b:ControlGroup ui:field="cg_remote_path">
|
||||
<b:ControlLabel for="cl_remote_path">Remote Path</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox b:id="field_remote_path" ui:field="field_remote_path"
|
||||
readOnly="true"></b:TextBox>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
|
||||
<!-- <b:ControlGroup ui:field="cg_last_sync"> -->
|
||||
<!-- <b:ControlLabel for="cl_last_sync">Last Sync Time</b:ControlLabel> -->
|
||||
<!-- <b:Controls> -->
|
||||
<!-- <b:TextBox b:id="field_last_sync" ui:field="field_last_sync" -->
|
||||
<!-- readOnly="true"></b:TextBox> -->
|
||||
<!-- </b:Controls> -->
|
||||
<!-- </b:ControlGroup> -->
|
||||
</b:Fieldset>
|
||||
</b:Form>
|
||||
</g:HTMLPanel>
|
||||
<b:Pager left="Update Configuration" right="Do Synchronize"
|
||||
aligned="true" ui:field="pager" />
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
@ -0,0 +1,8 @@
|
||||
/** Add css rules here for your application. */
|
||||
|
||||
.ws-thredds-modal-body div.modal-body {
|
||||
position: relative;
|
||||
max-height: 600px !important;
|
||||
padding: 15px;
|
||||
overflow-y: auto;
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
package org.gcube.portlets.widgets.wsthreddssync.server;
|
||||
|
||||
import static org.gcube.common.authorization.client.Constants.authorizationService;
|
||||
|
||||
import org.gcube.common.authorization.library.AuthorizationEntry;
|
||||
import org.gcube.portal.wssynclibrary.shared.thredds.Sync_Status;
|
||||
import org.gcube.portal.wssynclibrary.shared.thredds.ThSyncFolderDescriptor;
|
||||
import org.gcube.portal.wssynclibrary.shared.thredds.ThSynchFolderConfiguration;
|
||||
import org.gcube.portlets.widgets.wsthreddssync.shared.GcubeVRE;
|
||||
import org.gcube.portlets.widgets.wsthreddssync.shared.WsThreddsSynchFolderConfiguration;
|
||||
import org.gcube.portlets.widgets.wsthreddssync.shared.WsThreddsSynchFolderDescriptor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class BeanConverter.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Feb 16, 2018
|
||||
*/
|
||||
public class BeanConverter {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(BeanConverter.class);
|
||||
|
||||
/**
|
||||
* To ws thredds folder config.
|
||||
*
|
||||
* @param t the t
|
||||
* @param theStatus the the status
|
||||
* @return the ws thredds synch folder descriptor
|
||||
*/
|
||||
public static WsThreddsSynchFolderDescriptor toWsThreddsFolderConfig(ThSyncFolderDescriptor t, Sync_Status theStatus) {
|
||||
|
||||
if(t==null)
|
||||
return null;
|
||||
|
||||
WsThreddsSynchFolderDescriptor ws = new WsThreddsSynchFolderDescriptor();
|
||||
ws.setServerFolderDescriptor(t);
|
||||
ws.setSyncStatus(theStatus);
|
||||
|
||||
//FROM TARGET TOKEN TO SCOPE
|
||||
//t.getConfiguration().getTargetToken()
|
||||
|
||||
if(t.getConfiguration().getTargetToken()!=null) {
|
||||
try {
|
||||
AuthorizationEntry entry = authorizationService().get(t.getConfiguration().getTargetToken());
|
||||
String scope = entry.getContext();
|
||||
GcubeVRE selectedVRE = new GcubeVRE(scope, scope);
|
||||
ws.setSelectedVRE(selectedVRE);
|
||||
logger.debug("Resolved VRE: "+selectedVRE +" from token");
|
||||
}catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return ws;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* To th synch folder configuration.
|
||||
*
|
||||
* @param t the t
|
||||
* @param targetScopeUserToken the target scope user token
|
||||
* @return the th synch folder configuration
|
||||
*/
|
||||
public static ThSynchFolderConfiguration toThSynchFolderConfiguration(WsThreddsSynchFolderConfiguration t, String targetScopeUserToken) {
|
||||
|
||||
if(t==null)
|
||||
return null;
|
||||
|
||||
ThSynchFolderConfiguration ts = new ThSynchFolderConfiguration();
|
||||
ts.setFilter(t.getFilter());
|
||||
ts.setRemotePath(t.getRemotePath());
|
||||
ts.setTargetToken(targetScopeUserToken);
|
||||
ts.setToCreateCatalogName(t.getCatalogName());
|
||||
return ts;
|
||||
|
||||
};
|
||||
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
package org.gcube.portlets.widgets.wsthreddssync.server;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.gcube.portlets.widgets.wsthreddssync.shared.TransferOnThreddsReport;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class SessionUtil {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(SessionUtil.class);
|
||||
|
||||
public static final String FOLDER_SYNCRONIZE_WITH_THREDDS = "Folder_Syncronize_With_Thredds";
|
||||
|
||||
/**
|
||||
* Sets the folder publishing on thredds.
|
||||
*
|
||||
* @param session the session
|
||||
* @param report the report
|
||||
*/
|
||||
public static void setTransferPublishingOnThredds(HttpSession session, TransferOnThreddsReport report){
|
||||
|
||||
Map<String, TransferOnThreddsReport> map = getMapTransferPublishingOnThredds(session);
|
||||
|
||||
if(map!=null)
|
||||
map.put(report.getTransferId(), report);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the folder publishing on thredds.
|
||||
*
|
||||
* @param session the session
|
||||
* @return the folder publishing on thredds
|
||||
*/
|
||||
public static Map<String, TransferOnThreddsReport> getMapTransferPublishingOnThredds(HttpSession session){
|
||||
|
||||
Map<String, TransferOnThreddsReport> map = null;
|
||||
try{
|
||||
|
||||
map = (Map<String,TransferOnThreddsReport>) session.getAttribute(FOLDER_SYNCRONIZE_WITH_THREDDS);
|
||||
|
||||
if(map==null){
|
||||
logger.info("Creating new map to trace syncronize with thredds... ");
|
||||
map = new HashMap<String, TransferOnThreddsReport>();
|
||||
session.setAttribute(FOLDER_SYNCRONIZE_WITH_THREDDS, map);
|
||||
}
|
||||
|
||||
}catch (Exception e) {
|
||||
logger.error("an error occurred instancing PropertySpecialFolderReader ",e);
|
||||
}
|
||||
|
||||
return map;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Ge transfer publishing on thredds for id.
|
||||
*
|
||||
* @param session the session
|
||||
* @param transferId the transfer id
|
||||
* @return the transfer on thredds report
|
||||
*/
|
||||
public static TransferOnThreddsReport geTransferPublishingOnThreddsForId(HttpSession session, String transferId){
|
||||
|
||||
Map<String, TransferOnThreddsReport> map = getMapTransferPublishingOnThredds(session);
|
||||
|
||||
if(map!=null){
|
||||
return map.get(transferId);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Prints the as sys out.
|
||||
*
|
||||
* @param txt the txt
|
||||
*/
|
||||
public static void printAsSysOut(String txt) {
|
||||
|
||||
System.out.println(txt);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,207 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.wsthreddssync.server;
|
||||
|
||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.portal.wssynclibrary.shared.ItemNotSynched;
|
||||
import org.gcube.portal.wssynclibrary.shared.thredds.Sync_Status;
|
||||
import org.gcube.portal.wssynclibrary.shared.thredds.ThSyncFolderDescriptor;
|
||||
import org.gcube.portal.wssynclibrary.shared.thredds.ThSyncStatus;
|
||||
import org.gcube.portal.wssynclibrary.shared.thredds.ThSynchFolderConfiguration;
|
||||
import org.gcube.portal.wssynclibrary.thredds.WorkspaceThreddsSynchronize;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class SyncronizeWithThredds.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Feb 7, 2018
|
||||
*/
|
||||
public class SyncronizeWithThredds {
|
||||
|
||||
|
||||
/** The logger. */
|
||||
private Logger logger = LoggerFactory.getLogger(SyncronizeWithThredds.class);
|
||||
|
||||
/** The workspace thredds synchronize. */
|
||||
private WorkspaceThreddsSynchronize workspaceThreddsSynchronize;
|
||||
|
||||
/** The Constant sdf. */
|
||||
//private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss");
|
||||
|
||||
|
||||
/**
|
||||
* Instantiates a new publish on thredds.
|
||||
*
|
||||
* @param wsScopeUserToken the ws scope user token
|
||||
* @param username the username
|
||||
* @param httpSession the http session
|
||||
*/
|
||||
public SyncronizeWithThredds() {
|
||||
this.workspaceThreddsSynchronize = WorkspaceThreddsSynchronize.getInstance();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the context parameters.
|
||||
*
|
||||
* @param scope the scope
|
||||
* @param userToken the user token
|
||||
*/
|
||||
private void setContextParameters(String scope, String userToken) {
|
||||
logger.debug("Setting context parameters, scope: "+scope +", user token: "+userToken);
|
||||
ScopeProvider.instance.set(scope);
|
||||
SecurityTokenProvider.instance.set(userToken);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Do sync folder.
|
||||
*
|
||||
* @param folderId the folder id
|
||||
* @param thConfig the th config
|
||||
* @param scope the scope
|
||||
* @param userToken the user token
|
||||
* @return the th sync status
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
public synchronized ThSyncStatus doSyncFolder(final String folderId, ThSynchFolderConfiguration thConfig, String scope, String userToken) throws Exception{
|
||||
logger.debug("Perfoming doSynFolder on folderId: "+folderId);
|
||||
boolean firstSync = false;
|
||||
|
||||
try {
|
||||
setContextParameters(scope, userToken);
|
||||
ThSyncFolderDescriptor folder = workspaceThreddsSynchronize.checkItemSynched(folderId);
|
||||
}catch (ItemNotSynched e) {
|
||||
firstSync = true;
|
||||
// TODO: handle exception
|
||||
}catch (Exception e) {
|
||||
logger.error("Error on check item sync: ",e);
|
||||
throw new Exception("Sorry an error occurred during folder publishing, refresh and try again");
|
||||
}
|
||||
|
||||
try{
|
||||
|
||||
if(firstSync) {
|
||||
if(thConfig==null)
|
||||
throw new Exception("A valid folder configuration must be provided to perforom synchronization");
|
||||
|
||||
logger.info("First sync setting synchronized folder configuration: "+thConfig);
|
||||
workspaceThreddsSynchronize.setSynchronizedFolder(thConfig, folderId);
|
||||
}
|
||||
|
||||
logger.info("Calling do sync on folder id: "+folderId);
|
||||
return workspaceThreddsSynchronize.doSync(folderId);
|
||||
//SessionUtil.setTransferPublishingOnThredds(httpSession, status);
|
||||
}catch (Exception e) {
|
||||
logger.error("Error on do sync: ",e);
|
||||
throw new Exception(e.getMessage() +", refresh and try again");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets the synched status from item property.
|
||||
*
|
||||
* @param folderId the folder id
|
||||
* @param scope the scope
|
||||
* @param username the username
|
||||
* @return the synched status from item property
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
public Sync_Status getSynchedStatusFromItemProperty(String folderId, String scope, String username) throws Exception{
|
||||
|
||||
try {
|
||||
try {
|
||||
ScopeProvider.instance.set(scope);
|
||||
return workspaceThreddsSynchronize.getSynchedStatusFromItemProperty(folderId, username);
|
||||
}catch (ItemNotSynched e) {
|
||||
logger.info("The folder id: "+folderId +" is not synched returning null as "+Sync_Status.class.getSimpleName());
|
||||
return null;
|
||||
}
|
||||
|
||||
}catch (Exception e) {
|
||||
logger.error("Error on isItemSynched for id: "+folderId, e);
|
||||
throw new Exception("Sorry an error occurred during read sync status from HL properties, try again later");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if is item synched.
|
||||
*
|
||||
* @param folderId the folder id
|
||||
* @param scope the scope
|
||||
* @param username the username
|
||||
* @return true, if is item synched
|
||||
* @throws ItemNotSynched the item not synched
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
public boolean isItemSynched(String folderId, String scope, String username) throws ItemNotSynched, Exception{
|
||||
|
||||
Sync_Status value = getSynchedStatusFromItemProperty(folderId, scope, username);
|
||||
|
||||
if(value!=null)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check item synched.
|
||||
*
|
||||
* @param folderId the folder id
|
||||
* @param scope the scope
|
||||
* @param userToken the user token
|
||||
* @return the th sync folder descriptor
|
||||
* @throws ItemNotSynched the item not synched
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
public ThSyncFolderDescriptor checkItemSynched(String folderId, String scope, String userToken) throws ItemNotSynched, Exception{
|
||||
|
||||
setContextParameters(scope, userToken);
|
||||
return workspaceThreddsSynchronize.checkItemSynched(folderId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the sync status.
|
||||
*
|
||||
* @param itemId the item id
|
||||
* @param scope the scope
|
||||
* @param userToken the user token
|
||||
* @return the sync status
|
||||
* @throws ItemNotSynched the item not synched
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
public ThSyncStatus monitorSyncStatus(String itemId, String scope, String userToken) throws ItemNotSynched, Exception{
|
||||
|
||||
setContextParameters(scope, userToken);
|
||||
return workspaceThreddsSynchronize.monitorSyncStatus(itemId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Register callback for id.
|
||||
*
|
||||
* @param folderId the folder id
|
||||
* @param scope the scope
|
||||
* @param userToken the user token
|
||||
* @throws Exception
|
||||
*/
|
||||
public void registerCallbackForId(String folderId, String scope, String userToken) throws Exception {
|
||||
setContextParameters(scope, userToken);
|
||||
workspaceThreddsSynchronize.registerCallbackForId(folderId);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,231 @@
|
||||
package org.gcube.portlets.widgets.wsthreddssync.server;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.common.portal.PortalContext;
|
||||
import org.gcube.portal.wssynclibrary.shared.ItemNotSynched;
|
||||
import org.gcube.portal.wssynclibrary.shared.thredds.Sync_Status;
|
||||
import org.gcube.portal.wssynclibrary.shared.thredds.ThSyncFolderDescriptor;
|
||||
import org.gcube.portal.wssynclibrary.shared.thredds.ThSyncStatus;
|
||||
import org.gcube.portal.wssynclibrary.shared.thredds.ThSynchFolderConfiguration;
|
||||
import org.gcube.portlets.widgets.wsthreddssync.client.rpc.ThreddsWorkspaceSyncService;
|
||||
import org.gcube.portlets.widgets.wsthreddssync.shared.GcubeVRE;
|
||||
import org.gcube.portlets.widgets.wsthreddssync.shared.WsThreddsSynchFolderConfiguration;
|
||||
import org.gcube.portlets.widgets.wsthreddssync.shared.WsThreddsSynchFolderDescriptor;
|
||||
import org.gcube.vomanagement.usermanagement.GroupManager;
|
||||
import org.gcube.vomanagement.usermanagement.exception.GroupRetrievalFault;
|
||||
import org.gcube.vomanagement.usermanagement.exception.UserManagementSystemException;
|
||||
import org.gcube.vomanagement.usermanagement.exception.UserRetrievalFault;
|
||||
import org.gcube.vomanagement.usermanagement.impl.LiferayGroupManager;
|
||||
import org.gcube.vomanagement.usermanagement.model.GCubeGroup;
|
||||
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
||||
import com.liferay.portal.service.UserLocalServiceUtil;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The server side implementation of the RPC service.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Feb 14, 2018
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class ThreddsWorkspaceSyncServiceImpl extends RemoteServiceServlet implements ThreddsWorkspaceSyncService {
|
||||
|
||||
/** The logger. */
|
||||
private static Logger logger = LoggerFactory.getLogger(ThreddsWorkspaceSyncServiceImpl.class);
|
||||
|
||||
/** The sync thredds. */
|
||||
private SyncronizeWithThredds syncThredds = null;
|
||||
|
||||
/**
|
||||
* Gets the sync service.
|
||||
*
|
||||
* @return the sync service
|
||||
*/
|
||||
public synchronized SyncronizeWithThredds getSyncService() {
|
||||
|
||||
if(syncThredds==null)
|
||||
syncThredds = new SyncronizeWithThredds();
|
||||
|
||||
return syncThredds;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is within portal.
|
||||
*
|
||||
* @return true if you're running into the portal, false if in development
|
||||
*/
|
||||
public static boolean isWithinPortal() {
|
||||
try {
|
||||
UserLocalServiceUtil.getService();
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
logger.trace("Development Mode ON");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Do sync folder.
|
||||
*
|
||||
* @param folderId the folder id
|
||||
* @param clientConfig the th config
|
||||
* @return the th sync status
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.portlets.widgets.wsthreddssync.client.rpc.ThreddsWorkspaceSyncService#doSyncFolder(java.lang.String, org.gcube.portlets.widgets.wsthreddssync.shared.WsThreddsSynchFolderDescriptor)
|
||||
*/
|
||||
@Override
|
||||
public ThSyncStatus doSyncFolder(final String folderId, WsThreddsSynchFolderConfiguration clientConfig) throws Exception{
|
||||
logger.info("Performing doSyncFolder method on id: "+folderId +", config: "+clientConfig);
|
||||
|
||||
// String scope = PortalContext.getConfiguration().getCurrentScope(this.getThreadLocalRequest());
|
||||
// GCubeUser username = PortalContext.getConfiguration().getCurrentUser(this.getThreadLocalRequest());
|
||||
// String groupName = PortalContext.getConfiguration().getCurrentGroupName(this.getThreadLocalRequest());
|
||||
// new GcubeVRE(groupName, scope)
|
||||
try {
|
||||
GCubeUser user = PortalContext.getConfiguration().getCurrentUser(this.getThreadLocalRequest());
|
||||
//String wsScope = PortalContext.getConfiguration().getCurrentScope(this.getThreadLocalRequest());
|
||||
//String wsUserToken = PortalContext.getConfiguration().getCurrentUserToken(wsScope, user.getUsername());
|
||||
String targetScopeUserToken = null;
|
||||
ThSynchFolderConfiguration config = null;
|
||||
if(clientConfig!=null) {
|
||||
targetScopeUserToken = PortalContext.getConfiguration().getCurrentUserToken(clientConfig.getTheVRE().getVreScope(), user.getUsername());
|
||||
config = BeanConverter.toThSynchFolderConfiguration(clientConfig, targetScopeUserToken);
|
||||
logger.debug("Creating server config "+config);
|
||||
}
|
||||
|
||||
logger.info("Calling doSyncFolder on folderId: "+folderId +", config: "+config);
|
||||
String wsScope = PortalContext.getConfiguration().getCurrentScope(this.getThreadLocalRequest());
|
||||
String wsUserToken = PortalContext.getConfiguration().getCurrentUserToken(wsScope, user.getUsername());
|
||||
ThSyncStatus status = getSyncService().doSyncFolder(folderId, config, wsScope, wsUserToken);
|
||||
logger.debug("Returning for folderId "+folderId+" the syncStatus: "+status);
|
||||
return status;
|
||||
}catch (Exception e) {
|
||||
logger.error("Do sync Folder error: ",e);
|
||||
throw new Exception("Sorry, an error occurred during synchonization phase, try again later");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the list of VR es for logged user.
|
||||
*
|
||||
* @return the list of VR es for logged user
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
@Override
|
||||
public List<GcubeVRE> getListOfVREsForLoggedUser() throws Exception{
|
||||
logger.debug("getListOfVREsForLoggedUser...: ");
|
||||
SessionUtil.printAsSysOut("\n\n\n\n getListOfVREsForLoggedUser");
|
||||
//PortalContextInfo context = WsUtil.getPortalContext(this.getThreadLocalRequest());
|
||||
GCubeUser user = PortalContext.getConfiguration().getCurrentUser(this.getThreadLocalRequest());
|
||||
long userId = user.getUserId();
|
||||
|
||||
// Instanciate the manager
|
||||
GroupManager groupManager = new LiferayGroupManager();
|
||||
List<GcubeVRE> listOfVres = new ArrayList<GcubeVRE>();
|
||||
|
||||
if (!isWithinPortal()){
|
||||
listOfVres.add(new GcubeVRE("devVRE", "/gcube/devsec/devVRE"));
|
||||
listOfVres.add(new GcubeVRE("NextNext", "/gcube/devNext/NextNext"));
|
||||
return listOfVres;
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
List<GCubeGroup> listOfGroups = groupManager.listGroupsByUser(userId);
|
||||
for (GCubeGroup gCubeGroup : listOfGroups) {
|
||||
if(groupManager.isVRE(gCubeGroup.getGroupId())){
|
||||
GcubeVRE gcubeVRE = new GcubeVRE(gCubeGroup.getGroupName(), groupManager.getInfrastructureScope(gCubeGroup.getGroupId()));
|
||||
listOfVres.add(gcubeVRE);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch (UserRetrievalFault | UserManagementSystemException
|
||||
| GroupRetrievalFault e) {
|
||||
logger.error("Error occurred server-side getting VRE folders: ", e);
|
||||
throw new Exception("Sorry, an error occurred server-side getting VRE folders, try again later");
|
||||
}
|
||||
|
||||
logger.info("Returning list of VREs: "+listOfVres);
|
||||
return listOfVres;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.portlets.widgets.wsthreddssync.client.rpc.ThreddsWorkspaceSyncService#isItemSynched(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public WsThreddsSynchFolderDescriptor isItemSynched(String folderId) throws Exception{
|
||||
|
||||
logger.debug("Performing isItemSynched for foldeId: "+folderId);
|
||||
|
||||
try {
|
||||
|
||||
GCubeUser user = PortalContext.getConfiguration().getCurrentUser(this.getThreadLocalRequest());
|
||||
String wsScope = PortalContext.getConfiguration().getCurrentScope(this.getThreadLocalRequest());
|
||||
Sync_Status theStatus = getSyncService().getSynchedStatusFromItemProperty(folderId, wsScope, user.getUsername());
|
||||
|
||||
if(theStatus!=null) {
|
||||
logger.info("Folder id: "+folderId+" is synched");
|
||||
String wsUserToken = PortalContext.getConfiguration().getCurrentUserToken(wsScope, user.getUsername());
|
||||
ThSyncFolderDescriptor serverFolderSync = getSyncService().checkItemSynched(folderId,wsScope,wsUserToken);
|
||||
WsThreddsSynchFolderDescriptor toWsThreddFolder = BeanConverter.toWsThreddsFolderConfig(serverFolderSync, theStatus);
|
||||
logger.debug("IsItemSynched for id: "+folderId +" returning: "+toWsThreddFolder);
|
||||
return toWsThreddFolder;
|
||||
}
|
||||
|
||||
logger.info("Folder id: "+folderId+" is not synched, returning null descriptor");
|
||||
return null;
|
||||
|
||||
} catch (ItemNotSynched e) {
|
||||
logger.info("The folderId: "+folderId +" is not synched, returning null FolderDescriptor");
|
||||
return null;
|
||||
}catch (Exception e) {
|
||||
logger.info("Error on isItemSynched for folderId: "+folderId, e);
|
||||
throw new Exception(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Register callback for id.
|
||||
*
|
||||
* @param folderId the folder id
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
public void registerCallbackForId(String folderId) throws Exception{
|
||||
GCubeUser user = PortalContext.getConfiguration().getCurrentUser(this.getThreadLocalRequest());
|
||||
String wsScope = PortalContext.getConfiguration().getCurrentScope(this.getThreadLocalRequest());
|
||||
String wsUserToken = PortalContext.getConfiguration().getCurrentUserToken(wsScope, user.getUsername());
|
||||
getSyncService().registerCallbackForId(folderId, wsScope, wsUserToken);
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.portlets.widgets.wsthreddssync.client.rpc.ThreddsWorkspaceSyncService#monitorSyncStatus(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public ThSyncStatus monitorSyncStatus(String folderId) throws ItemNotSynched, Exception{
|
||||
GCubeUser user = PortalContext.getConfiguration().getCurrentUser(this.getThreadLocalRequest());
|
||||
String wsScope = PortalContext.getConfiguration().getCurrentScope(this.getThreadLocalRequest());
|
||||
String wsUserToken = PortalContext.getConfiguration().getCurrentUserToken(wsScope, user.getUsername());
|
||||
return getSyncService().monitorSyncStatus(folderId, wsScope, wsUserToken);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.wsthreddssync.server;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.gcube.common.homelibrary.home.HomeLibrary;
|
||||
import org.gcube.common.homelibrary.home.exceptions.HomeNotFoundException;
|
||||
import org.gcube.common.homelibrary.home.exceptions.InternalErrorException;
|
||||
import org.gcube.common.homelibrary.home.workspace.Workspace;
|
||||
import org.gcube.common.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException;
|
||||
import org.gcube.common.portal.PortalContext;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.liferay.portal.service.UserLocalServiceUtil;
|
||||
|
||||
|
||||
/**
|
||||
* The Class WsUtil.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Nov 25, 2016
|
||||
*/
|
||||
public class WsUtil {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(WsUtil.class);
|
||||
|
||||
|
||||
/**
|
||||
* Checks if is within portal.
|
||||
*
|
||||
* @return true if you're running into the portal, false if in development
|
||||
*/
|
||||
public static boolean isWithinPortal() {
|
||||
try {
|
||||
UserLocalServiceUtil.getService();
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
logger.trace("Development Mode ON");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if is session expired.
|
||||
*
|
||||
* @param httpServletRequest the http servlet request
|
||||
* @return true, if is session expired
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
public static boolean isSessionExpired(HttpServletRequest httpServletRequest) throws Exception {
|
||||
logger.trace("workspace session validating...");
|
||||
return PortalContext.getConfiguration().getCurrentUser(httpServletRequest)==null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the workspace.
|
||||
*
|
||||
* @param httpServletRequest the http servlet request
|
||||
* @return the workspace
|
||||
* @throws InternalErrorException the internal error exception
|
||||
* @throws HomeNotFoundException the home not found exception
|
||||
* @throws WorkspaceFolderNotFoundException the workspace folder not found exception
|
||||
*/
|
||||
public static Workspace getWorkspace(HttpServletRequest httpServletRequest) throws InternalErrorException, HomeNotFoundException, WorkspaceFolderNotFoundException
|
||||
{
|
||||
logger.trace("Get Workspace");
|
||||
String scope = PortalContext.getConfiguration().getCurrentScope(httpServletRequest);
|
||||
GCubeUser user = PortalContext.getConfiguration().getCurrentUser(httpServletRequest);
|
||||
|
||||
ScopeProvider.instance.set(scope);
|
||||
logger.trace("Scope provider instancied at: "+scope);
|
||||
|
||||
Workspace workspace = HomeLibrary.getUserWorkspace(user.getUsername());
|
||||
return workspace;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package org.gcube.portlets.widgets.wsthreddssync.shared;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* FieldVerifier validates that the name the user enters is valid.
|
||||
* </p>
|
||||
* <p>
|
||||
* This class is in the <code>shared</code> packing because we use it in both
|
||||
* the client code and on the server. On the client, we verify that the name is
|
||||
* valid before sending an RPC request so the user doesn't have to wait for a
|
||||
* network round trip to get feedback. On the server, we verify that the name is
|
||||
* correct to ensure that the input is correct regardless of where the RPC
|
||||
* originates.
|
||||
* </p>
|
||||
* <p>
|
||||
* When creating a class that is used on both the client and the server, be sure
|
||||
* that all code is translatable and does not use native JavaScript. Code that
|
||||
* is note translatable (such as code that interacts with a database or the file
|
||||
* system) cannot be compiled into client side JavaScript. Code that uses native
|
||||
* JavaScript (such as Widgets) cannot be run on the server.
|
||||
* </p>
|
||||
*/
|
||||
public class FieldVerifier {
|
||||
|
||||
/**
|
||||
* Verifies that the specified name is valid for our service.
|
||||
*
|
||||
* In this example, we only require that the name is at least four
|
||||
* characters. In your application, you can use more complex checks to ensure
|
||||
* that usernames, passwords, email addresses, URLs, and other fields have the
|
||||
* proper syntax.
|
||||
*
|
||||
* @param name the name to validate
|
||||
* @return true if valid, false if invalid
|
||||
*/
|
||||
public static boolean isValidName(String name) {
|
||||
if (name == null) {
|
||||
return false;
|
||||
}
|
||||
return name.length() > 3;
|
||||
}
|
||||
}
|
@ -0,0 +1,111 @@
|
||||
package org.gcube.portlets.widgets.wsthreddssync.shared;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class GcubeVRE.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Feb 14, 2018
|
||||
*/
|
||||
public class GcubeVRE implements Serializable, IsSerializable{
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -6427520549519606384L;
|
||||
|
||||
/** The vre name. */
|
||||
private String vreName;
|
||||
|
||||
/** The vre scope. */
|
||||
private String vreScope;
|
||||
|
||||
/**
|
||||
* Instantiates a new gcube VRE.
|
||||
*/
|
||||
public GcubeVRE() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new gcube VRE.
|
||||
*
|
||||
* @param vreName the vre name
|
||||
* @param vreScope the vre scope
|
||||
*/
|
||||
public GcubeVRE(String vreName, String vreScope) {
|
||||
|
||||
super();
|
||||
this.vreName = vreName;
|
||||
this.vreScope = vreScope;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the vre name.
|
||||
*
|
||||
* @return the vreName
|
||||
*/
|
||||
public String getVreName() {
|
||||
|
||||
return vreName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the vre scope.
|
||||
*
|
||||
* @return the vreScope
|
||||
*/
|
||||
public String getVreScope() {
|
||||
|
||||
return vreScope;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the vre name.
|
||||
*
|
||||
* @param vreName the vreName to set
|
||||
*/
|
||||
public void setVreName(String vreName) {
|
||||
|
||||
this.vreName = vreName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the vre scope.
|
||||
*
|
||||
* @param vreScope the vreScope to set
|
||||
*/
|
||||
public void setVreScope(String vreScope) {
|
||||
|
||||
this.vreScope = vreScope;
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("GcubeVRE [vreName=");
|
||||
builder.append(vreName);
|
||||
builder.append(", vreScope=");
|
||||
builder.append(vreScope);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,201 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.wsthreddssync.shared;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class TransferOnThreddsReport.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Feb 7, 2018
|
||||
*/
|
||||
public class TransferOnThreddsReport implements Serializable, IsSerializable{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 326492579557983L;
|
||||
|
||||
/** The transfer id. */
|
||||
private String transferId;
|
||||
|
||||
/** The folder id. */
|
||||
private String folderId;
|
||||
|
||||
/** The on error. */
|
||||
private Boolean onError = false;
|
||||
|
||||
/** The report message. */
|
||||
private String reportMessage = null;
|
||||
|
||||
/** The report created on workspace. */
|
||||
private Boolean reportCreatedOnWorkspace = false;
|
||||
|
||||
/**
|
||||
* Instantiates a new transfer on thredds report.
|
||||
*/
|
||||
public TransferOnThreddsReport() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new transfer on thredds report.
|
||||
*
|
||||
* @param transferId the transfer id
|
||||
* @param folderId the folder id
|
||||
* @param onError the on error
|
||||
* @param reportMessage the report message
|
||||
*/
|
||||
public TransferOnThreddsReport(String transferId, String folderId, Boolean onError, String reportMessage) {
|
||||
|
||||
this.transferId = transferId;
|
||||
this.folderId = folderId;
|
||||
this.onError = onError;
|
||||
this.reportMessage = reportMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the report created on workspace.
|
||||
*
|
||||
* @param reportCreatedOnWorkspace the reportCreated to set
|
||||
*/
|
||||
public void setReportCreatedOnWorkspace(Boolean reportCreatedOnWorkspace) {
|
||||
|
||||
this.reportCreatedOnWorkspace = reportCreatedOnWorkspace;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if is transferring report available.
|
||||
*
|
||||
* @return the boolean
|
||||
*/
|
||||
public Boolean isTransferringReportAvailable() {
|
||||
|
||||
return reportCreatedOnWorkspace;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the transfer id.
|
||||
*
|
||||
* @return the transferId
|
||||
*/
|
||||
public String getTransferId() {
|
||||
|
||||
return transferId;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the folder id.
|
||||
*
|
||||
* @return the folderId
|
||||
*/
|
||||
public String getFolderId() {
|
||||
|
||||
return folderId;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the on error.
|
||||
*
|
||||
* @return the onError
|
||||
*/
|
||||
public Boolean isOnError() {
|
||||
|
||||
return onError;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the transfer id.
|
||||
*
|
||||
* @param transferId the transferId to set
|
||||
*/
|
||||
public void setTransferId(String transferId) {
|
||||
|
||||
this.transferId = transferId;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the folder id.
|
||||
*
|
||||
* @param folderId the folderId to set
|
||||
*/
|
||||
public void setFolderId(String folderId) {
|
||||
|
||||
this.folderId = folderId;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the on error.
|
||||
*
|
||||
* @param onError the onError to set
|
||||
*/
|
||||
public void setOnError(Boolean onError) {
|
||||
|
||||
this.onError = onError;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets the report message.
|
||||
*
|
||||
* @return the reportMessage
|
||||
*/
|
||||
public String getReportMessage() {
|
||||
|
||||
return reportMessage;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the report message.
|
||||
*
|
||||
* @param reportMessage the reportMessage to set
|
||||
*/
|
||||
public void setReportMessage(String reportMessage) {
|
||||
|
||||
this.reportMessage = reportMessage;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("TransferOnThreddsReport [transferId=");
|
||||
builder.append(transferId);
|
||||
builder.append(", folderId=");
|
||||
builder.append(folderId);
|
||||
builder.append(", onError=");
|
||||
builder.append(onError);
|
||||
builder.append(", reportMessage=");
|
||||
builder.append(reportMessage);
|
||||
builder.append(", reportCreated=");
|
||||
builder.append(reportCreatedOnWorkspace);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,232 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.wsthreddssync.shared;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
|
||||
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class TransferToThreddsProperty.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Feb 7, 2018
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlRootElement
|
||||
public class TransferToThreddsProperty implements Serializable{
|
||||
|
||||
|
||||
/** The folder id. */
|
||||
private String folderId;
|
||||
|
||||
/** The catalogue name. */
|
||||
private String catalogueName;
|
||||
|
||||
/** The vre name. */
|
||||
private String vreName;
|
||||
|
||||
/** The vre scope. */
|
||||
private String vreScope;
|
||||
|
||||
/** The metadata folder id. */
|
||||
private String metadataFolderId;
|
||||
|
||||
/** The metadata folder name. */
|
||||
private String metadataFolderName;
|
||||
|
||||
|
||||
/**
|
||||
* Instantiates a new transfering to thredds property.
|
||||
*/
|
||||
public TransferToThreddsProperty() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new transfering to thredds property.
|
||||
*
|
||||
* @param folderId the folder id
|
||||
* @param catalogueName the catalogue name
|
||||
* @param vreName the vre name
|
||||
* @param vreScope the vre scope
|
||||
* @param metadataFolderId the metadata folder id
|
||||
* @param metadataFolderName the metadata folder name
|
||||
*/
|
||||
public TransferToThreddsProperty(
|
||||
String folderId, String catalogueName, String vreName,
|
||||
String vreScope, String metadataFolderId, String metadataFolderName) {
|
||||
|
||||
super();
|
||||
this.folderId = folderId;
|
||||
this.catalogueName = catalogueName;
|
||||
this.vreName = vreName;
|
||||
this.vreScope = vreScope;
|
||||
this.metadataFolderId = metadataFolderId;
|
||||
this.metadataFolderName = metadataFolderName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the folder id.
|
||||
*
|
||||
* @return the folderId
|
||||
*/
|
||||
public String getFolderId() {
|
||||
|
||||
return folderId;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the catalogue name.
|
||||
*
|
||||
* @return the catalogueName
|
||||
*/
|
||||
public String getCatalogueName() {
|
||||
|
||||
return catalogueName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the vre name.
|
||||
*
|
||||
* @return the vreName
|
||||
*/
|
||||
public String getVreName() {
|
||||
|
||||
return vreName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the vre scope.
|
||||
*
|
||||
* @return the vreScope
|
||||
*/
|
||||
public String getVreScope() {
|
||||
|
||||
return vreScope;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the metadata folder id.
|
||||
*
|
||||
* @return the metadataFolderId
|
||||
*/
|
||||
public String getMetadataFolderId() {
|
||||
|
||||
return metadataFolderId;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the metadata folder name.
|
||||
*
|
||||
* @return the metadataFolderName
|
||||
*/
|
||||
public String getMetadataFolderName() {
|
||||
|
||||
return metadataFolderName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the folder id.
|
||||
*
|
||||
* @param folderId the folderId to set
|
||||
*/
|
||||
public void setFolderId(String folderId) {
|
||||
|
||||
this.folderId = folderId;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the catalogue name.
|
||||
*
|
||||
* @param catalogueName the catalogueName to set
|
||||
*/
|
||||
public void setCatalogueName(String catalogueName) {
|
||||
|
||||
this.catalogueName = catalogueName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the vre name.
|
||||
*
|
||||
* @param vreName the vreName to set
|
||||
*/
|
||||
public void setVreName(String vreName) {
|
||||
|
||||
this.vreName = vreName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the vre scope.
|
||||
*
|
||||
* @param vreScope the vreScope to set
|
||||
*/
|
||||
public void setVreScope(String vreScope) {
|
||||
|
||||
this.vreScope = vreScope;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the metadata folder id.
|
||||
*
|
||||
* @param metadataFolderId the metadataFolderId to set
|
||||
*/
|
||||
public void setMetadataFolderId(String metadataFolderId) {
|
||||
|
||||
this.metadataFolderId = metadataFolderId;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the metadata folder name.
|
||||
*
|
||||
* @param metadataFolderName the metadataFolderName to set
|
||||
*/
|
||||
public void setMetadataFolderName(String metadataFolderName) {
|
||||
|
||||
this.metadataFolderName = metadataFolderName;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("TransferToThreddsProperty [folderId=");
|
||||
builder.append(folderId);
|
||||
builder.append(", catalogueName=");
|
||||
builder.append(catalogueName);
|
||||
builder.append(", vreName=");
|
||||
builder.append(vreName);
|
||||
builder.append(", vreScope=");
|
||||
builder.append(vreScope);
|
||||
builder.append(", metadataFolderId=");
|
||||
builder.append(metadataFolderId);
|
||||
builder.append(", metadataFolderName=");
|
||||
builder.append(metadataFolderName);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package org.gcube.portlets.widgets.wsthreddssync.shared;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
public class WsFolder implements Serializable, IsSerializable{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 6165912778479858611L;
|
||||
private String folderId;
|
||||
private String foderName;
|
||||
|
||||
|
||||
public WsFolder() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public WsFolder(String folderId, String foderName) {
|
||||
this.folderId = folderId;
|
||||
this.foderName = foderName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getFolderId() {
|
||||
return folderId;
|
||||
}
|
||||
|
||||
|
||||
public void setFolderId(String folderId) {
|
||||
this.folderId = folderId;
|
||||
}
|
||||
|
||||
|
||||
public String getFoderName() {
|
||||
return foderName;
|
||||
}
|
||||
|
||||
|
||||
public void setFoderName(String foderName) {
|
||||
this.foderName = foderName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("WsFolder [folderId=");
|
||||
builder.append(folderId);
|
||||
builder.append(", foderName=");
|
||||
builder.append(foderName);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,151 @@
|
||||
package org.gcube.portlets.widgets.wsthreddssync.shared;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.gcube.portal.wssynclibrary.shared.thredds.Status;
|
||||
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class WsThreddsSynchFolderConfiguration.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Feb 16, 2018
|
||||
*/
|
||||
public class WsThreddsSynchFolderConfiguration implements Serializable{
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -1140248888970305126L;
|
||||
|
||||
/** The remote path. */
|
||||
private String remotePath;
|
||||
|
||||
private GcubeVRE theSelectedVRE;
|
||||
|
||||
/** The filter. */
|
||||
private String filter;
|
||||
|
||||
/** The to create catalog name. */
|
||||
private String catalogName;
|
||||
|
||||
private Status status; //just for serialization
|
||||
|
||||
|
||||
/**
|
||||
* Instantiates a new ws thredds synch folder configuration.
|
||||
*/
|
||||
public WsThreddsSynchFolderConfiguration() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Instantiates a new ws thredds synch folder configuration.
|
||||
*
|
||||
* @param remotePath the remote path
|
||||
* @param theVRE the the VRE
|
||||
* @param filter the filter
|
||||
* @param catalogName the catalog name
|
||||
* @param serverConf the server conf
|
||||
*/
|
||||
public WsThreddsSynchFolderConfiguration(String remotePath, GcubeVRE theVRE, String filter, String catalogName) {
|
||||
super();
|
||||
this.remotePath = remotePath;
|
||||
this.theSelectedVRE = theVRE;
|
||||
this.filter = filter;
|
||||
this.catalogName = catalogName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the remote path.
|
||||
*
|
||||
* @return the remote path
|
||||
*/
|
||||
public String getRemotePath() {
|
||||
return remotePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the remote path.
|
||||
*
|
||||
* @param remotePath the new remote path
|
||||
*/
|
||||
public void setRemotePath(String remotePath) {
|
||||
this.remotePath = remotePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the the VRE.
|
||||
*
|
||||
* @return the the VRE
|
||||
*/
|
||||
public GcubeVRE getTheVRE() {
|
||||
return theSelectedVRE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the the VRE.
|
||||
*
|
||||
* @param theVRE the new the VRE
|
||||
*/
|
||||
public void setTheVRE(GcubeVRE theVRE) {
|
||||
this.theSelectedVRE = theVRE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the filter.
|
||||
*
|
||||
* @return the filter
|
||||
*/
|
||||
public String getFilter() {
|
||||
return filter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the filter.
|
||||
*
|
||||
* @param filter the new filter
|
||||
*/
|
||||
public void setFilter(String filter) {
|
||||
this.filter = filter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the catalog name.
|
||||
*
|
||||
* @return the catalog name
|
||||
*/
|
||||
public String getCatalogName() {
|
||||
return catalogName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the catalog name.
|
||||
*
|
||||
* @param catalogName the new catalog name
|
||||
*/
|
||||
public void setCatalogName(String catalogName) {
|
||||
this.catalogName = catalogName;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("WsThreddsSynchFolderDescriptor [remotePath=");
|
||||
builder.append(remotePath);
|
||||
builder.append(", theSelectedVRE=");
|
||||
builder.append(theSelectedVRE);
|
||||
builder.append(", filter=");
|
||||
builder.append(filter);
|
||||
builder.append(", catalogName=");
|
||||
builder.append(catalogName);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,122 @@
|
||||
package org.gcube.portlets.widgets.wsthreddssync.shared;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.gcube.portal.wssynclibrary.shared.thredds.Sync_Status;
|
||||
import org.gcube.portal.wssynclibrary.shared.thredds.ThSyncFolderDescriptor;
|
||||
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class WsThreddsSynchFolderDescriptor.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Feb 20, 2018
|
||||
*/
|
||||
public class WsThreddsSynchFolderDescriptor implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -5395986188613871699L;
|
||||
|
||||
private GcubeVRE selectedVRE;
|
||||
|
||||
private ThSyncFolderDescriptor serverFolderDescriptor;
|
||||
|
||||
private Sync_Status syncStatus;
|
||||
|
||||
/**
|
||||
* Instantiates a new ws thredds synch folder configuration.
|
||||
*/
|
||||
public WsThreddsSynchFolderDescriptor() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new ws thredds synch folder descriptor.
|
||||
*
|
||||
* @param selectedVRE the selected VRE
|
||||
* @param serverFolderDescriptor the server folder descriptor
|
||||
* @param syncStatus the sync status
|
||||
*/
|
||||
public WsThreddsSynchFolderDescriptor(GcubeVRE selectedVRE, ThSyncFolderDescriptor serverFolderDescriptor,
|
||||
Sync_Status syncStatus) {
|
||||
super();
|
||||
this.selectedVRE = selectedVRE;
|
||||
this.serverFolderDescriptor = serverFolderDescriptor;
|
||||
this.syncStatus = syncStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the selected VRE.
|
||||
*
|
||||
* @return the selected VRE
|
||||
*/
|
||||
public GcubeVRE getSelectedVRE() {
|
||||
return selectedVRE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the sync status.
|
||||
*
|
||||
* @param syncStatus
|
||||
* the new sync status
|
||||
*/
|
||||
public void setSyncStatus(Sync_Status syncStatus) {
|
||||
this.syncStatus = syncStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the sync status.
|
||||
*
|
||||
* @return the sync status
|
||||
*/
|
||||
public Sync_Status getSyncStatus() {
|
||||
return syncStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the selected VRE.
|
||||
*
|
||||
* @param selectedVRE
|
||||
* the new selected VRE
|
||||
*/
|
||||
public void setSelectedVRE(GcubeVRE selectedVRE) {
|
||||
this.selectedVRE = selectedVRE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the server folder descriptor.
|
||||
*
|
||||
* @return the server folder descriptor
|
||||
*/
|
||||
public ThSyncFolderDescriptor getServerFolderDescriptor() {
|
||||
return serverFolderDescriptor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the server folder descriptor.
|
||||
*
|
||||
* @param serverFolderDescriptor
|
||||
* the new server folder descriptor
|
||||
*/
|
||||
public void setServerFolderDescriptor(ThSyncFolderDescriptor serverFolderDescriptor) {
|
||||
this.serverFolderDescriptor = serverFolderDescriptor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("WsThreddsSynchFolderDescriptor [selectedVRE=");
|
||||
builder.append(selectedVRE);
|
||||
builder.append(", serverFolderDescriptor=");
|
||||
builder.append(serverFolderDescriptor);
|
||||
builder.append(", syncStatus=");
|
||||
builder.append(syncStatus);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module rename-to='WsThreddsWidget'>
|
||||
<!-- Inherit the core Web Toolkit stuff. -->
|
||||
<inherits name='com.google.gwt.user.User' />
|
||||
|
||||
<!-- Inherit the default GWT style sheet. You can change -->
|
||||
<!-- the theme of your GWT application by uncommenting -->
|
||||
<!-- any one of the following lines. -->
|
||||
<inherits name='com.google.gwt.user.theme.standard.Standard' />
|
||||
<inherits name="com.github.gwtbootstrap.Bootstrap" />
|
||||
<inherits name="org.gcube.portal.wssynclibrary.WsSyncLibrary" />
|
||||
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
|
||||
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
|
||||
|
||||
<!-- Other module inherits -->
|
||||
|
||||
<!-- Specify the app entry point class. -->
|
||||
<!-- <entry-point class='org.gcube.portlets.widgets.wsthreddssync.client.WsThreddsWidget'
|
||||
/> -->
|
||||
|
||||
<!-- Specify the application specific style sheet. -->
|
||||
<stylesheet src='WsThreddsWidget.css' />
|
||||
|
||||
<!-- Specify the paths for translatable code -->
|
||||
<source path='client' />
|
||||
<source path='shared' />
|
||||
|
||||
</module>
|
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE web-app
|
||||
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
|
||||
"http://java.sun.com/dtd/web-app_2_3.dtd">
|
||||
|
||||
<web-app>
|
||||
|
||||
<!-- Servlets -->
|
||||
<servlet>
|
||||
<servlet-name>wsThreddsSyncServlet</servlet-name>
|
||||
<servlet-class>org.gcube.portlets.widgets.wsthreddssync.server.ThreddsWorkspaceSyncServiceImpl</servlet-class>
|
||||
</servlet>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>wsThreddsSyncServlet</servlet-name>
|
||||
<url-pattern>/WsThreddsWidget/wsthreddssync</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<!-- Default page to serve -->
|
||||
<welcome-file-list>
|
||||
<welcome-file>WsThreddsWidget.html</welcome-file>
|
||||
</welcome-file-list>
|
||||
|
||||
</web-app>
|
@ -0,0 +1,44 @@
|
||||
/** Add css rules here for your application. */
|
||||
|
||||
|
||||
/** Example rules used by the template application (remove for your app) */
|
||||
h1 {
|
||||
font-size: 2em;
|
||||
font-weight: bold;
|
||||
color: #777777;
|
||||
margin: 40px 0px 70px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
|
||||
/** Add css rules here for your application. */
|
||||
|
||||
.ws-thredds-modal-body div.modal-body {
|
||||
position: relative;
|
||||
max-height: 600px !important;
|
||||
padding: 15px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
@ -0,0 +1,63 @@
|
||||
<!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">
|
||||
|
||||
<!-- -->
|
||||
<!-- Consider inlining CSS to reduce the number of requested files -->
|
||||
<!-- -->
|
||||
<link type="text/css" rel="stylesheet" href="WsThreddsWidget.css">
|
||||
|
||||
<!-- -->
|
||||
<!-- Any title is fine -->
|
||||
<!-- -->
|
||||
<title>Web Application Starter Project</title>
|
||||
|
||||
<!-- -->
|
||||
<!-- This script loads your compiled module. -->
|
||||
<!-- If you add any GWT meta tags, they must -->
|
||||
<!-- be added before this line. -->
|
||||
<!-- -->
|
||||
<script type="text/javascript" language="javascript" src="WsThreddsWidget/WsThreddsWidget.nocache.js"></script>
|
||||
</head>
|
||||
|
||||
<!-- -->
|
||||
<!-- The body can have arbitrary html, or -->
|
||||
<!-- you can leave the body empty if you want -->
|
||||
<!-- to create a completely dynamic UI. -->
|
||||
<!-- -->
|
||||
<body>
|
||||
|
||||
<!-- OPTIONAL: include this if you want history support -->
|
||||
<iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe>
|
||||
|
||||
<!-- RECOMMENDED if your web app will not function without JavaScript enabled -->
|
||||
<noscript>
|
||||
<div style="width: 22em; position: absolute; left: 50%; margin-left: -11em; color: red; background-color: white; border: 1px solid red; padding: 4px; font-family: sans-serif">
|
||||
Your web browser must have JavaScript enabled
|
||||
in order for this application to display correctly.
|
||||
</div>
|
||||
</noscript>
|
||||
|
||||
<h1>Web Application Starter Project</h1>
|
||||
|
||||
<table align="center">
|
||||
<tr>
|
||||
<td colspan="2" style="font-weight:bold;">Please enter your name:</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id="nameFieldContainer"></td>
|
||||
<td id="sendButtonContainer"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" style="color:red;" id="errorLabelContainer"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,131 @@
|
||||
package org.gcube.portlets.widgets.wsthreddssync;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.util.concurrent.Semaphore;
|
||||
|
||||
import org.gcube.common.homelibrary.home.HomeLibrary;
|
||||
import org.gcube.common.homelibrary.home.exceptions.HomeNotFoundException;
|
||||
import org.gcube.common.homelibrary.home.exceptions.InternalErrorException;
|
||||
import org.gcube.common.homelibrary.home.exceptions.UserNotFoundException;
|
||||
import org.gcube.common.homelibrary.home.workspace.Workspace;
|
||||
import org.gcube.common.homelibrary.home.workspace.WorkspaceFolder;
|
||||
import org.gcube.common.homelibrary.home.workspace.exceptions.InsufficientPrivilegesException;
|
||||
import org.gcube.common.homelibrary.home.workspace.exceptions.ItemAlreadyExistException;
|
||||
import org.gcube.common.homelibrary.home.workspace.exceptions.ItemNotFoundException;
|
||||
import org.gcube.common.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.common.scope.impl.ScopeBean;
|
||||
import org.gcube.usecases.ws.thredds.SyncEngine;
|
||||
import org.gcube.usecases.ws.thredds.engine.impl.ProcessDescriptor;
|
||||
import org.gcube.usecases.ws.thredds.engine.impl.ProcessStatus;
|
||||
import org.gcube.usecases.ws.thredds.faults.InternalException;
|
||||
import org.gcube.usecases.ws.thredds.faults.ProcessNotFoundException;
|
||||
import org.gcube.usecases.ws.thredds.faults.WorkspaceInteractionException;
|
||||
import org.gcube.usecases.ws.thredds.faults.WorkspaceLockedException;
|
||||
import org.gcube.usecases.ws.thredds.faults.WorkspaceNotSynchedException;
|
||||
import org.gcube.usecases.ws.thredds.model.SyncOperationCallBack;
|
||||
import org.gcube.usecases.ws.thredds.model.SynchFolderConfiguration;
|
||||
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class TestWsThreddsEngine.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Feb 7, 2018
|
||||
*/
|
||||
public class TestWsThreddsEngine {
|
||||
|
||||
public static String DEFAULT_SCOPE = "/gcube/devsec"; //DEV
|
||||
// public static String DEFAULT_SCOPE = "/d4science.research-infrastructures.eu/gCubeApps";
|
||||
public static String TEST_USER = "francesco.mangiacrapa";
|
||||
|
||||
public static String TEST_FOLDER_ID = "";
|
||||
|
||||
public static void main(String[] args) throws ProcessNotFoundException, InternalErrorException, WorkspaceInteractionException, InternalException, WorkspaceFolderNotFoundException, ItemNotFoundException, InsufficientPrivilegesException, ItemAlreadyExistException, HomeNotFoundException, UserNotFoundException, MalformedURLException, IOException {
|
||||
|
||||
// GET ENGINE : SINGLETON INSTANCE
|
||||
SyncEngine engine=SyncEngine.get();
|
||||
|
||||
|
||||
|
||||
Workspace ws = HomeLibrary
|
||||
.getHomeManagerFactory()
|
||||
.getHomeManager()
|
||||
.getHome(TEST_USER)
|
||||
.getWorkspace();
|
||||
|
||||
|
||||
//TEST INFO...
|
||||
//TestCommons.setScope();
|
||||
ScopeBean scope = new ScopeBean(DEFAULT_SCOPE);
|
||||
ScopeProvider.instance.set(scope.toString());
|
||||
WorkspaceFolder folder=(WorkspaceFolder) ws.getItem(TEST_FOLDER_ID);
|
||||
|
||||
// FOLDER CONFIGURATION BEAN
|
||||
//SynchFolderConfiguration config=TestCommons.getSynchConfig();
|
||||
|
||||
String filter = "";
|
||||
String remotePersistence = "";
|
||||
String remotePath = "";
|
||||
String targetToken = "";
|
||||
SynchFolderConfiguration config = new SynchFolderConfiguration(remotePath, filter, targetToken, remotePersistence);
|
||||
|
||||
try {
|
||||
//try to clean it up, first..
|
||||
System.out.println("Cleaning it up..");
|
||||
engine.unsetSynchronizedFolder(folder.getId(), false);
|
||||
}catch(WorkspaceNotSynchedException e) {
|
||||
// it was already cleared
|
||||
}catch(WorkspaceLockedException e) {
|
||||
engine.forceUnlock(folder.getId());
|
||||
engine.unsetSynchronizedFolder(folder.getId(), false);
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
// WHEN OPENING A FOLDER, INVOKE CHECK TO UPDATE SYNCH STATUS
|
||||
engine.check(folder.getId(), false);
|
||||
}catch(WorkspaceNotSynchedException e) {
|
||||
System.out.println("Folder not synched, configurin it..");
|
||||
engine.setSynchronizedFolder(config, folder.getId());
|
||||
}catch(WorkspaceLockedException e) {
|
||||
System.out.println("Workspace locked, going to force unlock.."); // MAINLY FOR TEST PURPOSES, OR WHEN SOMETHIGN GOES WRONG.. USE CAUTIOUSLY
|
||||
engine.forceUnlock(folder.getId());
|
||||
}
|
||||
|
||||
// INVOKE SYNCHRONIZATION ON FOLDER
|
||||
ProcessDescriptor descriptor=engine.doSync(folder.getId());
|
||||
|
||||
System.out.println("Obtained descriptor : "+descriptor);
|
||||
|
||||
|
||||
SyncOperationCallBack syncCall = new SyncOperationCallBack() {
|
||||
|
||||
@Override
|
||||
public void onStep(ProcessStatus status, ProcessDescriptor descriptor) {
|
||||
System.out.println("ON STEP : "+status+" "+descriptor);
|
||||
System.out.println("LOG : \n"+ status.getLogBuilder().toString());
|
||||
if(status.getStatus().equals(ProcessStatus.Status.COMPLETED)) {
|
||||
|
||||
//COMPLETED FARE REMOVE DALLA MAPPA
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
// REGISTER CALLBACK TO MONITOR PROGRESS
|
||||
engine.registerCallBack(folder.getId(), syncCall);
|
||||
|
||||
|
||||
engine.check(folder.getId(), true);
|
||||
|
||||
|
||||
// INVOKE WHEN PORTAL SHUTS DOWN TO FREE RESOURCES AND STOP SYNC PROCESSES
|
||||
engine.shutDown();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package org.gcube.portlets.widgets.wsthreddssync;
|
||||
|
||||
import org.gcube.common.homelibrary.home.HomeLibrary;
|
||||
import org.gcube.common.homelibrary.home.workspace.Properties;
|
||||
import org.gcube.common.homelibrary.home.workspace.Workspace;
|
||||
import org.gcube.common.homelibrary.home.workspace.WorkspaceFolder;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.portal.wssynclibrary.shared.ItemNotSynched;
|
||||
|
||||
public class TestWsThreddsQuery {
|
||||
|
||||
final static String folderId = "61ea6d91-4b09-43ec-91c4-b2fdb9b8c538";
|
||||
static String scope = "/gcube/devsec";
|
||||
static String username = "francesco.mangiacrapa";
|
||||
// NextNeext Francesco's Token
|
||||
static String token = "89257623-0570-4fbe-a15b-458bb84f4902-98187548";
|
||||
public static final String WS_SYNCH_SYNCH_STATUS = "WS-SYNCH.SYNCH-STATUS";
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
isItemSynched();
|
||||
|
||||
}
|
||||
|
||||
public static void isItemSynched(){
|
||||
|
||||
try {
|
||||
ScopeProvider.instance.set(scope);
|
||||
|
||||
Workspace workspace = HomeLibrary.getUserWorkspace(username);
|
||||
WorkspaceFolder folder = (WorkspaceFolder) workspace.getItem(folderId);
|
||||
Properties properties = folder.getProperties();
|
||||
|
||||
if (properties == null || properties.getProperties() == null || properties.getProperties().size() == 0) {
|
||||
throw new ItemNotSynched("No properties to read");
|
||||
}
|
||||
|
||||
String wsSyncStatus = properties.getProperties().get(WS_SYNCH_SYNCH_STATUS);
|
||||
System.out.println("Current: " + WS_SYNCH_SYNCH_STATUS + " has value: " + wsSyncStatus);
|
||||
|
||||
//System.out.println("isSynched: " + isSynched);
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module rename-to="WsThreddsWidget">
|
||||
<!-- Inherit our applications main module. -->
|
||||
<inherits name='org.gcube.portlets.widgets.wsthreddssync.WsThreddsWidget' />
|
||||
|
||||
<!-- Specify the path to any remote services. -->
|
||||
<servlet path="/WsThreddsWidget/greet" class="org.gcube.portlets.widgets.wsthreddssync.server.ThreddsWorkspaceSyncServiceImpl" />
|
||||
|
||||
</module>
|
Loading…
Reference in New Issue