From 646595671877cbf302b8a78f79d00286fee7e6fd Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Tue, 1 Oct 2019 15:42:23 +0000 Subject: [PATCH] ref 12594: Provide DM Users with runtime execution information https://support.d4science.org/issues/12594 Added service info[ticket #12594] Updated the resources check on IS [ticket #17569] git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/statistical-algorithms-importer@181896 82a268e6-3cf1-43bd-a215-b396298e98cf --- distro/changelog.xml | 4 +- .../client/StatAlgoImporterController.java | 65 ++++- .../dminfo/ServiceInfoDataProperties.java | 25 ++ .../client/dminfo/ServiceInfoDialog.java | 63 +++++ .../client/dminfo/ServiceInfoPanel.java | 230 ++++++++++++++++++ .../client/event/dminfo/ServiceInfoEvent.java | 63 +++++ .../event/dminfo/ServiceInfoRequestEvent.java | 56 +++++ .../resource/StatAlgoImporterResources.java | 7 + .../client/resource/service_profile_24.png | Bin 0 -> 1416 bytes .../client/resource/service_profile_32.png | Bin 0 -> 2196 bytes .../client/ribbon/HomeToolBar.java | 141 ++++++----- .../client/ribbon/HomeToolBarMessages.java | 6 + .../client/rpc/StatAlgoImporterService.java | 4 +- .../rpc/StatAlgoImporterServiceAsync.java | 3 +- .../type/StatAlgoImporterRibbonType.java | 1 + .../server/StatAlgoImporterServiceImpl.java | 23 ++ .../server/is/InformationSystemUtils.java | 71 ++++++ .../shared/Constants.java | 22 +- .../shared/dminfo/ServiceInfo.java | 49 ++++ .../shared/dminfo/ServiceInfoData.java | 58 +++++ .../client/resource/service_profile_24.png | Bin 0 -> 1416 bytes .../client/resource/service_profile_32.png | Bin 0 -> 2196 bytes 22 files changed, 802 insertions(+), 89 deletions(-) create mode 100644 src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/dminfo/ServiceInfoDataProperties.java create mode 100644 src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/dminfo/ServiceInfoDialog.java create mode 100644 src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/dminfo/ServiceInfoPanel.java create mode 100644 src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/event/dminfo/ServiceInfoEvent.java create mode 100644 src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/event/dminfo/ServiceInfoRequestEvent.java create mode 100644 src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/resource/service_profile_24.png create mode 100644 src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/resource/service_profile_32.png create mode 100644 src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/shared/dminfo/ServiceInfo.java create mode 100644 src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/shared/dminfo/ServiceInfoData.java create mode 100644 src/main/resources/org/gcube/portlets/user/statisticalalgorithmsimporter/client/resource/service_profile_24.png create mode 100644 src/main/resources/org/gcube/portlets/user/statisticalalgorithmsimporter/client/resource/service_profile_32.png diff --git a/distro/changelog.xml b/distro/changelog.xml index 6717c8c..b665789 100644 --- a/distro/changelog.xml +++ b/distro/changelog.xml @@ -1,5 +1,7 @@ - + + Added service info [ticket #12594] + Added Item Id support [ticket #16503] Updated the resources check on IS [ticket #17569] diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/StatAlgoImporterController.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/StatAlgoImporterController.java index 837aba6..46c0cbf 100644 --- a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/StatAlgoImporterController.java +++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/StatAlgoImporterController.java @@ -2,6 +2,7 @@ package org.gcube.portlets.user.statisticalalgorithmsimporter.client; import java.util.Date; +import org.gcube.portlets.user.statisticalalgorithmsimporter.client.dminfo.ServiceInfoDialog; import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.BinaryCodeSetEvent; import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.DeleteItemEvent; import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.InputReadyEvent; @@ -10,6 +11,8 @@ import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.MainCo import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.NewCodeEvent; import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.SessionExpiredEvent; import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.StatAlgoImporterRibbonEvent; +import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.dminfo.ServiceInfoEvent; +import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.dminfo.ServiceInfoRequestEvent; import org.gcube.portlets.user.statisticalalgorithmsimporter.client.monitor.StatAlgoImporterMonitor; import org.gcube.portlets.user.statisticalalgorithmsimporter.client.project.ProjectManager; import org.gcube.portlets.user.statisticalalgorithmsimporter.client.resource.StatAlgoImporterResources; @@ -20,6 +23,7 @@ import org.gcube.portlets.user.statisticalalgorithmsimporter.client.upload.CodeU import org.gcube.portlets.user.statisticalalgorithmsimporter.client.utils.BrowserWindowSupport; import org.gcube.portlets.user.statisticalalgorithmsimporter.client.utils.UtilsGXT3; import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.Constants; +import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.dminfo.ServiceInfo; import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.exception.StatAlgoImporterSessionExpiredException; import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.session.UserInfo; import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.workspace.ItemDescription; @@ -251,6 +255,16 @@ public class StatAlgoImporterController { }); + eventBus.addHandler(ServiceInfoRequestEvent.TYPE, new ServiceInfoRequestEvent.ServiceInfoRequestEventHandler() { + + @Override + public void onRequest(ServiceInfoRequestEvent event) { + Log.debug("Catch ServiceInfoRequestEvent: " + event); + retrieveServiceInfoRequestEvent(event); + + } + }); + } private void doMenuCommand(StatAlgoImporterRibbonEvent event) { @@ -282,6 +296,9 @@ public class StatAlgoImporterController { case SOFTWARE_REPACKAGE: softwareRepackage(); break; + case SERVICE_PROFILE: + showServiceProfile(); + break; case HELP: showHelp(); break; @@ -291,6 +308,8 @@ public class StatAlgoImporterController { } } + + private void showHelp() { try { @@ -382,7 +401,7 @@ public class StatAlgoImporterController { @Override public void onDialogHide(DialogHideEvent event) { - Log.debug("DialogHideEvent: "+event); + Log.debug("DialogHideEvent: " + event); switch (event.getHideButton()) { case NO: break; @@ -392,10 +411,9 @@ public class StatAlgoImporterController { default: break; } - + } - }); mb.setWidth(300); mb.show(); @@ -408,7 +426,7 @@ public class StatAlgoImporterController { Log.debug("SoftwareCreateRequest fire: " + inputRequestEvent); eventBus.fireEvent(inputRequestEvent); } - + private void softwareRepackage() { pm.softwareRepackage(); @@ -433,7 +451,7 @@ public class StatAlgoImporterController { } private void doMainCodeSetCommand(MainCodeSetEvent event) { - Log.debug("MainCodeSetEvent: "+event); + Log.debug("MainCodeSetEvent: " + event); ItemDescription mainCodeItemDesc = event.getItemDescription(); if (mainCodeItemDesc != null && mainCodeItemDesc.getId() != null) { mainCodeItemDescription = mainCodeItemDesc; @@ -447,7 +465,7 @@ public class StatAlgoImporterController { } private void doBinaryCodeSetCommand(BinaryCodeSetEvent event) { - Log.debug("BinaryCodeSetEvent: "+event); + Log.debug("BinaryCodeSetEvent: " + event); ItemDescription binaryCodeItemDesc = event.getItemDescription(); if (binaryCodeItemDesc != null && binaryCodeItemDesc.getId() != null) { binaryCodeItemDescription = binaryCodeItemDesc; @@ -460,7 +478,7 @@ public class StatAlgoImporterController { } private void doSetNewMainCodeEvent(NewCodeEvent event) { - Log.debug("NewCodeEvent "+event); + Log.debug("NewCodeEvent " + event); monitor = new StatAlgoImporterMonitor(); newCodeEvent = event; inputRequestType = InputRequestType.NewMainCodeSet; @@ -497,4 +515,37 @@ public class StatAlgoImporterController { } + private void showServiceProfile() { + ServiceInfoDialog serviceInfoDialog=new ServiceInfoDialog(eventBus); + serviceInfoDialog.show(); + } + + private void retrieveServiceInfoRequestEvent(final ServiceInfoRequestEvent event) { + StatAlgoImporterServiceAsync.INSTANCE.getServiceInfo(new AsyncCallback() { + + @Override + public void onFailure(Throwable caught) { + if (caught instanceof StatAlgoImporterSessionExpiredException) { + eventBus.fireEvent(new SessionExpiredEvent(SessionExpiredType.EXPIREDONSERVER)); + } else { + Log.error("Error retrieving DataMiner service info: " + caught.getLocalizedMessage(), caught); + UtilsGXT3.alert("Error", + "Error retrieving DataMiner service info: " + caught.getLocalizedMessage()); + } + caught.printStackTrace(); + } + + @Override + public void onSuccess(ServiceInfo serviceInfo) { + Log.debug("DataMiner Service Info: " + serviceInfo); + + ServiceInfoEvent serviceInfoEvent = new ServiceInfoEvent(serviceInfo); + eventBus.fireEvent(serviceInfoEvent); + + } + + }); + + } + } diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/dminfo/ServiceInfoDataProperties.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/dminfo/ServiceInfoDataProperties.java new file mode 100644 index 0000000..6130575 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/dminfo/ServiceInfoDataProperties.java @@ -0,0 +1,25 @@ +package org.gcube.portlets.user.statisticalalgorithmsimporter.client.dminfo; + + +import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.dminfo.ServiceInfoData; + +import com.google.gwt.editor.client.Editor.Path; +import com.sencha.gxt.core.client.ValueProvider; +import com.sencha.gxt.data.shared.ModelKeyProvider; +import com.sencha.gxt.data.shared.PropertyAccess; + +/** + * + * @author Giancarlo Panichi + * + * + */ +public interface ServiceInfoDataProperties extends PropertyAccess { + @Path("key") + ModelKeyProvider id(); + + ValueProvider key(); + ValueProvider value(); + ValueProvider category(); +} + diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/dminfo/ServiceInfoDialog.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/dminfo/ServiceInfoDialog.java new file mode 100644 index 0000000..e23b99d --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/dminfo/ServiceInfoDialog.java @@ -0,0 +1,63 @@ +package org.gcube.portlets.user.statisticalalgorithmsimporter.client.dminfo; + +import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.Constants; + +import com.google.gwt.event.logical.shared.ResizeEvent; +import com.google.gwt.event.logical.shared.ResizeHandler; +import com.google.gwt.event.shared.EventBus; +import com.sencha.gxt.widget.core.client.Dialog; +import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack; +import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer; +import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData; + +/** + * + * Simple file show dialog + * + * @author Giancarlo Panichi + * + * + */ +public class ServiceInfoDialog extends Dialog { + private EventBus eventBus; + private ServiceInfoPanel serviceInfoPanel; + + public ServiceInfoDialog(EventBus eventBus) { + super(); + this.eventBus=eventBus; + init(); + create(); + } + + private void init() { + setWidth("640px"); + setHeight("480px"); + setResizable(true); + setHeadingText(Constants.DATA_MINER_SERVICE_INFO_TITLE); + setModal(true); + setMaximizable(true); + setPredefinedButtons(PredefinedButton.CLOSE); + setButtonAlign(BoxLayoutPack.CENTER); + } + + private void create() { + VerticalLayoutContainer vc = new VerticalLayoutContainer(); + vc.addResizeHandler(new ResizeHandler() { + + @Override + public void onResize(ResizeEvent event) { + manageResize(event); + } + }); + serviceInfoPanel=new ServiceInfoPanel(eventBus); + vc.add(serviceInfoPanel, new VerticalLayoutData(-1,-1)); + add(vc); + } + + private void manageResize(ResizeEvent event){ + serviceInfoPanel.setHeight(String.valueOf(event.getHeight())+"px"); + serviceInfoPanel.setWidth(String.valueOf(event.getWidth())+"px"); + forceLayout(); + } + +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/dminfo/ServiceInfoPanel.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/dminfo/ServiceInfoPanel.java new file mode 100644 index 0000000..8ad8672 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/dminfo/ServiceInfoPanel.java @@ -0,0 +1,230 @@ +package org.gcube.portlets.user.statisticalalgorithmsimporter.client.dminfo; + +import java.util.ArrayList; +import java.util.List; + +import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.dminfo.ServiceInfoEvent; +import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.dminfo.ServiceInfoRequestEvent; +import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.Constants; +import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.dminfo.ServiceInfo; +import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.dminfo.ServiceInfoData; + +import com.allen_sauer.gwt.log.client.Log; +import com.google.gwt.core.client.GWT; +import com.google.gwt.dom.client.Style.Unit; +import com.google.gwt.event.shared.EventBus; +import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode; +import com.sencha.gxt.core.client.util.Margins; +import com.sencha.gxt.data.shared.ListStore; +import com.sencha.gxt.widget.core.client.FramedPanel; +import com.sencha.gxt.widget.core.client.container.HtmlLayoutContainer; +import com.sencha.gxt.widget.core.client.container.MarginData; +import com.sencha.gxt.widget.core.client.container.SimpleContainer; +import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer; +import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData; +import com.sencha.gxt.widget.core.client.form.FieldSet; +import com.sencha.gxt.widget.core.client.grid.ColumnConfig; +import com.sencha.gxt.widget.core.client.grid.ColumnModel; +import com.sencha.gxt.widget.core.client.grid.Grid; +import com.sencha.gxt.widget.core.client.grid.GroupingView; + +/** + * + * @author Giancarlo Panichi + * + * + */ +public class ServiceInfoPanel extends FramedPanel { + + + + private static final ServiceInfoDataProperties props = GWT.create(ServiceInfoDataProperties.class); + private VerticalLayoutContainer v; + private VerticalLayoutContainer environmentVBox; + private EventBus eventBus; + + public ServiceInfoPanel(EventBus eventBus) { + super(); + this.eventBus = eventBus; + Log.debug("ServiceInfoPanel"); + init(); + create(); + bind(); + eventBus.fireEvent(new ServiceInfoRequestEvent()); + + } + + private void init() { + setItemId("ServiceInfoPanel"); + forceLayoutOnResize = true; + setBodyBorder(false); + setBorders(false); + setBodyStyle("backgroundColor:white;"); + setHeaderVisible(false); + setResize(true); + setHeadingText(Constants.DATA_MINER_SERVICE_INFO_TITLE); + setBodyStyle("backgroundColor:white;"); + + } + + private void create() { + try { + v = new VerticalLayoutContainer(); + v.setScrollMode(ScrollMode.AUTO); + add(v); + createView(); + forceLayout(); + } catch (Throwable e) { + Log.error("Error creating ServiceInfoPanel: " + e.getLocalizedMessage(), e); + } + } + + private void bind() { + + eventBus.addHandler(ServiceInfoEvent.TYPE, new ServiceInfoEvent.ServiceInfoEventHandler() { + + @Override + public void onRequest(ServiceInfoEvent event) { + Log.debug("Catch ServiceInfoEvent"); + showServiceInfo(event.getServiceInfo()); + + } + + }); + + } + + private void createView() { + + SimpleContainer sectionTitle = new SimpleContainer(); + SimpleContainer sectionSubTitle = new SimpleContainer(); + + // title + HtmlLayoutContainer title = new HtmlLayoutContainer( + "
" + Constants.DATA_MINER_SERVICE_INFO_TITLE + "
"); + sectionTitle.add(title, new MarginData()); + sectionTitle.getElement().getStyle().setMarginRight(20, Unit.PX); + v.add(sectionTitle, new VerticalLayoutData(-1, -1, new Margins(10))); + + // subtitle + HtmlLayoutContainer subtitle = new HtmlLayoutContainer( + "

This page reports information on the DataMiner " + + "service instance serving this working environment giving an up to date " + + "picture of its capacities and capabilities.

"); + sectionSubTitle.add(subtitle, new MarginData()); + sectionSubTitle.getElement().getStyle().setMarginRight(20, Unit.PX); + v.add(sectionSubTitle, new VerticalLayoutData(-1, -1, new Margins(10))); + + } + + private FieldSet environmentView() { + try { + environmentVBox = new VerticalLayoutContainer(); + + FieldSet configurationFieldSet = new FieldSet(); + configurationFieldSet.setHeadingText(Constants.DATA_MINER_RUNTIME_FEATURE); + configurationFieldSet.setCollapsible(true); + configurationFieldSet.add(environmentVBox); + configurationFieldSet.getElement().getStyle().setMarginRight(20, Unit.PX); + return configurationFieldSet; + } catch (Throwable e) { + Log.error("Error in ServiceInfoPanel in environment: " + e.getLocalizedMessage(), e); + throw e; + } + } + + private void showAddress(String address) { + // Service address + SimpleContainer sectionServerAddress = new SimpleContainer(); + + HtmlLayoutContainer addressHtml = new HtmlLayoutContainer( + "

The base url of the service instance is: " + "" + + address + "

"); + sectionServerAddress.add(addressHtml, new MarginData()); + sectionServerAddress.getElement().getStyle().setMarginRight(20, Unit.PX); + v.add(sectionServerAddress, new VerticalLayoutData(-1, -1, new Margins(10))); + + } + + private void showServiceInfo(ServiceInfo serviceInfo) { + + if (serviceInfo != null) { + + String address = serviceInfo.getServiceAddress(); + if (address != null && !address.isEmpty()) { + showAddress(address); + } + + FieldSet environmentFieldSet = environmentView(); + v.add(environmentFieldSet, new VerticalLayoutData(-1, -1, new Margins(10))); + + ArrayList properties = serviceInfo.getServiceProperties(); + if (properties != null && !properties.isEmpty()) { + Grid grid = createInfoGrid(properties); + environmentVBox.add(grid, new VerticalLayoutData(1, -1, new Margins(0, 4, 0, 4))); + } else { + HtmlLayoutContainer emptyInfoContainer = new HtmlLayoutContainer( + "

No Info Available.

"); + + environmentVBox.add(emptyInfoContainer, new VerticalLayoutData(1, -1, new Margins(0, 4, 0, 4))); + } + } else { + FieldSet environmentFieldSet = environmentView(); + v.add(environmentFieldSet, new VerticalLayoutData(-1, -1, new Margins(10))); + + HtmlLayoutContainer emptyInfoContainer = new HtmlLayoutContainer( + "

No Info Available.

"); + + environmentVBox.add(emptyInfoContainer, new VerticalLayoutData(1, -1, new Margins(0, 4, 0, 4))); + } + + forceLayout(); + + } + + private Grid createInfoGrid(ArrayList properties) { + + ColumnConfig keyCol = new ColumnConfig(props.key(), 100, + "Key"); + ColumnConfig valueCol = new ColumnConfig(props.value(), 100, + "Value"); + ColumnConfig categoryCol = new ColumnConfig(props.category(), + 100, "Category"); + + List> columns = new ArrayList>(); + columns.add(keyCol); + columns.add(valueCol); + columns.add(categoryCol); + + ColumnModel cm = new ColumnModel(columns); + + ListStore store = new ListStore(props.id()); + store.addAll(properties); + + final GroupingView groupingView = new GroupingView(); + groupingView.setShowGroupedColumn(false); + groupingView.groupBy(categoryCol); + groupingView.setForceFit(true); + groupingView.setAutoExpandColumn(valueCol); + groupingView.setEmptyText("No info retrieved"); + + // grid.getView().setAutoFill(true); + // groupingView.setStripeRows(true); + // groupingView.setColumnLines(true); + + Grid grid = new Grid(store, cm, groupingView); + + grid.setAllowTextSelection(false); + grid.setAllowTextSelection(true); + grid.setBorders(false); + grid.setColumnReordering(false); + + // Stage manager, turn on state management + grid.setStateful(true); + grid.setStateId("gridServiceInfoData"); + + return grid; + + } + +} diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/event/dminfo/ServiceInfoEvent.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/event/dminfo/ServiceInfoEvent.java new file mode 100644 index 0000000..bd618c6 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/event/dminfo/ServiceInfoEvent.java @@ -0,0 +1,63 @@ +package org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.dminfo; + + +import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.dminfo.ServiceInfo; + +import com.google.gwt.event.shared.EventHandler; +import com.google.gwt.event.shared.GwtEvent; +import com.google.gwt.event.shared.HandlerRegistration; +import com.google.gwt.event.shared.HasHandlers; + +/** + * Service Info Event + * + * + * @author Giancarlo Panichi + * + * + */ +public class ServiceInfoEvent extends GwtEvent { + + public static Type TYPE = new Type(); + private ServiceInfo serviceInfo; + + public interface ServiceInfoEventHandler extends EventHandler { + void onRequest(ServiceInfoEvent event); + } + + public interface HasServiceInfoEventHandler extends HasHandlers { + public HandlerRegistration addServiceInfoEventHandler(ServiceInfoEventHandler handler); + } + + public ServiceInfoEvent(ServiceInfo serviceInfo) { + this.serviceInfo = serviceInfo; + } + + @Override + protected void dispatch(ServiceInfoEventHandler handler) { + handler.onRequest(this); + } + + @Override + public Type getAssociatedType() { + return TYPE; + } + + public static Type getType() { + return TYPE; + } + + public static void fire(HasHandlers source, ServiceInfoEvent event) { + source.fireEvent(event); + } + + public ServiceInfo getServiceInfo() { + return serviceInfo; + } + + @Override + public String toString() { + return "ServiceInfoEvent [serviceInfo=" + serviceInfo + "]"; + } + +} diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/event/dminfo/ServiceInfoRequestEvent.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/event/dminfo/ServiceInfoRequestEvent.java new file mode 100644 index 0000000..7d2e516 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/event/dminfo/ServiceInfoRequestEvent.java @@ -0,0 +1,56 @@ +package org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.dminfo; + +import com.google.gwt.event.shared.EventHandler; +import com.google.gwt.event.shared.GwtEvent; +import com.google.gwt.event.shared.HandlerRegistration; +import com.google.gwt.event.shared.HasHandlers; + +/** + * Service Info Request Event + * + * + * @author Giancarlo Panichi + * + * + */ +public class ServiceInfoRequestEvent extends GwtEvent { + + public static Type TYPE = new Type(); + + public interface ServiceInfoRequestEventHandler extends EventHandler { + void onRequest(ServiceInfoRequestEvent event); + } + + public interface HasServiceInfoRequestEventHandler extends HasHandlers { + public HandlerRegistration addServiceInfoRequestEventHandler(ServiceInfoRequestEventHandler handler); + } + + public ServiceInfoRequestEvent() { + + } + + @Override + protected void dispatch(ServiceInfoRequestEventHandler handler) { + handler.onRequest(this); + } + + @Override + public Type getAssociatedType() { + return TYPE; + } + + public static Type getType() { + return TYPE; + } + + public static void fire(HasHandlers source, ServiceInfoRequestEvent event) { + source.fireEvent(event); + } + + @Override + public String toString() { + return "ServiceInfoRequestEvent []"; + } + + +} diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/resource/StatAlgoImporterResources.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/resource/StatAlgoImporterResources.java index 5c753d9..4223794 100644 --- a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/resource/StatAlgoImporterResources.java +++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/resource/StatAlgoImporterResources.java @@ -34,6 +34,13 @@ public interface StatAlgoImporterResources extends ClientBundle { @Source("help_24.png") ImageResource help24(); + @Source("service_profile_32.png") + ImageResource serviceProfile32(); + + @Source("service_profile_24.png") + ImageResource serviceProfile24(); + + @Source("download_32.png") ImageResource download32(); diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/resource/service_profile_24.png b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/resource/service_profile_24.png new file mode 100644 index 0000000000000000000000000000000000000000..29442d9d2c2bc6dc7394601f3702403cbb65f24b GIT binary patch literal 1416 zcmV;31$X+1P)(&4O1rxyoC{rDy@FR1R4PIj#)aQPM1m25wW$V7n^Sv|)0{lBX(Z#+JKksYe(?U^ z=i~pp{}-A}M4HEzh$KbifQUSmKikvgy`+d(D`9-oMC6BWfPTxKipURt1&W9mBJ!Jv zEPjpPIF5{ukIVS@xHyip(j|+_XN~446cIsD6hy=TP6Pk^`f}U085$bGbzJ}q!{FSx za|DCIm3;jLIIAd%DPEM|vh-Hjl0lr`_ z=X`OcxNX~({{DVRr_-{qupkQy3zAN!rN6&lY}@`;O%@w9(Uuu70+_X0jfW2(a_Q0~ za=9EEHf*4+tqsev&~^QbN4l>9I#Pd9^T)Bc_7}RPt)~s0rK)GB-(==Sy<;amEsH%$NI9$7S zjgu!&vVHsZM#{EpKzoBl)6>%=5(#>GdeC*9xw$!(mX?S{qr80ilGUqM128{7PghqL z*=&~1&Q2`LVrglKw{PDvJv~h_nQTPct^q#*)a!NDty{F(|Z;L)Q;+`oUHmX;Rk^*W(Yh*GJ<>({SICX>|bbyQUa_(=n{H7XvBMp0Fj zb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~9%d+U{=|NEx zbX}*ivXb)ha!N`{$jQk;Q51lGNRo6=O_t9=A;d3=qAc_Id=wTIqU$;BT3u%z+Ult3LP z$?gat0+wYlIy#DJn#AMrl+60@;REN-pQodvgXZSuR6@zJ%=-1~si>%+s;VjlObCI? z=TyrZ#daMAI}PkqEbM-)8^* z{cPX99e|@pk0OLfae~k1`;2lO0!xb0Lyqy!0Hhs75AZKZlH_E#QtX(SnMqMm5o_13 zrLnP*zP`Rs(&o`4YHDgIDk>r~GZUA~HIX9zyCg~H(tCry)R-g^3Esbd&%nR{ckkY% zt*s4!rAwDmR#wKONt4LR%KDNlpRh5JzSN*3K@0;HPYA5O5zI_XT-|xro_mh>C zl}fs_(F)WgkN8`%{rj3z%d&)Nnj#vFifA+{Ow%0SBmQ`E`d8ZXL?R&)iNycap8ppt WYzsVBk**8?0000 tds = elem. cast().select("td"); + NodeList tds = elem.cast().select("td"); for (int i = 0; i < tds.getLength(); i++) { Element td = tds.getItem(i); @@ -385,10 +378,10 @@ public class HomeToolBar { public void setUI(ProjectStatusEvent event) { ProjectStatusEventType projectStatusEventType = event.getProjectStatusEventType(); - if(projectStatusEventType==null){ + if (projectStatusEventType == null) { return; } - + try { switch (projectStatusEventType) { case START: @@ -399,6 +392,7 @@ public class HomeToolBar { btnGitHubResource.disable(); btnPublishSoftware.disable(); btnRepackageSoftware.disable(); + btnServiceProfile.enable(); btnHelp.enable(); break; case OPEN: @@ -406,7 +400,7 @@ public class HomeToolBar { case ADD_RESOURCE: case DELETE_RESOURCE: case SAVE: - case MAIN_CODE_SET: + case MAIN_CODE_SET: btnCreateProject.enable(); btnOpenProject.enable(); btnSaveProject.enable(); @@ -414,13 +408,14 @@ public class HomeToolBar { btnGitHubResource.enable(); btnPublishSoftware.enable(); btnRepackageSoftware.enable(); + btnServiceProfile.enable(); btnHelp.enable(); - break; + break; default: break; } } catch (Exception e) { - Log.error("setUI Error : " + e.getLocalizedMessage(),e); + Log.error("setUI Error : " + e.getLocalizedMessage(), e); } } } diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/ribbon/HomeToolBarMessages.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/ribbon/HomeToolBarMessages.java index e631973..1523a98 100644 --- a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/ribbon/HomeToolBarMessages.java +++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/ribbon/HomeToolBarMessages.java @@ -92,6 +92,12 @@ public interface HomeToolBarMessages extends Messages { @DefaultMessage("Help") String helpGroupHeadingText(); + @DefaultMessage("Service Profile") + String serviceProfileButton(); + + @DefaultMessage("Service Profile") + String serviceProfileButtonToolTip(); + @DefaultMessage("Help") String helpButton(); diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/rpc/StatAlgoImporterService.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/rpc/StatAlgoImporterService.java index 85e62d6..d39bcc8 100644 --- a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/rpc/StatAlgoImporterService.java +++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/rpc/StatAlgoImporterService.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.code.CodeData; import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.descriptor.SAIDescriptor; +import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.dminfo.ServiceInfo; import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.exception.StatAlgoImporterServiceException; import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.file.FileUploadMonitor; import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.InputData; @@ -90,5 +91,6 @@ public interface StatAlgoImporterService extends RemoteService { public void repackageSoftware() throws StatAlgoImporterServiceException; public ItemDescription getItemDescription(String itemId) throws StatAlgoImporterServiceException; - + + public ServiceInfo getServiceInfo() throws StatAlgoImporterServiceException; } diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/rpc/StatAlgoImporterServiceAsync.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/rpc/StatAlgoImporterServiceAsync.java index 4b9b1ee..bba44a1 100644 --- a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/rpc/StatAlgoImporterServiceAsync.java +++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/rpc/StatAlgoImporterServiceAsync.java @@ -7,6 +7,7 @@ import java.util.ArrayList; import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.code.CodeData; import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.descriptor.SAIDescriptor; +import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.dminfo.ServiceInfo; import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.file.FileUploadMonitor; import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.InputData; import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project; @@ -70,6 +71,6 @@ public interface StatAlgoImporterServiceAsync { void getItemDescription(String itemId, AsyncCallback asyncCallback); - + void getServiceInfo(AsyncCallback callback); } diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/type/StatAlgoImporterRibbonType.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/type/StatAlgoImporterRibbonType.java index 8496d41..f66ee90 100644 --- a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/type/StatAlgoImporterRibbonType.java +++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/type/StatAlgoImporterRibbonType.java @@ -14,5 +14,6 @@ public enum StatAlgoImporterRibbonType { RESOURCE_GITHUB, SOFTWARE_PUBLISH, SOFTWARE_REPACKAGE, + SERVICE_PROFILE, HELP; } diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/server/StatAlgoImporterServiceImpl.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/server/StatAlgoImporterServiceImpl.java index 43d567f..943c5c6 100644 --- a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/server/StatAlgoImporterServiceImpl.java +++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/server/StatAlgoImporterServiceImpl.java @@ -9,6 +9,7 @@ import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import org.apache.commons.io.IOUtils; + import org.gcube.portlets.user.statisticalalgorithmsimporter.client.rpc.StatAlgoImporterService; import org.gcube.portlets.user.statisticalalgorithmsimporter.server.annotation.WPS4RParser; import org.gcube.portlets.user.statisticalalgorithmsimporter.server.file.CodeReader; @@ -16,6 +17,7 @@ import org.gcube.portlets.user.statisticalalgorithmsimporter.server.generator.Pr import org.gcube.portlets.user.statisticalalgorithmsimporter.server.generator.ProjectDeploy; import org.gcube.portlets.user.statisticalalgorithmsimporter.server.generator.ProjectShareInfoBuilder; import org.gcube.portlets.user.statisticalalgorithmsimporter.server.is.BuildSAIDescriptor; +import org.gcube.portlets.user.statisticalalgorithmsimporter.server.is.InformationSystemUtils; import org.gcube.portlets.user.statisticalalgorithmsimporter.server.poolmanager.DataMinerPoolManager; import org.gcube.portlets.user.statisticalalgorithmsimporter.server.social.Recipient; import org.gcube.portlets.user.statisticalalgorithmsimporter.server.storage.CodeSave; @@ -23,9 +25,11 @@ import org.gcube.portlets.user.statisticalalgorithmsimporter.server.storage.Depl import org.gcube.portlets.user.statisticalalgorithmsimporter.server.storage.FilesStorage; import org.gcube.portlets.user.statisticalalgorithmsimporter.server.storage.ProjectArchiver; import org.gcube.portlets.user.statisticalalgorithmsimporter.server.util.ServiceCredentials; +import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.Constants; import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.code.CodeData; import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.descriptor.ProjectLanguageType; import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.descriptor.SAIDescriptor; +import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.dminfo.ServiceInfo; import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.exception.StatAlgoImporterServiceException; import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.exception.StatAlgoImporterSessionExpiredException; import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.file.FileUploadMonitor; @@ -837,4 +841,23 @@ public class StatAlgoImporterServiceImpl extends RemoteServiceServlet implements } } + @Override + public ServiceInfo getServiceInfo() throws StatAlgoImporterServiceException { + try { + HttpServletRequest httpRequest = this.getThreadLocalRequest(); + ServiceCredentials serviceCredentials = SessionUtil.getServiceCredentials(httpRequest); + logger.info("GetServiceInfo()"); + logger.info("DataMiner Service discovered by IS"); + ServiceInfo serviceInfo = InformationSystemUtils.retrieveServiceInfo(Constants.DATA_MINER_SERVICE_CATEGORY, + Constants.DATA_MINER_SERVICE_NAME, serviceCredentials.getScope()); + + logger.info("Service Info retrieved: " + serviceInfo); + return serviceInfo; + + } catch (Throwable e) { + logger.error("Error retrieving Service Info: " + e.getLocalizedMessage(), e); + throw new StatAlgoImporterServiceException("Error retrieving Service Info: " + e.getLocalizedMessage(), e); + } + } + } diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/server/is/InformationSystemUtils.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/server/is/InformationSystemUtils.java index 6e28264..4dd4f0c 100644 --- a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/server/is/InformationSystemUtils.java +++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/server/is/InformationSystemUtils.java @@ -1,15 +1,21 @@ package org.gcube.portlets.user.statisticalalgorithmsimporter.server.is; +import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; import org.gcube.common.resources.gcore.GCoreEndpoint; import org.gcube.common.resources.gcore.GCoreEndpoint.Profile.Endpoint; +import org.gcube.common.resources.gcore.ServiceEndpoint.AccessPoint; +import org.gcube.common.resources.gcore.ServiceEndpoint.Property; import org.gcube.common.resources.gcore.GenericResource; import org.gcube.common.resources.gcore.ScopeGroup; +import org.gcube.common.resources.gcore.ServiceEndpoint; import org.gcube.common.scope.api.ScopeProvider; import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.Constants; +import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.dminfo.ServiceInfo; +import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.dminfo.ServiceInfoData; import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.exception.StatAlgoImporterServiceException; import org.gcube.resources.discovery.client.api.DiscoveryClient; import org.gcube.resources.discovery.client.impl.JAXBParser; @@ -264,4 +270,69 @@ public class InformationSystemUtils { } } + + public static ServiceInfo retrieveServiceInfo(String category, String name, String scope) + throws Exception { + try { + logger.debug("Retrieve DataMiner Service Properties"); + + if (scope == null || scope.length() == 0){ + logger.error("Invalid request scope: "+scope); + return null; + } + + ScopeProvider.instance.set(scope); + + SimpleQuery query = ICFactory.queryFor(ServiceEndpoint.class); + query.addCondition("$resource/Profile/Category/text() eq '" + category + "'") + .addCondition("$resource/Profile/Name/text() eq '" + name + "'") + .setResult("$resource/Profile/AccessPoint"); + DiscoveryClient client = ICFactory.clientFor(AccessPoint.class); + List accessPointList = client.submit(query); + + String serviceAddress=null; + ArrayList serviceProperties = new ArrayList<>(); + + if (accessPointList != null && !accessPointList.isEmpty()) { + AccessPoint accessPoint = accessPointList.get(0); + if (accessPoint.address() != null && !accessPoint.address().isEmpty()) { + String accessPointAddress = accessPoint.address(); + int wpsWebProcessingServiceIndex = accessPointAddress.indexOf(Constants.WPSWebProcessingService); + if (wpsWebProcessingServiceIndex > 0) { + serviceAddress = accessPointAddress.substring(0, wpsWebProcessingServiceIndex); + } + } + + if (accessPoint.properties() != null && !accessPoint.propertyMap().isEmpty()) { + for (String key : accessPoint.propertyMap().keySet()) { + Property property = accessPoint.propertyMap().get(key); + if (property != null&&property.name() != null && !property.name().isEmpty()){ + if(property.name().contains(":")) { + String[] propertyWithCategory=property.name().split(":"); + if(propertyWithCategory.length>=2){ + serviceProperties.add(new ServiceInfoData(propertyWithCategory[1],property.value(),propertyWithCategory[0])); + } else { + serviceProperties.add(new ServiceInfoData(property.name(), property.value(), Constants.DATA_MINER_DEFAULT_SERVICE_INFO_CATEGORY)); + } + } else { + serviceProperties.add(new ServiceInfoData(property.name(), property.value(), Constants.DATA_MINER_DEFAULT_SERVICE_INFO_CATEGORY)); + } + } + + + } + } + + } + ServiceInfo serviceInfo=new ServiceInfo(serviceAddress,serviceProperties); + + logger.debug("DataMiner Service Info: " + serviceInfo); + return serviceInfo; + + } catch (Throwable e) { + logger.error("Error in discovery DataMiner Service Endpoint Info in scope: " + scope); + logger.error(e.getLocalizedMessage(), e); + throw e; + } + } } diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/shared/Constants.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/shared/Constants.java index 4412300..d5d1138 100644 --- a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/shared/Constants.java +++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/shared/Constants.java @@ -34,7 +34,7 @@ public class Constants { // Download public static final String DOWNLOAD_SERVLET = "DownloadServlet"; - + // Upload public static final String LOCAL_UPLOAD_SERVLET = "LocalUploadServlet"; @@ -42,24 +42,34 @@ public class Constants { public static final String SAI_NAME = "SAIProfile"; public static final String SAI_CATEGORY = "SAI"; + public static final String DATA_MINER_SERVICE_CATEGORY = "DataAnalysis"; + public static final String DATA_MINER_SERVICE_NAME = "DataMiner"; + public static final String SOCIAL_NETWORKING_NAME = "SocialNetworking"; public static final String SOCIAL_NETWORKING_CLASS = "Portal"; public static final String POOL_MANAGER_SERVICE_NAME = "dataminer-pool-manager"; public static final String POOL_MANAGER_SERVICE_CLASS = "DataAnalysis"; + // DM Service Info + public static final String DATA_MINER_SERVICE_INFO_TITLE = "Service Profile"; + public static final String DATA_MINER_RUNTIME_FEATURE = "Runtime features"; + public static final String DATA_MINER_DEFAULT_SERVICE_INFO_CATEGORY = "Generic"; + // Main Generator public static final String PRE_INSTALLED = "Pre-Installed"; public static final String REMOTE_TEMPLATE_FILE = "http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-analysis/RConfiguration/RD4SFunctions/SAITemplateForExternalInvocation.R"; public static final String ECOLOGICAL_ENGINE_JAR_URL = "http://maven.research-infrastructures.eu/nexus/content/repositories/gcube-staging/org/gcube/dataanalysis/ecological-engine/1.12.0-4.13.1-154785/ecological-engine-1.12.0-4.13.1-154785.jar"; public static final String ECOLOGICAL_ENGINE_SMART_EXECUTOR_JAR_URL = "http://maven.research-infrastructures.eu/nexus/content/repositories/gcube-staging/org/gcube/dataanalysis/ecological-engine-smart-executor/1.6.2-4.13.1-167535/ecological-engine-smart-executor-1.6.2-4.13.1-167535.jar"; - + // DataMiner Pool Manager public static final int CLIENT_MONITOR_PERIODMILLIS = 2000; - + // public static final Project TEST_PROJECT = new Project(null, new ProjectConfig("", new ProjectSupportBashEdit())); - - - + + // WPS Data Miner + public static final String WPSWebProcessingService = "WebProcessingService"; + public static final String WPSCancelComputationServlet = "CancelComputationServlet"; + } diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/shared/dminfo/ServiceInfo.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/shared/dminfo/ServiceInfo.java new file mode 100644 index 0000000..e96d8c5 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/shared/dminfo/ServiceInfo.java @@ -0,0 +1,49 @@ +package org.gcube.portlets.user.statisticalalgorithmsimporter.shared.dminfo; + +import java.io.Serializable; +import java.util.ArrayList; + +/** + * + * @author Giancarlo Panichi + * + * + */ +public class ServiceInfo implements Serializable { + + private static final long serialVersionUID = 9046784925213335261L; + private String serviceAddress; + private ArrayList serviceProperties; + + public ServiceInfo() { + super(); + } + + public ServiceInfo(String serviceAddress, ArrayList serviceProperties) { + super(); + this.serviceAddress = serviceAddress; + this.serviceProperties = serviceProperties; + } + + public String getServiceAddress() { + return serviceAddress; + } + + public void setServiceAddress(String serviceAddress) { + this.serviceAddress = serviceAddress; + } + + public ArrayList getServiceProperties() { + return serviceProperties; + } + + public void setServiceProperties(ArrayList serviceProperties) { + this.serviceProperties = serviceProperties; + } + + @Override + public String toString() { + return "ServiceInfo [serviceAddress=" + serviceAddress + ", serviceProperties=" + serviceProperties + "]"; + } + +} diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/shared/dminfo/ServiceInfoData.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/shared/dminfo/ServiceInfoData.java new file mode 100644 index 0000000..b8ef136 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/shared/dminfo/ServiceInfoData.java @@ -0,0 +1,58 @@ +package org.gcube.portlets.user.statisticalalgorithmsimporter.shared.dminfo; + +import java.io.Serializable; + +/** + * + * @author Giancarlo Panichi + * + * + */ +public class ServiceInfoData implements Serializable { + + private static final long serialVersionUID = 4732143678328978038L; + private String key; + private String value; + private String category; + + public ServiceInfoData() { + super(); + } + + public ServiceInfoData(String key, String value, String category) { + super(); + this.key = key; + this.value = value; + this.category = category; + } + + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + + @Override + public String toString() { + return "ServiceInfoData [key=" + key + ", value=" + value + ", category=" + category + "]"; + } + +} diff --git a/src/main/resources/org/gcube/portlets/user/statisticalalgorithmsimporter/client/resource/service_profile_24.png b/src/main/resources/org/gcube/portlets/user/statisticalalgorithmsimporter/client/resource/service_profile_24.png new file mode 100644 index 0000000000000000000000000000000000000000..29442d9d2c2bc6dc7394601f3702403cbb65f24b GIT binary patch literal 1416 zcmV;31$X+1P)(&4O1rxyoC{rDy@FR1R4PIj#)aQPM1m25wW$V7n^Sv|)0{l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