moved from private svn

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/gcube-ckan-datacatalog@129070 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2016-06-13 07:48:29 +00:00
commit d7a9786971
56 changed files with 1770 additions and 0 deletions

37
.classpath Normal file
View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/gcube-ckan-datacatalog-1.0.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/gcube-ckan-datacatalog-1.0.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/gcube-ckan-datacatalog-1.0.0-SNAPSHOT/WEB-INF/classes"/>
</classpath>

53
.project Normal file
View File

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>gcube-ckan-datacatalog</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.google.gdt.eclipse.core.webAppProjectValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.google.gwt.eclipse.core.gwtProjectValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.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>org.eclipse.wst.jsdt.core.jsNature</nature>
<nature>com.google.gwt.eclipse.core.gwtNature</nature>
</natures>
</projectDescription>

13
.settings/.jsdtscope Normal file
View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main/webapp"/>
<classpathentry 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>

View File

@ -0,0 +1,2 @@
eclipse.preferences.version=1
filesCopiedToWebInfLib=

View File

@ -0,0 +1,5 @@
eclipse.preferences.version=1
jarsExcludedFromWebInfLib=
lastWarOutDir=/home/francesco-mangiacrapa/wseclipseluna/gcube-ckan-datacatalog/target/gcube-ckan-datacatalog-1.0.0-SNAPSHOT
warSrcDir=src/main/webapp
warSrcDirIsOutput=false

View File

@ -0,0 +1,2 @@
eclipse.preferences.version=1
entryPointModules=

View File

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

View File

@ -0,0 +1,8 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.7

View File

@ -0,0 +1,3 @@
eclipse.preferences.version=1
validateFragments=false
validation.use-project-settings=true

View File

@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="gcube-ckan-datacatalog-portlet">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<property name="context-root" value="gcube-ckan-datacatalog"/>
<property name="java-output-path" value="/gcube-ckan-datacatalog/target/gcube-ckan-datacatalog-1.0.0-SNAPSHOT/WEB-INF/classes"/>
</wb-module>
</project-modules>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<fixed facet="wst.jsdt.web"/>
<installed facet="java" version="1.7"/>
<installed facet="jst.web" version="2.3"/>
<installed facet="wst.jsdt.web" version="1.0"/>
<installed facet="liferay.portlet" version="6.0"/>
</faceted-project>

View File

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

View File

@ -0,0 +1 @@
Window

View File

@ -0,0 +1,2 @@
disabled=06target
eclipse.preferences.version=1

1
.tern-project Normal file
View File

@ -0,0 +1 @@
{"ide":{"scriptPaths":[]},"plugins":{"aui":{},"liferay":{},"yui":{}},"libs":["ecma5","browser"]}

1
distro/LICENSE Normal file
View File

@ -0,0 +1 @@
${gcube.license}

60
distro/README Normal file
View File

@ -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}/Workspace
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.

6
distro/changelog.xml Normal file
View File

@ -0,0 +1,6 @@
<ReleaseNotes>
<Changeset component="org.gcube.portlets-user.workspace-portlet.1-1-2"
date="2009-01-12">
<Change>first release</Change>
</Changeset>
</ReleaseNotes>

32
distro/descriptor.xml Normal file
View File

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

25
distro/profile.xml Normal file
View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<Resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ID></ID>
<Type>Service</Type>
<Profile>
<Description>${description}</Description>
<Class>PortletUser</Class>
<Name>${artifactId}</Name>
<Version>${version}</Version>
<Packages>
<Software>
<Name>${artifactId}</Name>
<Version>${version}</Version>
<MavenCoordinates>
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<version>${version}</version>
</MavenCoordinates>
<Files>
<File>target/${build.finalName}.war</File>
</Files>
</Software>
</Packages>
</Profile>
</Resource>

239
pom.xml Normal file
View File

@ -0,0 +1,239 @@
<?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.gcubeckan</groupId>
<artifactId>gcube-ckan-datacatalog</artifactId>
<packaging>war</packaging>
<version>1.0.0-SNAPSHOT</version>
<name>gCube CKAN Data Catalog</name>
<description>The gCube CKAN Data Catalog portlet</description>
<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.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>maven-portal-bom</artifactId>
<version>LATEST</version>
<type>pom</type>
<scope>import</scope>
<exclusions>
<exclusion>
<artifactId>gwt-user</artifactId>
<groupId>com.google.gwt</groupId>
</exclusion>
<exclusion>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<!-- <scope>provided</scope> -->
<scope>compile</scope>
<version>${gwtVersion}</version>
</dependency>
<dependency>
<groupId>com.github.gwtbootstrap</groupId>
<artifactId>gwt-bootstrap</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.gcube.portal</groupId>
<artifactId>custom-portal-handler</artifactId>
<scope>provided</scope>
</dependency>
<!-- FWS -->
<dependency>
<groupId>org.gcube.resources.discovery</groupId>
<artifactId>ic-client</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-scope-maps</artifactId>
<scope>compile</scope>
</dependency>
<!-- END FWS -->
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>authorization-client</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>common-authorization</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>org.gcube.applicationsupportlayer</groupId>
<artifactId>aslcore</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.portlet</groupId>
<artifactId>portlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.liferay.portal</groupId>
<artifactId>portal-service</artifactId>
<scope>provided</scope>
</dependency>
<!-- LOGGER -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
</dependencies>
<build>
<!-- Generate compiled stuff in the folder used for developing mode -->
<outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
<plugins>
<!-- GWT Maven Plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>${gwtVersion}</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<!-- <goal>test</goal> -->
</goals>
</execution>
</executions>
<!-- Plugin configuration. There are many available options, see gwt-maven-plugin
documentation at codehaus.org -->
<configuration>
<runTarget>GCubeCkanDataCatalog.html</runTarget>
<hostedWebapp>${webappDirectory}</hostedWebapp>
</configuration>
</plugin>
<!-- Copy static web files before executing gwt:run -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>exploded</goal>
</goals>
</execution>
</executions>
<configuration>
<webappDirectory>${webappDirectory}</webappDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
<!-- SA Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2</version>
<configuration>
<descriptors>
<descriptor>${distroDirectory}/descriptor.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>servicearchive</id>
<phase>install</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>copy-profile</id>
<phase>install</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>target</outputDirectory>
<resources>
<resource>
<directory>${distroDirectory}</directory>
<filtering>true</filtering>
<includes>
<include>profile.xml</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='gCubeCkanDataCatalog'>
<!-- 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.github.gwtbootstrap.Bootstrap" />
<!-- <inherits name='com.google.gwt.user.theme.standard.Standard' /> -->
<!-- <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.gcubeckan.gcubeckandatacatalog.client.GCubeCkanDataCatalog' />
<!-- Specify the paths for translatable code -->
<source path='client' />
<source path='shared' />
</module>

View File

@ -0,0 +1,32 @@
/**
*
*/
package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client;
import com.google.gwt.event.shared.HandlerManager;
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Jun 10, 2016
*/
public class CkanEventHandlerManager {
private HandlerManager eventBus = new HandlerManager(null);
/**
*
*/
public CkanEventHandlerManager() {
}
/**
* @return
*/
public HandlerManager getEventBus() {
return eventBus;
}
}

View File

@ -0,0 +1,31 @@
package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.view.GCubeCkanDataCatalogPanel;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.shared.GWT;
import com.google.gwt.user.client.ui.RootPanel;
/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class GCubeCkanDataCatalog implements EntryPoint {
/**
* Create a remote service proxy to talk to the server-side Greeting
* service.
*/
public static final GcubeCkanDataCatalogServiceAsync service = GWT.create(GcubeCkanDataCatalogService.class);
private final String DIV_PORTLET_ID = "gCubeCkanDataCatalog";
private CkanEventHandlerManager eventManager = new CkanEventHandlerManager();
/**
* This is the entry point method.
*/
public void onModuleLoad() {
new GCubeCkanDataCatalogPanel(RootPanel.get(DIV_PORTLET_ID), eventManager.getEventBus());
}
}

View File

@ -0,0 +1,21 @@
package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared.CkanRole;
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("ckandatacatalogue")
public interface GcubeCkanDataCatalogService extends RemoteService {
String getCKanConnector() throws Exception;
/**
* @return
* @throws Exception
*/
CkanRole getMyRole() throws Exception;
}

View File

@ -0,0 +1,20 @@
/**
*
*/
package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared.CkanRole;
import com.google.gwt.user.client.rpc.AsyncCallback;
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Apr 12, 2016
*/
public interface GcubeCkanDataCatalogServiceAsync {
void getCKanConnector(AsyncCallback<String> callback);
void getMyRole(AsyncCallback<CkanRole> callback);
}

View File

@ -0,0 +1,38 @@
package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class InsertMetadataEvent.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Jun 10, 2016
*/
public class EditMetadataEvent extends GwtEvent<EditMetadataEventHandler> {
public static Type<EditMetadataEventHandler> TYPE = new Type<EditMetadataEventHandler>();
/**
* Instantiates a new insert metadata event.
*/
public EditMetadataEvent() {
}
/* (non-Javadoc)
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
*/
@Override
public Type<EditMetadataEventHandler> getAssociatedType() {
return TYPE;
}
/* (non-Javadoc)
* @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler)
*/
@Override
protected void dispatch(EditMetadataEventHandler handler) {
handler.onEditMetadata(this);
}
}

View File

@ -0,0 +1,19 @@
package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface InsertMetadataEventHandler.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Jun 10, 2016
*/
public interface EditMetadataEventHandler extends EventHandler {
/**
* @param editMetadataEvent
*/
void onEditMetadata(EditMetadataEvent editMetadataEvent);
}

View File

@ -0,0 +1,38 @@
package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class InsertMetadataEvent.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Jun 10, 2016
*/
public class InsertMetadataEvent extends GwtEvent<InsertMetadataEventHandler> {
public static Type<InsertMetadataEventHandler> TYPE = new Type<InsertMetadataEventHandler>();
/**
* Instantiates a new insert metadata event.
*/
public InsertMetadataEvent() {
}
/* (non-Javadoc)
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
*/
@Override
public Type<InsertMetadataEventHandler> getAssociatedType() {
return TYPE;
}
/* (non-Javadoc)
* @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler)
*/
@Override
protected void dispatch(InsertMetadataEventHandler handler) {
handler.onInsertMetadata(this);
}
}

View File

@ -0,0 +1,20 @@
package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface InsertMetadataEventHandler.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Jun 10, 2016
*/
public interface InsertMetadataEventHandler extends EventHandler {
/**
* On insert metadata.
*
* @param loadSelecteReleaseEvent the load selecte release event
*/
void onInsertMetadata(InsertMetadataEvent loadSelecteReleaseEvent);
}

View File

@ -0,0 +1,18 @@
package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.resource;
import com.google.gwt.core.client.GWT;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.ImageResource;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* @Jan 15, 2015
*
*/
public interface CkanPortletResources extends ClientBundle {
public static final CkanPortletResources ICONS = GWT.create(CkanPortletResources.class);
@Source("loader.gif")
ImageResource loading();
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -0,0 +1,73 @@
/**
*
*/
package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.view;
import com.github.gwtbootstrap.client.ui.FluidRow;
import com.google.gwt.core.client.GWT;
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.Widget;
/**
* The Class BaseViewTemplate.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Feb 19, 2015
*/
public class BaseViewTemplate extends Composite{
@UiField
FluidRow top_container;
@UiField
FluidRow base_container;
@UiField
FluidRow bottom_container;
private static BaseViewTemplateUiBinder uiBinder = GWT.create(BaseViewTemplateUiBinder.class);
/**
* The Interface BaseViewTemplateUiBinder.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Feb 19, 2015
*/
interface BaseViewTemplateUiBinder extends UiBinder<Widget, BaseViewTemplate> {
}
/**
* Instantiates a new base view template.
*/
public BaseViewTemplate() {
initWidget(uiBinder.createAndBindUi(this));
}
/**
* Adds the to top.
*
* @param widget the widget
*/
public void addToTop(Widget widget){
top_container.add(widget);
}
/**
* Adds the to middle.
*
* @param widget the widget
*/
public void addToMiddle(Widget widget){
base_container.add(widget);
}
/**
* Adds the to bottom.
*
* @param widget the widget
*/
public void addToBottom(Widget widget){
bottom_container.add(widget);
}
}

View File

@ -0,0 +1,13 @@
<!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">
<g:FlowPanel>
<b:FluidRow ui:field="top_container">
</b:FluidRow>
<b:FluidRow ui:field="base_container">
</b:FluidRow>
<b:FluidRow ui:field="bottom_container">
</b:FluidRow>
</g:FlowPanel>
</ui:UiBinder>

View File

@ -0,0 +1,67 @@
/**
*
*/
package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.view;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.LoadEvent;
import com.google.gwt.event.dom.client.LoadHandler;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Frame;
/**
* The Class CkanFramePanel.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Jun 9, 2016
*/
public class CkanFramePanel extends FlowPanel{
private Frame frame;
/**
* Instantiates a new ckan frame panel.
*/
public CkanFramePanel() {
}
/**
* Instance frame.
*
* @param ckanUrlConnector the ckan url connector
* @return the frame
*/
public Frame instanceFrame(String ckanUrlConnector) {
frame = new Frame(ckanUrlConnector);
frame.getElement().getStyle().setBorderWidth(0, Unit.PX);
// frame.getElement().setPropertyString("frameBorder", "0");
frame.addLoadHandler(new LoadHandler() {
@Override
public void onLoad(LoadEvent arg0) {
/*NodeList<Element> listHeaders = Document.get().getElementsByTagName("header");
if(listHeaders!=null){
GWT.log("List Header by tag name is/are: "+listHeaders.getLength() +", hidden..");
for (int i = 0; i < listHeaders.getLength(); i++) {
Element header = listHeaders.getItem(i);
header.getStyle().setVisibility(Visibility.HIDDEN);
}
}else
GWT.log("List Header by tag name is null");*/
}
});
add(frame);
return frame;
}
/**
* @return
*/
public Frame getFrame() {
return frame;
}
}

View File

@ -0,0 +1,85 @@
/**
*
*/
package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.view;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.InsertMetadataEvent;
import com.github.gwtbootstrap.client.ui.AlertBlock;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.constants.AlertType;
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
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.event.shared.HandlerManager;
import com.google.gwt.user.client.ui.FlowPanel;
/**
* The Class CkanMetadataManagementPanel.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Jun 9, 2016
*/
public class CkanMetadataManagementPanel extends FlowPanel{
private AlertBlock nav = new AlertBlock();
private Button insertMeta = new Button("Insert Metadata");
private Button editMeta = new Button("Edit Metadata");
private HandlerManager eventBus;
/**
* Instantiates a new ckan metadata management panel.
* @param eventBus
*/
public CkanMetadataManagementPanel(HandlerManager eventBus){
this.eventBus = eventBus;
// this.getElement().getStyle().setPaddingTop(H_OFFSET, Unit.PX);
// this.getElement().getStyle().setPaddingBottom(H_OFFSET, Unit.PX);
insertMeta.setType(ButtonType.LINK);
editMeta.setType(ButtonType.LINK);
nav.add(insertMeta);
nav.add(editMeta);
nav.setClose(false);
nav.setType(AlertType.INFO);
nav.getElement().getStyle().setMarginBottom(0, Unit.PX);
nav.getElement().getStyle().setBackgroundColor("#FFF");
addHandlers();
add(nav);
}
/**
*
*/
private void addHandlers() {
insertMeta.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
eventBus.fireEvent(new InsertMetadataEvent());
}
});
editMeta.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
eventBus.fireEvent(new InsertMetadataEvent());
}
});
}
/**
* Gets the current height.
*
* @return the current height
*/
public int getCurrentHeight(){
return this.getOffsetHeight();
}
}

View File

@ -0,0 +1,175 @@
/**
*
*/
package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.view;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.GCubeCkanDataCatalog;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.resource.CkanPortletResources;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared.CkanRole;
import com.google.gwt.core.shared.GWT;
import com.google.gwt.event.logical.shared.ResizeEvent;
import com.google.gwt.event.logical.shared.ResizeHandler;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Frame;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.ScrollPanel;
/**
* The Class GCubeCkanDataCatalogPanel.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Jun 9, 2016
*/
public class GCubeCkanDataCatalogPanel extends BaseViewTemplate{
private CkanMetadataManagementPanel managementPanel;
private ScrollPanel centerScrollable = new ScrollPanel();
private CkanFramePanel ckanFramePanel = new CkanFramePanel();
private Image loading = new Image(CkanPortletResources.ICONS.loading());
private RootPanel rootPanel;
private HandlerManager eventBus;
/**
* Instantiates a new g cube ckan data catalog panel.
*
* @param rootPanel the root panel
* @param eventManager the event manager
*/
public GCubeCkanDataCatalogPanel(RootPanel rootPanel, HandlerManager eventManager){
this.rootPanel = rootPanel;
this.eventBus = eventManager;
managementPanel = new CkanMetadataManagementPanel(eventBus);
initPanel();
GCubeCkanDataCatalog.service.getCKanConnector(new AsyncCallback<String>() {
@Override
public void onSuccess(String ckanUrlConnector) {
instanceCkanFrame(ckanUrlConnector);
GCubeCkanDataCatalogPanel.this.rootPanel.remove(loading);
updateSize();
}
@Override
public void onFailure(Throwable caught) {
GCubeCkanDataCatalogPanel.this.rootPanel.remove(loading);
Window.alert("Sorry, An error occurred during contacting Gcube Ckan Data Catalogue!");
}
});
//MANAGE CKAN MANAGEMENT PANEL ACCORDING TO MY ROLE
GCubeCkanDataCatalog.service.getMyRole(new AsyncCallback<CkanRole>() {
@Override
public void onFailure(Throwable caught) {
}
@Override
public void onSuccess(CkanRole result) {
switch (result) {
case ADMIN:
setTopPanelVisible(true);
break;
case EDITOR:
setTopPanelVisible(true);
break;
case MEMBER:
setTopPanelVisible(false);
break;
case SYSADMIN:
setTopPanelVisible(true);
break;
default:
break;
}
}
});
Window.addResizeHandler(new ResizeHandler() {
@Override
public void onResize(ResizeEvent event) {
GWT.log("onWindowResized width: " + event.getWidth() + " height: " + event.getHeight());
updateSize();
}
});
rootPanel.add(loading);
rootPanel.add(this);
updateSize();
}
/**
* Gets the top panel height.
*
* @return the top panel height
*/
public int getTopPanelHeight(){
if(managementPanel.isVisible())
return managementPanel.getCurrentHeight();
return 0;
}
/**
* Sets the top panel visible.
*
* @param bool the new top panel visible
*/
public void setTopPanelVisible(boolean bool){
managementPanel.setVisible(bool);
updateSize();
}
/**
* Instance ckan frame.
*
* @param ckanUrlConnector the ckan url connector
* @return the frame
*/
private Frame instanceCkanFrame(String ckanUrlConnector){
return ckanFramePanel.instanceFrame(ckanUrlConnector);
}
/**
* Inits the panel.
*/
private void initPanel() {
setTopPanelVisible(false);
addToTop(managementPanel);
centerScrollable.add(ckanFramePanel);
addToMiddle(centerScrollable);
}
/**
* Update window size.
*/
public void updateSize(){
RootPanel workspace = rootPanel;
int topBorder = workspace.getAbsoluteTop();
int leftBorder = workspace.getAbsoluteLeft();
int footer = 0; //85 footer is bottombar + sponsor
int rightScrollBar = 0;
int rootHeight = Window.getClientHeight() - topBorder - 5 - footer;// - ((footer == null)?0:(footer.getOffsetHeight()-15));
int rootWidth = Window.getClientWidth() - 2* leftBorder - rightScrollBar;
GWT.log("New iFrame size w: "+rootWidth + " h: "+rootHeight);
this.setSize(rootWidth+"px",rootHeight+"px");
int height = rootHeight - getTopPanelHeight();
if(ckanFramePanel.getFrame()!=null)
ckanFramePanel.getFrame().setSize(rootWidth+"px", height+"px");
}
}

View File

@ -0,0 +1,46 @@
package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.portlet;
import java.io.IOException;
import javax.portlet.GenericPortlet;
import javax.portlet.PortletException;
import javax.portlet.PortletRequestDispatcher;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
/**
* The Class GCubeCkanDataCatalogPortlet.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Apr 12, 2016
*/
public class GCubeCkanDataCatalogPortlet extends GenericPortlet{
/**
* JSP folder name
*/
public static final String JSP_FOLDER = "/WEB-INF/jsp/";
/**
*
*/
public static final String VIEW_JSP = JSP_FOLDER + "GCubeCkanDataCatalogPortlet_view.jsp";
/**
* Do view.
*
* @param request .
* @param response .
* @throws PortletException .
* @throws IOException .
*/
public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException {
System.out.println("LOADING ********* FROM "+VIEW_JSP);
ScopeHelper.setContext(request, ScopeHelper.USERNAME_ATTRIBUTE);
PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher(VIEW_JSP);
rd.include(request,response);
}
}

View File

@ -0,0 +1,85 @@
/**
*
*/
package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.server;
import static org.gcube.resources.discovery.icclient.ICFactory.client;
import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
import java.util.List;
import org.gcube.common.resources.gcore.GCoreEndpoint;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.resources.discovery.client.api.DiscoveryClient;
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Jun 10, 2016
*/
public class GcoreEndpointReader {
private static final String ckanResource = "org.gcube.data.access.ckanconnector.CkanConnector";
private static final String serviceName = "CkanConnector";
private static final String serviceClass = "DataAccess";
private static Logger logger = LoggerFactory.getLogger(GcoreEndpointReader.class);
private String ckanResourceEntyName;
/**
*
*/
public GcoreEndpointReader(String scope) {
try{
logger.info("set scope "+scope);
ScopeProvider.instance.set(scope);
SimpleQuery query = queryFor(GCoreEndpoint.class);
query.addCondition(String.format("$resource/Profile/ServiceClass/text() eq '%s'",serviceClass));
query.addCondition("$resource/Profile/DeploymentData/Status/text() eq 'ready'");
query.addCondition(String.format("$resource/Profile/ServiceName/text() eq '%s'",serviceName));
query.setResult("$resource/Profile/AccessPoint/RunningInstanceInterfaces//Endpoint[@EntryName/string() eq \""+ckanResource+"\"]/text()");
logger.debug("submitting quey "+query.toString());
DiscoveryClient<String> client = client();
List<String> endpoints = client.submit(query);
if (endpoints == null || endpoints.isEmpty()) throw new Exception("Cannot retrieve the GCoreEndpoint serviceName: "+serviceName +", serviceClass: " +serviceClass +", in scope: "+scope);
this.ckanResourceEntyName = endpoints.get(0);
if(ckanResourceEntyName==null)
throw new Exception("Endpoint:"+ckanResource+", is null for serviceName: "+serviceName +", serviceClass: " +serviceClass +", in scope: "+scope);
logger.info("found entyname "+ckanResourceEntyName+" for ckanResource: "+ckanResource);
/*Group<Endpoint> accessPoints = se.profile().endpoints();
if(accessPoints.size()==0) throw new Exception("Endpoint in serviceName serviceName: "+serviceName +", serviceClass: " +serviceClass +", in scope: "+scope +" not found");
Endpoint ep = accessPoints.iterator().next();
String epName = ep.name();
System.out.println(epName);*/
}catch(Exception e){
logger.error("An error occurred during GCoreEndpoint discovery, serviceName: "+serviceName +", serviceClass: " +serviceClass +", in scope: "+scope +" not found", e);
}finally{
logger.info("scope provider reset");
ScopeProvider.instance.reset();
}
}
/**
* @return the ckanResourceEntyName
*/
public String getCkanResourceEntyName() {
return ckanResourceEntyName;
}
}

View File

@ -0,0 +1,154 @@
package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.server;
import static org.gcube.common.authorization.client.Constants.authorizationService;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpSession;
import org.gcube.application.framework.core.session.ASLSession;
import org.gcube.application.framework.core.session.SessionManager;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.GcubeCkanDataCatalogService;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared.CkanRole;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
/**
* The server side implementation of the RPC service.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Jun 10, 2016
*/
@SuppressWarnings("serial")
public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implements GcubeCkanDataCatalogService {
private static final String PORT_HTTP = ":80";
private static final String PORT_HTTPS = ":443";
private static final String GCUBE_TOKEN = "gcube-token";
private static final String HTTPS = "https";
private static final String HTTP = "http";
public static String CKANCONNECTORCONTEXT = "CkanConnectorContext";
public static final String USERNAME_ATTRIBUTE = ScopeHelper.USERNAME_ATTRIBUTE;
private static Logger logger = LoggerFactory.getLogger(GcubeCkanDataCatalogServiceImpl.class);
private final static String DEFAULT_ROLE = "OrganizationMember";
private final static String TEST_USER = "francesco.mangiacrapa";
private final static String TEST_SCOPE = "/gcube/devsec/devVRE";
private final static String TEST_SEC_TOKEN = "4620e6d0-2313-4f48-9d54-eb3efd01a810";
// private final static String TEST_SEC_TOKEN = "f539884c-8697-4ac0-9bbf-2f4d595281f5";
/* (non-Javadoc)
* @see org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.GcubeCkanDataCatalogService#getCKanConnector()
*/
@Override
public String getCKanConnector() throws Exception{
logger.trace("getCKanConnector...");
try{
String ckanContext = getServletContext().getInitParameter(CKANCONNECTORCONTEXT);
logger.debug(CKANCONNECTORCONTEXT + " is: "+ckanContext);
ASLSession session = getASLSession(this.getThreadLocalRequest().getSession());
GcoreEndpointReader ckanEndPoint = SessionUtil.getCkanEndPoint(session);
String ckanConnectorUri = ckanEndPoint.getCkanResourceEntyName();
logger.debug(ckanConnectorUri + "is : "+ckanConnectorUri);
ckanConnectorUri = ckanConnectorUri.startsWith(HTTP) && !ckanConnectorUri.startsWith(HTTPS)?ckanConnectorUri.replaceFirst(HTTP, HTTPS):ckanConnectorUri;
ckanConnectorUri = ckanConnectorUri.contains(PORT_HTTP)?ckanConnectorUri.replace(PORT_HTTP, PORT_HTTPS):ckanConnectorUri;
ckanConnectorUri+=ckanContext;
logger.debug("CKanConnector URI + Context: "+ckanConnectorUri);
logger.debug("adding gcube token parameter...");
if(SessionUtil.isIntoPortal()){
ckanConnectorUri+="?"+GCUBE_TOKEN+"="+getGcubeSecurityToken();
}else{
logger.warn("******** Using TEST_USER security token!!!");
ckanConnectorUri+="?"+GCUBE_TOKEN+"="+TEST_SEC_TOKEN;
}
logger.info("returning ckanConnectorUri: "+ckanConnectorUri);
return ckanConnectorUri;
// return "http://ckan-d-d4s.d4science.org";
}catch(Exception e ){
String message = "Sorry an error occurred during contacting gCube Ckan Data Catalogue";
logger.error(message, e);
throw new Exception(message);
}
}
/**
* Gets the gcube security token.
*
* @return the gcube security token
*/
protected String getGcubeSecurityToken() {
HttpSession httpSession = this.getThreadLocalRequest().getSession();
ASLSession session = getASLSession(httpSession);
logger.debug("Get security token return: "+session.getSecurityToken());
if(session.getSecurityToken()==null || session.getSecurityToken().isEmpty()){
logger.warn("Security token retured from ASL is null or empty, I'm setting security token...");
setAuthorizationToken(session);
}
return session.getSecurityToken();
}
/**
* Temporary method to set the authorization token.
*
* @param session the new authorization token
*/
private static void setAuthorizationToken(ASLSession session) {
String username = session.getUsername();
String scope = session.getScope();
ScopeProvider.instance.set(scope);
logger.debug("calling service token on scope " + scope);
List<String> userRoles = new ArrayList<String>();
userRoles.add(DEFAULT_ROLE);
session.setSecurityToken(null);
String token = authorizationService().build().generate(session.getUsername(), userRoles);
logger.debug("received token: "+token);
session.setSecurityToken(token);
logger.info("Security token set in session for: "+username + " on " + scope);
}
/**
* Gets the ASL session.
*
* @param httpSession the http session
* @return the ASL session
*/
protected ASLSession getASLSession(HttpSession httpSession)
{
String sessionID = httpSession.getId();
String user = (String) httpSession.getAttribute(USERNAME_ATTRIBUTE);
if (user == null) {
logger.warn("****** STARTING IN TEST MODE - NO USER FOUND *******");
//for test only
user = TEST_USER;
httpSession.setAttribute(USERNAME_ATTRIBUTE, user);
ASLSession session = SessionManager.getInstance().getASLSession(sessionID, user);
session.setScope(TEST_SCOPE);
//session.setScope("/gcube/devsec/devVRE");
return session;
} else logger.trace("user found in session "+user);
return SessionManager.getInstance().getASLSession(sessionID, user);
}
/* (non-Javadoc)
* @see org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.GcubeCkanDataCatalogService#getMyRole()
*/
@Override
public CkanRole getMyRole() throws Exception{
//TODO READ FROM IS
return CkanRole.ADMIN;
}
}

View File

@ -0,0 +1,59 @@
/**
*
*/
package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.server;
import org.gcube.application.framework.core.session.ASLSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.liferay.portal.service.UserLocalServiceUtil;
/**
* The Class SessionUtil.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Jun 10, 2016
*/
public class SessionUtil {
public static final String CKAN_END_POINT = "CKAN_END_POINT";
private static Logger logger = LoggerFactory.getLogger(SessionUtil.class);
/**
* Gets the ckan end point.
*
* @param session the session
* @return the ckan end point
*/
public static GcoreEndpointReader getCkanEndPoint(ASLSession session){
GcoreEndpointReader ckanEndPoint = (GcoreEndpointReader) session.getAttribute(CKAN_END_POINT);
if(ckanEndPoint==null){
logger.debug("GcoreEndpointReader is null, instancing new..");
ckanEndPoint = new GcoreEndpointReader(session.getScope());
session.setAttribute(CKAN_END_POINT, ckanEndPoint);
}
logger.debug("returning: "+ckanEndPoint);
return ckanEndPoint;
}
/**
* Checks if is into portal.
*
* @return true, if is into portal
*/
public static boolean isIntoPortal() {
try {
UserLocalServiceUtil.getService();
return true;
}
catch (Exception ex) {
logger.trace("Development Mode ON");
return false;
}
}
}

View File

@ -0,0 +1,18 @@
/**
*
*/
package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared;
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Jun 9, 2016
*/
public enum CkanRole {
MEMBER,
EDITOR,
ADMIN,
SYSADMIN
}

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='gCubeCkanDataCatalog'>
<!-- 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.github.gwtbootstrap.Bootstrap" />
<!-- <inherits name='com.google.gwt.user.theme.standard.Standard' /> -->
<!-- <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.gcubeckan.gcubeckandatacatalog.client.GCubeCkanDataCatalog' />
<!-- Specify the paths for translatable code -->
<source path='client' />
<source path='shared' />
</module>

View File

@ -0,0 +1,2 @@
sendButton = Envoyer
nameField = Entrez votre nom

View File

@ -0,0 +1,39 @@
/** Add css rules here for your application. */
body {
padding-top: 0px !important; /** OVERRIDE GWT BOOTSTRAP PADDING TOP TO 50px*/
}
/** 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;
}

View File

@ -0,0 +1,28 @@
<!doctype html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link type="text/css" rel="stylesheet" href="GCubeCkanDataCatalog.css">
<script type="text/javascript" src="gCubeCkanDataCatalog/gCubeCkanDataCatalog.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>
<div id="gCubeCkanDataCatalog"></div>
</body>
</html>

View File

@ -0,0 +1,12 @@
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%-- Uncomment below lines to add portlet taglibs to jsp
<%@ page import="javax.portlet.*"%>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>
<portlet:defineObjects />
--%>
<link rel="stylesheet" href="<%=request.getContextPath()%>/GCubeCkanDataCatalog.css" type="text/css">
<script type="text/javascript" src="<%=request.getContextPath()%>/gCubeCkanDataCatalog/gCubeCkanDataCatalog.nocache.js"></script>
<div id="gCubeCkanDataCatalog"></div>

View File

@ -0,0 +1,5 @@
<display>
<category name="gCube Applications">
<portlet id="GCubeCkanDataCatalogPortlet" />
</category>
</display>

View File

@ -0,0 +1,9 @@
name=GCubeCkanDataCatalogPortlet
module-group-id=liferay
module-incremental-version=2
tags=
short-description=
change-log=
page-url=http://www.gcube-system.org
author=gCube
licenses=EUPL

View File

@ -0,0 +1,11 @@
<?xml version="1.0"?>
<!DOCTYPE liferay-portlet-app PUBLIC "-//Liferay//DTD Portlet Application 5.2.0//EN" "http://www.liferay.com/dtd/liferay-portlet-app_5_2_0.dtd">
<liferay-portlet-app>
<portlet>
<portlet-name>GCubeCkanDataCatalogPortlet</portlet-name>
<layout-cacheable>false</layout-cacheable>
<instanceable>false</instanceable>
<ajaxable>false</ajaxable>
</portlet>
</liferay-portlet-app>

View File

@ -0,0 +1,18 @@
<?xml version='1.0' encoding='UTF-8' ?>
<portlet-app>
<portlet>
<description>GCube-Ckan Data Catalog Portlet</description>
<portlet-name>GCubeCkanDataCatalogPortlet</portlet-name>
<display-name>GCubeCkanDataCatalogPortlet</display-name>
<portlet-class>org.gcube.portlets.gcubeckan.gcubeckandatacatalog.portlet.GCubeCkanDataCatalogPortlet</portlet-class>
<expiration-cache>0</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
</supports>
<portlet-info>
<title>GCubeCkanDataCatalogPortlet</title>
<short-title>GCubeCkanDataCatalogPortlet</short-title>
</portlet-info>
</portlet>
</portlet-app>

View File

@ -0,0 +1,32 @@
<?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>
<context-param>
<param-name>CkanConnectorContext</param-name>
<!-- <param-value>/connect</param-value> -->
<param-value>/gcube/service/connect</param-value>
</context-param>
<!-- Servlets -->
<servlet>
<servlet-name>gcubeckandatacatalogservice</servlet-name>
<servlet-class>org.gcube.portlets.gcubeckan.gcubeckandatacatalog.server.GcubeCkanDataCatalogServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>gcubeckandatacatalogservice</servlet-name>
<url-pattern>/gCubeCkanDataCatalog/ckandatacatalogue</url-pattern>
</servlet-mapping>
<!-- Default page to serve -->
<welcome-file-list>
<welcome-file>GCubeCkanDataCatalog.html</welcome-file>
</welcome-file-list>
</web-app>

View File

@ -0,0 +1,26 @@
package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client;
import com.google.gwt.junit.client.GWTTestCase;
/**
* GWT JUnit <b>integration</b> tests must extend GWTTestCase.
* Using <code>"GwtTest*"</code> naming pattern exclude them from running with
* surefire during the test phase.
*
* If you run the tests using the Maven command line, you will have to
* navigate with your browser to a specific url given by Maven.
* See https://gwt-maven-plugin.github.io/gwt-maven-plugin/user-guide/testing.html
* for details.
*/
public class GwtTestGCubeCkanDataCatalog extends GWTTestCase {
/**
* Must refer to a valid module that sources this class.
*/
public String getModuleName() {
return "org.gcube.portlets.gcubeckan.gcubeckandatacatalog.GCubeCkanDataCatalogJUnit";
}
}

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to="GCubeCkanDataCatalog">
<!-- Inherit our applications main module. -->
<inherits name='org.gcube.portlets.gcubeckan.gcubeckandatacatalog.GCubeCkanDataCatalog' />
<!-- Specify the path to any remote services. -->
<servlet path="/GCubeCkanDataCatalog/greet" class="org.gcube.portlets.gcubeckan.gcubeckandatacatalog.server.GreetingServiceImpl" />
</module>