added portlet configurations

This commit is contained in:
francesco 2020-10-26 12:24:23 +01:00
parent 3c80de9703
commit 4a0a4c0c64
16 changed files with 188 additions and 45 deletions

32
pom.xml
View File

@ -47,6 +47,18 @@
</developer>
</developers>
<dependencyManagement>
<!-- <dependencies> -->
<!-- <dependency> -->
<!-- <groupId>org.gcube.distribution</groupId> -->
<!-- <artifactId>maven-portal-bom</artifactId> -->
<!-- <version>3.6.0</version> -->
<!-- <type>pom</type> -->
<!-- <scope>import</scope> -->
<!-- </dependency> -->
<!-- </dependencies> -->
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
@ -77,6 +89,26 @@
<version>2.3.2.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.gcube.common.portal</groupId>
<artifactId>portal-manager</artifactId>
<version>[2.4.1,3.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.liferay.portal</groupId>
<artifactId>portal-service</artifactId>
<version>6.2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.portlet</groupId>
<artifactId>portlet-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>

View File

@ -10,6 +10,7 @@ import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.event.logical.shared.ResizeEvent;
import com.google.gwt.event.logical.shared.ResizeHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.RootPanel;
/**
@ -27,9 +28,7 @@ public class GeoportalDataViewer implements EntryPoint {
/**
* Create a remote service proxy to talk to the server-side Greeting service.
*/
private final GreetingServiceAsync greetingService = GWT.create(GreetingService.class);
private final Messages messages = GWT.create(Messages.class);
private final GeoportalDataViewerServiceAsync greetingService = GWT.create(GeoportalDataViewerService.class);
public final static String APP_DIV = "geoportal-data-viewer";
@ -69,6 +68,21 @@ public class GeoportalDataViewer implements EntryPoint {
mainPanel.setHeight(event.getHeight()-200);
}
});
greetingService.greetServer("SERVICE IMPL", new AsyncCallback<String>() {
@Override
public void onSuccess(String result) {
Window.alert(result);
}
@Override
public void onFailure(Throwable caught) {
}
});
}

View File

@ -6,7 +6,7 @@ import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
/**
* The client side stub for the RPC service.
*/
@RemoteServiceRelativePath("greet")
public interface GreetingService extends RemoteService {
@RemoteServiceRelativePath("geoportaldataviewerservice")
public interface GeoportalDataViewerService extends RemoteService {
String greetServer(String name) throws IllegalArgumentException;
}

View File

@ -3,12 +3,12 @@ package org.gcube.portlets.user.geoportaldataviewer.client;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
public interface GreetingServiceAsync
public interface GeoportalDataViewerServiceAsync
{
/**
* GWT-RPC service asynchronous (client-side) interface
* @see org.gcube.portlets.user.geoportaldataviewer.client.GreetingService
* @see org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerService
*/
void greetServer( java.lang.String name, AsyncCallback<java.lang.String> callback );
@ -18,13 +18,13 @@ public interface GreetingServiceAsync
*/
public static final class Util
{
private static GreetingServiceAsync instance;
private static GeoportalDataViewerServiceAsync instance;
public static final GreetingServiceAsync getInstance()
public static final GeoportalDataViewerServiceAsync getInstance()
{
if ( instance == null )
{
instance = (GreetingServiceAsync) GWT.create( GreetingService.class );
instance = (GeoportalDataViewerServiceAsync) GWT.create( GeoportalDataViewerService.class );
}
return instance;
}

View File

@ -1,13 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client;
import com.google.gwt.i18n.client.LocalizableResource.Generate;
@Generate(format = "com.google.gwt.i18n.server.PropertyCatalogFactory")
public interface Messages extends com.google.gwt.i18n.client.Messages {
@DefaultMessage("Enter your name")
String nameField();
@DefaultMessage("Send")
String sendButton();
}

View File

@ -3,7 +3,6 @@ package org.gcube.portlets.user.geoportaldataviewer.client.gis;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
import ol.Coordinate;
import ol.Extent;
import ol.Map;
import ol.MapOptions;
import ol.OLFactory;
@ -21,8 +20,6 @@ import ol.source.ImageWms;
import ol.source.ImageWmsOptions;
import ol.source.ImageWmsParams;
import ol.source.Osm;
import ol.source.TileDebug;
import ol.source.TileDebugOptions;
import ol.source.XyzOptions;
/**

View File

@ -1,14 +1,8 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HasText;
import com.google.gwt.user.client.ui.Widget;
public class BasePanel extends Composite {

View File

@ -0,0 +1,47 @@
package org.gcube.portlets.user.geoportaldataviewer.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.common.portal.PortalContext;
/**
* The Class GeoPortalDataEntryApp.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Oct 8, 2020
*/
public class GeoPortalDataViewerAppPortlet extends GenericPortlet{
/**
* JSP folder name
*/
public static final String JSP_FOLDER = "/WEB-INF/jsp/";
/**
*
*/
public static final String VIEW_JSP = JSP_FOLDER + "GeoPortalDataViewerAppPortlet_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);
PortalContext.setUserInSession(request);
PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher(VIEW_JSP);
rd.include(request,response);
}
}

View File

@ -1,6 +1,6 @@
package org.gcube.portlets.user.geoportaldataviewer.server;
import org.gcube.portlets.user.geoportaldataviewer.client.GreetingService;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerService;
import org.gcube.portlets.user.geoportaldataviewer.shared.FieldVerifier;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
@ -9,8 +9,8 @@ import com.google.gwt.user.server.rpc.RemoteServiceServlet;
* The server side implementation of the RPC service.
*/
@SuppressWarnings("serial")
public class GreetingServiceImpl extends RemoteServiceServlet implements
GreetingService {
public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet implements
GeoportalDataViewerService {
public String greetServer(String input) throws IllegalArgumentException {
// Verify that the input is valid.

View File

@ -0,0 +1,22 @@
ac<%@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()%>/"GeoportalDataViewer.css"
type="text/css">
<script type="text/javascript"
src="<%=request.getContextPath()%>/GeoportalDataViewer/GeoportalDataViewer.nocache.js"></script>
<!-- <script type="text/javascript"
src='<%=request.getContextPath()%>/js/jquery.autosize.js'></script> -->
<div id="geoportal-data-viewer"></div>

View File

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

View File

@ -0,0 +1,9 @@
name=GeoPortalDataViewerAppPortlet
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>GeoPortalDataViewerAppPortlet</portlet-name>
<layout-cacheable>false</layout-cacheable>
<instanceable>false</instanceable>
<ajaxable>false</ajaxable>
</portlet>
</liferay-portlet-app>

View File

@ -0,0 +1,25 @@
<?xml version='1.0' encoding='UTF-8' ?>
<portlet-app>
<portlet>
<description>GeoPortalDataViewerApp Portlet</description>
<portlet-name>GeoPortalDataViewerAppPortlet</portlet-name>
<display-name>GeoPortal-DataViewerApp-Portlet</display-name>
<portlet-class>org.gcube.portlets.user.geoportaldataviewer.portlet.GeoPortalDataViewerAppPortlet
</portlet-class>
<expiration-cache>0</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
</supports>
<portlet-info>
<title>GeoPortal DataViewerApp Portlet</title>
<short-title>GeoPortal DataViewerApp Portlet</short-title>
</portlet-info>
<portlet-preferences>
<preference>
<name>portletSetupShowBorders</name>
<value>false</value>
</preference>
</portlet-preferences>
</portlet>
</portlet-app>

View File

@ -1,19 +1,19 @@
<?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>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<!-- Servlets -->
<servlet>
<servlet-name>greetServlet</servlet-name>
<servlet-class>org.gcube.portlets.user.geoportaldataviewer.server.GreetingServiceImpl</servlet-class>
<servlet-name>geoportalDataViewerServlet</servlet-name>
<servlet-class>org.gcube.portlets.user.geoportaldataviewer.server.GeoportalDataViewerServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>greetServlet</servlet-name>
<url-pattern>/GeoportalDataViewer/greet</url-pattern>
<servlet-name>geoportalDataViewerServlet</servlet-name>
<url-pattern>/GeoportalDataViewer/geoportaldataviewerservice</url-pattern>
</servlet-mapping>
<!-- Default page to serve -->

View File

@ -43,7 +43,7 @@ public class GwtTestGeoportalDataViewer extends GWTTestCase {
*/
public void testGreetingService() {
// Create the service that we will test.
GreetingServiceAsync greetingService = GWT.create(GreetingService.class);
GeoportalDataViewerServiceAsync greetingService = GWT.create(GeoportalDataViewerService.class);
ServiceDefTarget target = (ServiceDefTarget) greetingService;
target.setServiceEntryPoint(GWT.getModuleBaseURL() + "GeoportalDataViewer/greet");