From eb23d0318c1fa7f4ef6a1a1acbc8d17030428858 Mon Sep 17 00:00:00 2001 From: Francesco Mangiacrapa Date: Thu, 23 Jun 2016 10:49:45 +0000 Subject: [PATCH] Updated functionalities bar in order to avoid browser refresh git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/gcube-ckan-datacatalog@129341 82a268e6-3cf1-43bd-a215-b396298e98cf --- .project | 1 + .settings/com.google.gwt.eclipse.core.prefs | 2 +- .settings/org.eclipse.wst.common.component | 5 +- .../client/CkanEventHandlerManager.java | 341 ++++++++++-------- .../client/GCubeCkanDataCatalog.java | 26 ++ .../client/GcubeCkanDataCatalogService.java | 5 +- .../GcubeCkanDataCatalogServiceAsync.java | 10 +- .../client/event/IFrameInstanciedEvent.java | 39 ++ .../event/IFrameInstanciedEventHandler.java | 23 ++ .../client/event/NotifyLogoutEvent.java | 39 ++ .../event/NotifyLogoutEventHandler.java | 22 ++ .../client/utility/BrowserCloseDetector.java | 40 ++ .../client/view/CkanFramePanel.java | 24 +- .../view/GCubeCkanDataCatalogPanel.java | 35 +- .../GcubeCkanDataCatalogServiceImpl.java | 125 ++++--- .../shared/CkanConnectorAccessPoint.java | 201 +++++++++++ src/main/webapp/WEB-INF/web.xml | 12 +- 17 files changed, 742 insertions(+), 208 deletions(-) create mode 100644 src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/event/IFrameInstanciedEvent.java create mode 100644 src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/event/IFrameInstanciedEventHandler.java create mode 100644 src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/event/NotifyLogoutEvent.java create mode 100644 src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/event/NotifyLogoutEventHandler.java create mode 100644 src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/utility/BrowserCloseDetector.java create mode 100644 src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/shared/CkanConnectorAccessPoint.java diff --git a/.project b/.project index 51b285c..d2ecc22 100644 --- a/.project +++ b/.project @@ -46,6 +46,7 @@ org.eclipse.wst.common.modulecore.ModuleCoreNature org.eclipse.jdt.core.javanature org.eclipse.m2e.core.maven2Nature + org.maven.ide.eclipse.maven2Nature org.eclipse.wst.common.project.facet.core.nature org.eclipse.wst.jsdt.core.jsNature com.google.gwt.eclipse.core.gwtNature diff --git a/.settings/com.google.gwt.eclipse.core.prefs b/.settings/com.google.gwt.eclipse.core.prefs index f23a752..3acdfdb 100644 --- a/.settings/com.google.gwt.eclipse.core.prefs +++ b/.settings/com.google.gwt.eclipse.core.prefs @@ -1,2 +1,2 @@ eclipse.preferences.version=1 -entryPointModules= +entryPointModules=org.gcube.portlets.gcubeckan.gcubeckandatacatalog.GCubeCkanDataCatalog diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index 0df7cc0..1afbdfc 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -4,7 +4,10 @@ - + + uses + + uses diff --git a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/CkanEventHandlerManager.java b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/CkanEventHandlerManager.java index 8eaf13f..21bd063 100644 --- a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/CkanEventHandlerManager.java +++ b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/CkanEventHandlerManager.java @@ -1,9 +1,14 @@ + package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client; import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.EditMetadataEvent; import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.EditMetadataEventHandler; +import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.IFrameInstanciedEvent; +import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.IFrameInstanciedEventHandler; import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.InsertMetadataEvent; import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.InsertMetadataEventHandler; +import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.NotifyLogoutEvent; +import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.NotifyLogoutEventHandler; import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowHomeEvent; import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowHomeEventHandler; import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowStatisticsEvent; @@ -13,6 +18,7 @@ import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowUserDa import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowUserOrganizationsEvent; import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowUserOrganizationsEventHandler; import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.view.GCubeCkanDataCatalogPanel; +import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared.CkanConnectorAccessPoint; import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.CreateDatasetForm; import com.github.gwtbootstrap.client.ui.Modal; @@ -20,12 +26,9 @@ import com.google.gwt.event.shared.HandlerManager; import com.google.gwt.user.client.Window; import com.google.gwt.user.client.rpc.AsyncCallback; - /** - * * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it - * @author Costantino Perciante costantino.perciante@isti.cnr.it - * Jun 10, 2016 + * @author Costantino Perciante costantino.perciante@isti.cnr.it Jun 10, 2016 */ public class CkanEventHandlerManager { @@ -39,193 +42,235 @@ public class CkanEventHandlerManager { bind(); } - /** - * @param panel the panel to set + * @param panel + * the panel to set */ public void setPanel(GCubeCkanDataCatalogPanel panel) { + this.panel = panel; } - - private void bind() { - + // bind on show home event eventBus.addHandler(ShowHomeEvent.TYPE, new ShowHomeEventHandler() { - + @Override public void onShowHome(ShowHomeEvent showHomeEvent) { - - // redirect - String baseUrlCkanConnector = panel.getBaseURLCKANConnector(); - panel.instanceCkanFrame(baseUrlCkanConnector); - + + CkanConnectorAccessPoint ckan = new CkanConnectorAccessPoint( panel.getBaseURLCKANConnector()); + ckan.addGubeToken(panel.getGcubeTokenValueToCKANConnector()); + panel.instanceCkanFrame(ckan.buildURI()); } }); - // bind on insert metadata eventBus.addHandler(InsertMetadataEvent.TYPE, new InsertMetadataEventHandler() { - @Override - public void onInsertMetadata(InsertMetadataEvent loadSelecteReleaseEvent) { + @Override + public void onInsertMetadata( + InsertMetadataEvent loadSelecteReleaseEvent) { - final Modal modal = new Modal(true, true); + final Modal modal = new Modal(true, true); + // request who's doing the insert + GCubeCkanDataCatalog.service.getUser(new AsyncCallback() { - // request who's doing the insert - GCubeCkanDataCatalog.service.getUser(new AsyncCallback() { + @Override + public void onSuccess(String username) { - @Override - public void onSuccess(String username) { - - if(username != null){ - modal.setTitle("Publish Product"); - modal.addStyleName("insert-metadata-modal-style"); - modal.add(new CreateDatasetForm(username)); - modal.setCloseVisible(true); - modal.show(); + if (username != null) { + modal.setTitle("Publish Product"); + modal.addStyleName("insert-metadata-modal-style"); + modal.add(new CreateDatasetForm(username)); + modal.setCloseVisible(true); + modal.show(); + } + else + Window.alert("Please, logout and login again then retry."); } - else - Window.alert("Please, logout and login again then retry."); + @Override + public void onFailure(Throwable caught) { + + Window.alert("Please, logout and login again then retry."); + } + }); + } + }); + // bind on edit (TODO) + eventBus.addHandler( + EditMetadataEvent.TYPE, new EditMetadataEventHandler() { + + @Override + public void onEditMetadata(EditMetadataEvent editMetadataEvent) { + + // TODO Auto-generated method stub + } + }); + // show datasets event + eventBus.addHandler( + ShowUserDatasetsEvent.TYPE, new ShowUserDatasetsEventHandler() { + + @Override + public void onShowDatasets( + ShowUserDatasetsEvent showUserDatasetsEvent) { + + // // get the current path + // String currentPath = Window.Location.getHref(); + // + // // check if the "path" parameter is already present + // String currentParameter = + // Window.Location.getParameter(GCubeCkanDataCatalog.GET_PATH_PARAMETER); + // + // // the final path must be + // String queryPar = "?" + + // GCubeCkanDataCatalog.GET_PATH_PARAMETER + "=" + + // "/dashboard/datasets"; + // + // String finalPath; + // + // if(currentParameter == null){ + // finalPath = currentPath + queryPar; + // + // }else{ + // + // // remove from the first "path" on + // int index = + // currentPath.lastIndexOf("?"+GCubeCkanDataCatalog.GET_PATH_PARAMETER); + // String firstPartOfThePath = currentPath.substring(0, + // index); + // finalPath = firstPartOfThePath + queryPar; + // + // } + // + // // redirect + // Window.Location.assign(finalPath); + // redirect +// String baseUrlCkanConnector = panel.getBaseURLCKANConnector(); + CkanConnectorAccessPoint ckan = new CkanConnectorAccessPoint( panel.getBaseURLCKANConnector()); + ckan.addGubeToken(panel.getGcubeTokenValueToCKANConnector()); + ckan.addPathInfo("/dashboard/datasets"); + panel.instanceCkanFrame(ckan.buildURI()); + } + }); + eventBus.addHandler( + ShowUserOrganizationsEvent.TYPE, + new ShowUserOrganizationsEventHandler() { + + @Override + public void onShowOrganizations( + ShowUserOrganizationsEvent showUserDatasetsEvent) { + + // get the current path + /*String currentPath = Window.Location.getHref(); + // check if the "path" parameter is already present + String currentParameter = + Window.Location.getParameter(GCubeCkanDataCatalog.GET_PATH_PARAMETER); + // the final path must be + String queryPar = + "?" + GCubeCkanDataCatalog.GET_PATH_PARAMETER + "=" + + "/dashboard/organizations"; + String finalPath; + if (currentParameter == null) { + finalPath = currentPath + queryPar; } + else { + // remove from the first "path" on + int index = + currentPath.lastIndexOf("?" + + GCubeCkanDataCatalog.GET_PATH_PARAMETER); + String firstPartOfThePath = + currentPath.substring(0, index); + finalPath = firstPartOfThePath + queryPar; + } + Window.Location.assign(finalPath); + */ + // redirect + CkanConnectorAccessPoint ckan = new CkanConnectorAccessPoint( panel.getBaseURLCKANConnector()); + ckan.addGubeToken(panel.getGcubeTokenValueToCKANConnector()); + ckan.addPathInfo("/dashboard/organizations"); + panel.instanceCkanFrame(ckan.buildURI()); + } + }); + // show statistics event + eventBus.addHandler( + ShowStatisticsEvent.TYPE, new ShowStatisticsEventHandler() { + + @Override + public void onShowStatistics( + ShowStatisticsEvent showStatisticsEvent) { + + // get the current path + /*String currentPath = Window.Location.getHref(); + // check if the "path" parameter is already present + String currentParameter = + Window.Location.getParameter(GCubeCkanDataCatalog.GET_PATH_PARAMETER); + // the final path must be + String queryPar = + "?" + GCubeCkanDataCatalog.GET_PATH_PARAMETER + "=" + + "/stats"; + String finalPath; + if (currentParameter == null) { + finalPath = currentPath + queryPar; + } + else { + // remove from the first "path" on + int index = + currentPath.lastIndexOf("?" + + GCubeCkanDataCatalog.GET_PATH_PARAMETER); + String firstPartOfThePath = + currentPath.substring(0, index); + finalPath = firstPartOfThePath + queryPar; + } + // redirect + Window.Location.assign(finalPath);*/ + + CkanConnectorAccessPoint ckan = new CkanConnectorAccessPoint( panel.getBaseURLCKANConnector()); + ckan.addGubeToken(panel.getGcubeTokenValueToCKANConnector()); + ckan.addPathInfo("/stats"); + panel.instanceCkanFrame(ckan.buildURI()); + } + }); + + eventBus.addHandler(NotifyLogoutEvent.TYPE, new NotifyLogoutEventHandler() { + + @Override + public void onLogout(NotifyLogoutEvent editMetadataEvent) { + + GCubeCkanDataCatalog.service.logoutFromCkan(new AsyncCallback() { @Override public void onFailure(Throwable caught) { - Window.alert("Please, logout and login again then retry."); + // TODO Auto-generated method stub + + } + + @Override + public void onSuccess(Void result) { + + // TODO Auto-generated method stub } }); } }); - // bind on edit (TODO) - eventBus.addHandler(EditMetadataEvent.TYPE, new EditMetadataEventHandler() { + eventBus.addHandler(IFrameInstanciedEvent.TYPE, new IFrameInstanciedEventHandler() { @Override - public void onEditMetadata(EditMetadataEvent editMetadataEvent) { - // TODO Auto-generated method stub + public void onNewInstance(IFrameInstanciedEvent iFrameInstanciedEent) { + panel.updateSize(); } }); - - // show datasets event - eventBus.addHandler(ShowUserDatasetsEvent.TYPE, new ShowUserDatasetsEventHandler() { - - @Override - public void onShowDatasets(ShowUserDatasetsEvent showUserDatasetsEvent) { - -// // get the current path -// String currentPath = Window.Location.getHref(); -// -// // check if the "path" parameter is already present -// String currentParameter = Window.Location.getParameter(GCubeCkanDataCatalog.GET_PATH_PARAMETER); -// -// // the final path must be -// String queryPar = "?" + GCubeCkanDataCatalog.GET_PATH_PARAMETER + "=" + "/dashboard/datasets"; -// -// String finalPath; -// -// if(currentParameter == null){ -// finalPath = currentPath + queryPar; -// -// }else{ -// -// // remove from the first "path" on -// int index = currentPath.lastIndexOf("?"+GCubeCkanDataCatalog.GET_PATH_PARAMETER); -// String firstPartOfThePath = currentPath.substring(0, index); -// finalPath = firstPartOfThePath + queryPar; -// -// } -// -// // redirect -// Window.Location.assign(finalPath); - - // redirect - String baseUrlCkanConnector = panel.getBaseURLCKANConnector(); - baseUrlCkanConnector += "/dashboard/datasets"; - panel.instanceCkanFrame(baseUrlCkanConnector); - - } - }); - - eventBus.addHandler(ShowUserOrganizationsEvent.TYPE, new ShowUserOrganizationsEventHandler() { - - @Override - public void onShowOrganizations( - ShowUserOrganizationsEvent showUserDatasetsEvent) { - - // get the current path - String currentPath = Window.Location.getHref(); - - // check if the "path" parameter is already present - String currentParameter = Window.Location.getParameter(GCubeCkanDataCatalog.GET_PATH_PARAMETER); - - // the final path must be - String queryPar = "?" + GCubeCkanDataCatalog.GET_PATH_PARAMETER + "=" + "/dashboard/organizations"; - - String finalPath; - - if(currentParameter == null){ - finalPath = currentPath + queryPar; - - }else{ - - // remove from the first "path" on - int index = currentPath.lastIndexOf("?"+GCubeCkanDataCatalog.GET_PATH_PARAMETER); - String firstPartOfThePath = currentPath.substring(0, index); - finalPath = firstPartOfThePath + queryPar; - - } - - // redirect - Window.Location.assign(finalPath); - - } - }); - - // show statistics event - eventBus.addHandler(ShowStatisticsEvent.TYPE, new ShowStatisticsEventHandler() { - - @Override - public void onShowStatistics(ShowStatisticsEvent showStatisticsEvent) { - - // get the current path - String currentPath = Window.Location.getHref(); - - // check if the "path" parameter is already present - String currentParameter = Window.Location.getParameter(GCubeCkanDataCatalog.GET_PATH_PARAMETER); - - // the final path must be - String queryPar = "?" + GCubeCkanDataCatalog.GET_PATH_PARAMETER + "=" + "/stats"; - - String finalPath; - - if(currentParameter == null){ - finalPath = currentPath + queryPar; - - }else{ - - // remove from the first "path" on - int index = currentPath.lastIndexOf("?"+GCubeCkanDataCatalog.GET_PATH_PARAMETER); - String firstPartOfThePath = currentPath.substring(0, index); - finalPath = firstPartOfThePath + queryPar; - - } - - // redirect - Window.Location.assign(finalPath); - - } - }); - } /** * @return */ public HandlerManager getEventBus() { + return eventBus; } } diff --git a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/GCubeCkanDataCatalog.java b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/GCubeCkanDataCatalog.java index f944334..21ce1d3 100644 --- a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/GCubeCkanDataCatalog.java +++ b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/GCubeCkanDataCatalog.java @@ -1,10 +1,13 @@ package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client; +import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.NotifyLogoutEvent; 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.Window; +import com.google.gwt.user.client.Window.ClosingEvent; import com.google.gwt.user.client.ui.RootPanel; @@ -27,6 +30,29 @@ public class GCubeCkanDataCatalog implements EntryPoint { * This is the entry point method. */ public void onModuleLoad() { +// if (BrowserCloseDetector.get().wasClosed()) { +// GWT.log("Browser was closed."); +// } +// else { +// GWT.log("Refreshing or returning from another page."); +// } + +// Window.addCloseHandler(new CloseHandler() { +// +// public void onClose(CloseEvent windowCloseEvent) { +// +// Window.alert("I'm closing"); +// } +// }); + + Window.addWindowClosingHandler(new Window.ClosingHandler() { + + @Override + public void onWindowClosing(ClosingEvent closingEvent) { + eventManager.getEventBus().fireEvent(new NotifyLogoutEvent()); + } + }); + GCubeCkanDataCatalogPanel panel = new GCubeCkanDataCatalogPanel(RootPanel.get(DIV_PORTLET_ID), eventManager.getEventBus()); eventManager.setPanel(panel); } diff --git a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/GcubeCkanDataCatalogService.java b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/GcubeCkanDataCatalogService.java index 4de205f..4a4d618 100644 --- a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/GcubeCkanDataCatalogService.java +++ b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/GcubeCkanDataCatalogService.java @@ -1,5 +1,6 @@ package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client; +import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared.CkanConnectorAccessPoint; import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared.CkanRole; import com.google.gwt.user.client.rpc.RemoteService; @@ -15,10 +16,12 @@ import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; public interface GcubeCkanDataCatalogService extends RemoteService { - String getCKanConnector( + CkanConnectorAccessPoint getCKanConnector( String pathInfoParameters, String queryStringParameters) throws Exception; CkanRole getMyRole() throws Exception; String getUser(); + + void logoutFromCkan(); } diff --git a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/GcubeCkanDataCatalogServiceAsync.java b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/GcubeCkanDataCatalogServiceAsync.java index e955a4e..5a4ad20 100644 --- a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/GcubeCkanDataCatalogServiceAsync.java +++ b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/GcubeCkanDataCatalogServiceAsync.java @@ -3,6 +3,7 @@ */ package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client; +import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared.CkanConnectorAccessPoint; import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared.CkanRole; import com.google.gwt.user.client.rpc.AsyncCallback; @@ -24,5 +25,12 @@ public interface GcubeCkanDataCatalogServiceAsync { void getCKanConnector( String pathInfoParameters, String queryStringParameters, - AsyncCallback callback); + AsyncCallback callback); + + + /** + * + */ + void logoutFromCkan(AsyncCallback callback); + } diff --git a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/event/IFrameInstanciedEvent.java b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/event/IFrameInstanciedEvent.java new file mode 100644 index 0000000..332b54f --- /dev/null +++ b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/event/IFrameInstanciedEvent.java @@ -0,0 +1,39 @@ +package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event; + +import com.google.gwt.event.shared.GwtEvent; + + + +/** + * The Class NotifyLogoutEvent. + * + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * Jun 23, 2016 + */ +public class IFrameInstanciedEvent extends GwtEvent { + public static Type TYPE = new Type(); + + + /** + * Instantiates a new insert metadata event. + */ + public IFrameInstanciedEvent() { + } + + /* (non-Javadoc) + * @see com.google.gwt.event.shared.GwtEvent#getAssociatedType() + */ + @Override + public Type getAssociatedType() { + return TYPE; + } + + /* (non-Javadoc) + * @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler) + */ + @Override + protected void dispatch(IFrameInstanciedEventHandler handler) { + handler.onNewInstance(this); + } + +} diff --git a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/event/IFrameInstanciedEventHandler.java b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/event/IFrameInstanciedEventHandler.java new file mode 100644 index 0000000..1ffb1c8 --- /dev/null +++ b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/event/IFrameInstanciedEventHandler.java @@ -0,0 +1,23 @@ +package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event; + +import com.google.gwt.event.shared.EventHandler; + + + +/** + * The Interface IFrameInstanciedEentHandler. + * + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * Jun 23, 2016 + */ +public interface IFrameInstanciedEventHandler extends EventHandler { + + + /** + * On new instance. + * + * @param iFrameInstanciedEent the i frame instancied eent + */ + void onNewInstance(IFrameInstanciedEvent iFrameInstanciedEent); + +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/event/NotifyLogoutEvent.java b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/event/NotifyLogoutEvent.java new file mode 100644 index 0000000..cd652a7 --- /dev/null +++ b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/event/NotifyLogoutEvent.java @@ -0,0 +1,39 @@ +package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event; + +import com.google.gwt.event.shared.GwtEvent; + + + +/** + * The Class NotifyLogoutEvent. + * + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * Jun 23, 2016 + */ +public class NotifyLogoutEvent extends GwtEvent { + public static Type TYPE = new Type(); + + + /** + * Instantiates a new insert metadata event. + */ + public NotifyLogoutEvent() { + } + + /* (non-Javadoc) + * @see com.google.gwt.event.shared.GwtEvent#getAssociatedType() + */ + @Override + public Type getAssociatedType() { + return TYPE; + } + + /* (non-Javadoc) + * @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler) + */ + @Override + protected void dispatch(NotifyLogoutEventHandler handler) { + handler.onLogout(this); + } + +} diff --git a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/event/NotifyLogoutEventHandler.java b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/event/NotifyLogoutEventHandler.java new file mode 100644 index 0000000..d0ae1d3 --- /dev/null +++ b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/event/NotifyLogoutEventHandler.java @@ -0,0 +1,22 @@ +package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event; + +import com.google.gwt.event.shared.EventHandler; + + +/** + * The Interface NotifyLogoutEventHandler. + * + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * Jun 23, 2016 + */ +public interface NotifyLogoutEventHandler extends EventHandler { + + + /** + * On logout. + * + * @param editMetadataEvent the edit metadata event + */ + void onLogout(NotifyLogoutEvent editMetadataEvent); + +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/utility/BrowserCloseDetector.java b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/utility/BrowserCloseDetector.java new file mode 100644 index 0000000..7517746 --- /dev/null +++ b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/utility/BrowserCloseDetector.java @@ -0,0 +1,40 @@ +/** + * + */ + +package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.utility; + +/** + * + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * Jun 23, 2016 + */ +import com.google.gwt.user.client.Cookies; +import com.google.gwt.user.client.Window; + +public class BrowserCloseDetector { + + private static final String COOKIE = "ckan-browser-detector-closed"; + private static BrowserCloseDetector instance; + + private BrowserCloseDetector() { + + Window.addWindowClosingHandler(new Window.ClosingHandler() { + + public void onWindowClosing(Window.ClosingEvent closingEvent) { + Cookies.setCookie(COOKIE, ""); + } + }); + } + + public static BrowserCloseDetector get() { + + return instance == null + ? instance = new BrowserCloseDetector() : instance; + } + + public boolean wasClosed() { + + return Cookies.getCookie(COOKIE) == null; + } +} diff --git a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/view/CkanFramePanel.java b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/view/CkanFramePanel.java index bbb8308..8fb90bd 100644 --- a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/view/CkanFramePanel.java +++ b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/view/CkanFramePanel.java @@ -3,10 +3,13 @@ */ package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.view; +import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.IFrameInstanciedEvent; + import com.google.gwt.core.shared.GWT; 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.event.shared.HandlerManager; import com.google.gwt.user.client.ui.FlowPanel; import com.google.gwt.user.client.ui.Frame; @@ -20,14 +23,24 @@ import com.google.gwt.user.client.ui.Frame; public class CkanFramePanel extends FlowPanel{ private Frame frame; + private HandlerManager eventBus; + /** * Instantiates a new ckan frame panel. + * + * @param eventBus the event bus */ - public CkanFramePanel() { + public CkanFramePanel(HandlerManager eventBus) { + this.eventBus = eventBus; } + /** + * Prints the. + * + * @param msg the msg + */ private static native void print(String msg)/*-{ console.log(msg); }-*/; @@ -39,7 +52,7 @@ public class CkanFramePanel extends FlowPanel{ * @return the frame */ public Frame instanceFrame(String ckanUrlConnector) { - + GWT.log("Instancing new IFRAME with uri: "+ckanUrlConnector); try{ if(frame != null) remove(frame); @@ -65,13 +78,18 @@ public class CkanFramePanel extends FlowPanel{ } }else GWT.log("List Header by tag name is null");*/ + } }); add(frame); + eventBus.fireEvent(new IFrameInstanciedEvent()); return frame; } + /** - * @return + * Gets the frame. + * + * @return the frame */ public Frame getFrame() { return frame; diff --git a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/view/GCubeCkanDataCatalogPanel.java b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/view/GCubeCkanDataCatalogPanel.java index 8a9d4cd..6705b22 100644 --- a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/view/GCubeCkanDataCatalogPanel.java +++ b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/view/GCubeCkanDataCatalogPanel.java @@ -5,6 +5,7 @@ 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.CkanConnectorAccessPoint; import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared.CkanRole; import com.google.gwt.core.shared.GWT; @@ -30,11 +31,12 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate{ private CkanMetadataManagementPanel managementPanel; private ScrollPanel centerScrollable = new ScrollPanel(); - private CkanFramePanel ckanFramePanel = new CkanFramePanel(); + private CkanFramePanel ckanFramePanel; private Image loading = new Image(CkanPortletResources.ICONS.loading()); private RootPanel rootPanel; private HandlerManager eventBus; private String baseURLCKANConnector; + private String gCubeTokeValue; /** * Instantiates a new g cube ckan data catalog panel. @@ -45,20 +47,21 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate{ public GCubeCkanDataCatalogPanel(RootPanel rootPanel, HandlerManager eventManager){ this.rootPanel = rootPanel; this.eventBus = eventManager; + ckanFramePanel = new CkanFramePanel(eventBus); managementPanel = new CkanMetadataManagementPanel(eventBus); initPanel(); String pathParameter = Window.Location.getParameter(GCubeCkanDataCatalog.GET_PATH_PARAMETER); String queryParameter = Window.Location.getParameter(GCubeCkanDataCatalog.GET_QUERY_PARAMETER); - GCubeCkanDataCatalog.service.getCKanConnector(pathParameter, queryParameter, new AsyncCallback() { + GCubeCkanDataCatalog.service.getCKanConnector(pathParameter, queryParameter, new AsyncCallback() { @Override - public void onSuccess(String ckanUrlConnector) { - GWT.log("Instancing CKAN iframe with url: "+ckanUrlConnector); - baseURLCKANConnector = ckanUrlConnector; - instanceCkanFrame(baseURLCKANConnector); + public void onSuccess(CkanConnectorAccessPoint ckan) { +// GWT.log("Instancing CKAN iframe with url: "+uriToCkan); + baseURLCKANConnector = ckan.getBaseUrl(); + gCubeTokeValue = ckan.getGcubeTokenValue(); + instanceCkanFrame(ckan.buildURI()); GCubeCkanDataCatalogPanel.this.rootPanel.remove(loading); - updateSize(); } @Override @@ -141,7 +144,9 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate{ } /** - * show or hide edit/insert buttons according to the role + * show or hide edit/insert buttons according to the role. + * + * @param show the show */ public void showEditInsertButtons(boolean show){ managementPanel.showInsertAndEditProductButtons(show); @@ -189,10 +194,22 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate{ } /** + * Gets the base urlckan connector. + * * @return the baseURLCKANConnector */ public String getBaseURLCKANConnector() { return baseURLCKANConnector; } - + + + /** + * Gets the gcube token value to ckan connector. + * + * @return the gcube token value to ckan connector + */ + public String getGcubeTokenValueToCKANConnector() { + return gCubeTokeValue; + } + } diff --git a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/server/GcubeCkanDataCatalogServiceImpl.java b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/server/GcubeCkanDataCatalogServiceImpl.java index d19d84e..0608e41 100644 --- a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/server/GcubeCkanDataCatalogServiceImpl.java +++ b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/server/GcubeCkanDataCatalogServiceImpl.java @@ -16,6 +16,7 @@ import org.gcube.datacatalogue.ckanutillibrary.models.CkanRolesIntoLiferay; import org.gcube.datacatalogue.ckanutillibrary.models.RolesIntoOrganization; import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper; import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.GcubeCkanDataCatalogService; +import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared.CkanConnectorAccessPoint; import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared.CkanRole; import org.gcube.vomanagement.usermanagement.GroupManager; import org.gcube.vomanagement.usermanagement.RoleManager; @@ -37,14 +38,13 @@ import com.google.gwt.user.server.rpc.RemoteServiceServlet; @SuppressWarnings("serial") public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implements GcubeCkanDataCatalogService { - private static final String LIST_OF_VRES_PARAMETER = "listOfVres"; private static final String PORT_HTTP = ":80"; private static final String PORT_HTTPS = ":443"; - private static final String GCUBE_TOKEN_PARAMETER = "gcube-token"; private static final String HTTPS = "https"; private static final String HTTP = "http"; public static String CKANCONNECTORCONTEXT = "CkanConnectorContext"; - public static String CKANHIDEHEADER = "CkanHideHeader"; +// public static String CKANHIDEHEADER = "CkanHideHeader"; + public static String CKANCONNECTORLOGOUT = "CkanConnectorLogout"; public static final String USERNAME_ATTRIBUTE = ScopeHelper.USERNAME_ATTRIBUTE; private static Logger logger = LoggerFactory.getLogger(GcubeCkanDataCatalogServiceImpl.class); private final static String DEFAULT_ROLE = "OrganizationMember"; @@ -80,8 +80,8 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem * @see org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.GcubeCkanDataCatalogService#getCKanConnector(java.lang.String, java.lang.String) */ @Override - public String getCKanConnector(String pathInfoParameters, String queryStringParameters) throws Exception { - logger.info("getCKanConnector [pathInfo: "+pathInfoParameters + ", query: "+queryStringParameters+"]"); + public CkanConnectorAccessPoint getCKanConnector(String pathInfoParameter, String queryStringParameters) throws Exception { + logger.info("getCKanConnector [pathInfo: "+pathInfoParameter + ", query: "+queryStringParameters+"]"); try{ if(queryStringParameters!=null && Base64.isBase64(queryStringParameters.getBytes())){ @@ -102,10 +102,9 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem ckanConnectorUri+=ckanContext; logger.debug("CKanConnector URI + Context: "+ckanConnectorUri); logger.debug("adding parameters..."); - String fullPath = getCkanConnectorParameters(pathInfoParameters, queryStringParameters); - ckanConnectorUri = ckanConnectorUri+fullPath; - logger.info("returning ckanConnectorUri: "+ckanConnectorUri); - return ckanConnectorUri; + CkanConnectorAccessPoint ckAP = getCkanConnectorAccessPoint(ckanConnectorUri, pathInfoParameter, queryStringParameters); + logger.info("returning ckanConnectorUri: "+ckAP); + return ckAP; // return "http://ckan-d-d4s.d4science.org"; }catch(Exception e ){ String message = "Sorry an error occurred during contacting gCube Ckan Data Catalogue"; @@ -118,55 +117,82 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem /** * Gets the ckan connector parameters. * - * @param pathInfoParameters the path info parameters + * @param ckanConnectorBaseUrl the ckan connector base url + * @param pathInfoParameter the path info parameters * @param queryStringParameters the query string parameters * @return the ckan connector parameters */ - private String getCkanConnectorParameters(String pathInfoParameters, String queryStringParameters) { + private CkanConnectorAccessPoint getCkanConnectorAccessPoint(String ckanConnectorBaseUrl, String pathInfoParameter, String queryStringParameters) { - String ckanHideHeader = getServletContext().getInitParameter(CKANHIDEHEADER); - logger.debug(CKANHIDEHEADER + " is: "+ckanHideHeader); +// String ckanHideHeader = getServletContext().getInitParameter(CKANHIDEHEADER); +// logger.debug(CKANHIDEHEADER + " is: "+ckanHideHeader); - String pathInfo = ""; - if(pathInfoParameters!=null && !pathInfoParameters.isEmpty()){ - pathInfo=pathInfoParameters.startsWith("/")?pathInfoParameters:"/"+pathInfoParameters; - } + CkanConnectorAccessPoint ckan = new CkanConnectorAccessPoint(ckanConnectorBaseUrl); - String queryString =""; - if(queryStringParameters!=null && !queryStringParameters.isEmpty()){ - queryString = "?"+queryStringParameters; - } +// +// String pathInfo = ""; +// if(pathInfoParameter!=null && !pathInfoParameter.isEmpty()){ +// pathInfo=pathInfoParameter.startsWith("/")?pathInfoParameter:"/"+pathInfoParameter; +// } - String gcubeTokenParameter = null; + ckan.addPathInfo(pathInfoParameter); + ckan.addQueryString(queryStringParameters); + +// String queryString =""; +// if(queryStringParameters!=null && !queryStringParameters.isEmpty()){ +// queryString = "?"+queryStringParameters; +// } + +// String gcubeTokenParameter = null; +// if(SessionUtil.isIntoPortal()){ +// gcubeTokenParameter = GCUBE_TOKEN_PARAMETER+"="+getGcubeSecurityToken(); +// }else{ +// logger.warn("******** Using TEST_USER security token!!!"); +// gcubeTokenParameter = GCUBE_TOKEN_PARAMETER+"="+TEST_SEC_TOKEN; +// } + + + String gcubeTokenValue = null; if(SessionUtil.isIntoPortal()){ - gcubeTokenParameter = GCUBE_TOKEN_PARAMETER+"="+getGcubeSecurityToken(); + gcubeTokenValue = getGcubeSecurityToken(); }else{ logger.warn("******** Using TEST_USER security token!!!"); - gcubeTokenParameter = GCUBE_TOKEN_PARAMETER+"="+TEST_SEC_TOKEN; + gcubeTokenValue = TEST_SEC_TOKEN; } - //ADDING CKAN HH (HIDE HEADER PARAMETER) - queryString = queryString.isEmpty()?"?"+ckanHideHeader:"&"+ckanHideHeader; - //ADDING GCUBE TOKEN PARAMETER - queryString+="&"+gcubeTokenParameter; + ckan.addGubeToken(gcubeTokenValue); +// ckan.addGenericParameter(ckanHideHeader, "true"); + +// //ADDING CKAN HH (HIDE HEADER PARAMETER) +// queryString = queryString.isEmpty()?"?"+ckanHideHeader:"&"+ckanHideHeader; +// //ADDING GCUBE TOKEN PARAMETER +// queryString+="&"+gcubeTokenParameter; //ADDING LIST OF VRE TO WHICH USER BELONGS + if(!SessionUtil.isIntoPortal()){ + return ckan; + } + ASLSession session = getASLSession(this.getThreadLocalRequest().getSession()); List listVres = UserUtil.getListVreForUser(session.getUserEmailAddress()); - String vres = ""; - if(listVres!=null && listVres.size()>0){ - for (String vre : listVres) { - vres+=vre+","; - } - vres = vres.substring(0, vres.length()-1).toLowerCase(); //remove last "," and to lower case. A CKAN Organization ID must be lower case - } +// String vres = ""; +// if(listVres!=null && listVres.size()>0){ +// for (String vre : listVres) { +// vres+=vre+","; +// } +// vres = vres.substring(0, vres.length()-1).toLowerCase(); //remove last "," and to lower case. A CKAN Organization ID must be lower case +// } - logger.debug("List of VREs contains: " +vres); - if(vres.length()>0){ - queryString+="&"+LIST_OF_VRES_PARAMETER+"="+vres; - } +// logger.debug("List of VREs contains: " +vres); +// if(vres.length()>0){ +// queryString+="&"+LIST_OF_VRES_PARAMETER+"="+vres; +// } - return pathInfo+queryString; + +// ckan.addGubeToken(gcubeTokenParameter); + ckan.addListOfVREs(listVres); + + return ckan; } /** @@ -316,7 +342,7 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem switch(mainRole){ case CkanRolesIntoLiferay.CATALOG_ADMIN: return CkanRole.ADMIN; case CkanRolesIntoLiferay.CATALOG_EDITOR: return CkanRole.EDITOR; - case CkanRolesIntoLiferay.CATALOG_MEMBER: ; + case CkanRolesIntoLiferay.CATALOG_MEMBER: return CkanRole.MEMBER; default : return CkanRole.MEMBER; } } @@ -360,4 +386,21 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem return token; } + + + /* (non-Javadoc) + * @see org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.GcubeCkanDataCatalogService#logoutFromCkan() + */ + @Override + public void logoutFromCkan() { + HttpSession httpSession = this.getThreadLocalRequest().getSession(); + ASLSession session = getASLSession(httpSession); + String username = session.getUsername(); + logger.debug("Logout from CKAN for: "+username); + + String ckanConnectorLogut = getServletContext().getInitParameter(CKANCONNECTORLOGOUT); + logger.debug(CKANCONNECTORLOGOUT + " is: "+ckanConnectorLogut); + + + } } diff --git a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/shared/CkanConnectorAccessPoint.java b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/shared/CkanConnectorAccessPoint.java new file mode 100644 index 0000000..5f0492c --- /dev/null +++ b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/shared/CkanConnectorAccessPoint.java @@ -0,0 +1,201 @@ +/** + * + */ +package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared; + +import java.io.Serializable; +import java.util.List; + + +/** + * The Class CkanConnectorAccessPoint. + * + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * Jun 23, 2016 + */ +public class CkanConnectorAccessPoint implements Serializable{ + + /** + * + */ + private static final long serialVersionUID = 3771903616375335843L; + + private static final String LIST_OF_VRES_PARAMETER = "listOfVres"; + private static final String GCUBE_TOKEN_PARAMETER = "gcube-token"; + private String baseUrl; + private String pathInfoParameter; + private String queryStringParameters; + private String gcubeTokenValue; + private List listOfVRes; + + /** + * + */ + public CkanConnectorAccessPoint() { + } + + /** + * Instantiates a new ckan connector access point. + * + * @param baseUrl the base url + */ + public CkanConnectorAccessPoint(String baseUrl){ + this.baseUrl = baseUrl; + } + + /** + * Adds the generic parameter. + * + * @param key the key + * @param value the value + */ + public void addGenericParameter(String key, String value){ + queryStringParameters=queryStringParameters==null?key+"="+value:queryStringParameters+"&"+key+"="+value; + } + + + /** + * Adds the query string. + * + * @param queryString the query string + */ + public void addQueryString(String queryString){ + + if(queryString==null || queryString.isEmpty()) + return; + + if(queryString.startsWith("&")){ + queryString = queryString.substring(1, queryString.length()); //removes '&' + } + + queryStringParameters=queryStringParameters==null?queryString:queryStringParameters+"&"+queryString; + } + + /** + * Adds the gube token. + * + * @param value the value + */ + public void addGubeToken(String value){ + this.gcubeTokenValue = value; + addGenericParameter(GCUBE_TOKEN_PARAMETER, value); + } + + /** + * Adds the list of vr es. + * + * @param listVREs the list vr es + */ + public void addListOfVREs(List listVREs){ + this.listOfVRes = listVREs; + String vres = ""; + if(listVREs!=null && listVREs.size()>0){ + for (String vre : listVREs) { + vres+=vre+","; + } + vres = vres.substring(0, vres.length()-1).toLowerCase(); //remove last "," and to lower case. A CKAN Organization ID must be lower case + } + + if(vres.length()>0){ + addGenericParameter(LIST_OF_VRES_PARAMETER, vres); + } + } + + /** + * Adds the path info. + * + * @param pathInfo the path info + */ + public void addPathInfo(String pathInfo){ + pathInfoParameter = pathInfo; + } + + + /** + * Builds the uri to contact the CKAN Connector. + * + * @return the string + */ + public String buildURI(){ + + if(pathInfoParameter!=null && !pathInfoParameter.isEmpty()) + pathInfoParameter=pathInfoParameter.startsWith("/")?pathInfoParameter:"/"+pathInfoParameter; + else + pathInfoParameter=""; + + if(queryStringParameters==null) + queryStringParameters=""; + + return baseUrl+pathInfoParameter+"?"+queryStringParameters; + } + + + + + + /** + * @return the baseUrl + */ + public String getBaseUrl() { + + return baseUrl; + } + + + /** + * @return the pathInfoParameter + */ + public String getPathInfoParameter() { + + return pathInfoParameter; + } + + + /** + * @return the queryStringParameters + */ + public String getQueryStringParameters() { + + return queryStringParameters; + } + + + /** + * @return the gcubeTokenValue + */ + public String getGcubeTokenValue() { + + return gcubeTokenValue; + } + + + /** + * @return the listOfVRes + */ + public List getListOfVRes() { + + return listOfVRes; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + + StringBuilder builder = new StringBuilder(); + builder.append("CkanConnectorAccessPoint [baseUrl="); + builder.append(baseUrl); + builder.append(", pathInfoParameter="); + builder.append(pathInfoParameter); + builder.append(", queryStringParameters="); + builder.append(queryStringParameters); + builder.append(", gcubeTokenValue="); + builder.append(gcubeTokenValue); + builder.append(", listOfVRes="); + builder.append(listOfVRes); + builder.append("]"); + return builder.toString(); + } + +} diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml index 03b55cd..0e248a3 100644 --- a/src/main/webapp/WEB-INF/web.xml +++ b/src/main/webapp/WEB-INF/web.xml @@ -10,10 +10,16 @@ /gcube/service/connect + + + + + + - Used like GET parameter in order to hide header section of CKAN template from gCube Portal - CkanHideHeader - hh=true + ckan connector logout from CKAN + CkanConnectorLogout + /gcube/service/connect