diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index 4a03c8e..8e4d34a 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -11,6 +11,18 @@ uses + + uses + + + uses + + + uses + + + uses + diff --git a/pom.xml b/pom.xml index 305e0a4..d9c9aee 100644 --- a/pom.xml +++ b/pom.xml @@ -83,7 +83,7 @@ tabular-data-widget [1.1.0-SNAPSHOT,2.0.0-SNAPSHOT) - + org.gcube.portlets.user @@ -91,6 +91,25 @@ [1.0.0-SNAPSHOT,2.0.0-SNAPSHOT) + + + org.gcube.portlets.user + csv-import-wizard-gxt3 + [1.1.0-SNAPSHOT, 2.0.0-SNAPSHOT) + + + + org.gcube.portlets.user + csv-import-wizard-workspace-gxt3 + [1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT) + + + + org.gcube.portlets.user + home-library-jcr + runtime + + diff --git a/src/main/java/org/gcube/portlets/user/td/client/TabularDataController.java b/src/main/java/org/gcube/portlets/user/td/client/TabularDataController.java index 87c3be4..597f447 100644 --- a/src/main/java/org/gcube/portlets/user/td/client/TabularDataController.java +++ b/src/main/java/org/gcube/portlets/user/td/client/TabularDataController.java @@ -5,6 +5,9 @@ package org.gcube.portlets.user.td.client; import java.util.List; +import org.gcube.portlets.user.csvimportwizardgxt3.client.ImportWizard; +import org.gcube.portlets.user.csvimportwizardgxt3.client.general.WizardListener; +import org.gcube.portlets.user.csvimportwizardgxt3.client.source.local.LocalSource; import org.gcube.portlets.user.sdmximportwizard.client.SDMXImportWizardWindow; import org.gcube.portlets.user.sdmximportwizard.client.SDMXWizardSelectionEvent; import org.gcube.portlets.user.sdmximportwizard.client.SDMXWizardSelectionEvent.WizardSelectionHandler; @@ -56,14 +59,14 @@ public class TabularDataController { Log.trace("doImportTable importType: "+importType); Info.display("ImportTableEvent", "importType: "+importType); switch (importType) { - case SDMX: doSDMXDatasetImport(); break; - + case SDMX: openSDMXDatasetImportWizard(); break; + case CSV: openCSVImportWizard(); break; default: break; } } - protected void doSDMXDatasetImport() + protected void openSDMXDatasetImportWizard() { GWT.runAsync(new RunAsyncCallback() { @@ -75,7 +78,7 @@ public class TabularDataController { @Override public void onSelected(SDMXWizardSelectionEvent event) { - doDataseImport(event.getSelected()); + doSDMXDatasetImport(event.getSelected()); } @Override @@ -89,15 +92,56 @@ public class TabularDataController { @Override public void onFailure(Throwable reason) { - // TODO Auto-generated method stub - + asyncCodeLoadingFailed(reason); } }); } - protected void doDataseImport(List datasets) + protected void doSDMXDatasetImport(List datasets) { } + + protected void openCSVImportWizard() + { + /*GWT.runAsync(new RunAsyncCallback() { + + @Override + public void onSuccess() {*/ + ImportWizard importWizard = new ImportWizard("DemoCSVTarget", LocalSource.INSTANCE); + importWizard.addListener(new WizardListener() { + + @Override + public void failed(Throwable throwable, String reason, String details) { + System.out.println("FAILED reason: "+reason+" details: "+details+" throwable: "+throwable); + } + + @Override + public void completed() { + System.out.println("COMPLETED"); + } + + @Override + public void aborted() { + System.out.println("ABORT"); + } + }); + + importWizard.show(); + + /*} + + @Override + public void onFailure(Throwable reason) { + asyncCodeLoadingFailed(reason); + } + });*/ + } + + protected void asyncCodeLoadingFailed(Throwable reason) + { + Log.error("Async code loading failed", reason); + Info.display("Async code loading failed", "Please retry to lunch the operation"); + } } diff --git a/src/main/java/org/gcube/portlets/user/td/server/GreetingServiceImpl.java b/src/main/java/org/gcube/portlets/user/td/server/GreetingServiceImpl.java index 01693f4..a776cb0 100644 --- a/src/main/java/org/gcube/portlets/user/td/server/GreetingServiceImpl.java +++ b/src/main/java/org/gcube/portlets/user/td/server/GreetingServiceImpl.java @@ -1,5 +1,10 @@ package org.gcube.portlets.user.td.server; +import javax.servlet.ServletException; + +import org.gcube.common.scope.api.ScopeProvider; +import org.gcube.portlets.user.csvimportwizardgxt3.server.csv.CSVTargetRegistry; +import org.gcube.portlets.user.csvimportwizardgxt3.server.csv.DemoCSVTarget; import org.gcube.portlets.user.td.client.rpc.GreetingService; import org.gcube.portlets.user.td.shared.FieldVerifier; import com.google.gwt.user.server.rpc.RemoteServiceServlet; @@ -8,41 +13,56 @@ 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 GreetingServiceImpl extends RemoteServiceServlet implements GreetingService { - public String greetServer(String input) throws IllegalArgumentException { - // Verify that the input is valid. - if (!FieldVerifier.isValidName(input)) { - // If the input is not valid, throw an IllegalArgumentException back to - // the client. - throw new IllegalArgumentException( - "Name must be at least 4 characters long"); - } + /** + * {@inheritDoc} + */ + @Override + public void init() throws ServletException { + super.init(); + //register the demo csv target + CSVTargetRegistry.getInstance().add(new DemoCSVTarget()); + System.out.println("Registered DemoCSVTarget"); + + ScopeProvider.instance.set("/gcube/devsec"); + } - String serverInfo = getServletContext().getServerInfo(); - String userAgent = getThreadLocalRequest().getHeader("User-Agent"); + /** + * {@inheritDoc} + */ + public String greetServer(String input) throws IllegalArgumentException { + // Verify that the input is valid. + if (!FieldVerifier.isValidName(input)) { + // If the input is not valid, throw an IllegalArgumentException back to + // the client. + throw new IllegalArgumentException( + "Name must be at least 4 characters long"); + } - // Escape data from the client to avoid cross-site script vulnerabilities. - input = escapeHtml(input); - userAgent = escapeHtml(userAgent); + String serverInfo = getServletContext().getServerInfo(); + String userAgent = getThreadLocalRequest().getHeader("User-Agent"); - return "Hello, " + input + "!

I am running " + serverInfo - + ".

It looks like you are using:
" + userAgent; - } + // Escape data from the client to avoid cross-site script vulnerabilities. + input = escapeHtml(input); + userAgent = escapeHtml(userAgent); - /** - * Escape an html string. Escaping data received from the client helps to - * prevent cross-site script vulnerabilities. - * - * @param html the html string to escape - * @return the escaped string - */ - private String escapeHtml(String html) { - if (html == null) { - return null; - } - return html.replaceAll("&", "&").replaceAll("<", "<").replaceAll( - ">", ">"); - } + return "Hello, " + input + "!

I am running " + serverInfo + + ".

It looks like you are using:
" + userAgent; + } + + /** + * Escape an html string. Escaping data received from the client helps to + * prevent cross-site script vulnerabilities. + * + * @param html the html string to escape + * @return the escaped string + */ + private String escapeHtml(String html) { + if (html == null) { + return null; + } + return html.replaceAll("&", "&").replaceAll("<", "<").replaceAll( + ">", ">"); + } } diff --git a/src/main/resources/org/gcube/portlets/user/td/TabularDataPortlet.gwt.xml b/src/main/resources/org/gcube/portlets/user/td/TabularDataPortlet.gwt.xml index a23e5bf..87d86bf 100644 --- a/src/main/resources/org/gcube/portlets/user/td/TabularDataPortlet.gwt.xml +++ b/src/main/resources/org/gcube/portlets/user/td/TabularDataPortlet.gwt.xml @@ -9,6 +9,8 @@ + + diff --git a/src/main/webapp/TabularDataPortlet.html b/src/main/webapp/TabularDataPortlet.html index edc8e64..6059ed0 100644 --- a/src/main/webapp/TabularDataPortlet.html +++ b/src/main/webapp/TabularDataPortlet.html @@ -21,7 +21,7 @@ - + diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml index 3815e15..d13a10c 100644 --- a/src/main/webapp/WEB-INF/web.xml +++ b/src/main/webapp/WEB-INF/web.xml @@ -9,6 +9,7 @@ greetServlet org.gcube.portlets.user.td.server.GreetingServiceImpl + 1 @@ -60,6 +61,60 @@ SDMXImportWizardServlet /tabulardataportlet/SDMXImportWizardService + + + + CSVImportService + org.gcube.portlets.user.csvimportwizardgxt3.server.CSVImportServiceImpl + + + + CSVImportService + /tabulardataportlet/CSVImportService + + + + LocalUploadServlet + org.gcube.portlets.user.csvimportwizardgxt3.server.local.LocalUploadServlet + + + + LocalUploadServlet + /tabulardataportlet/LocalUploadServlet + + + + CSVServlet + org.gcube.portlets.user.csvimportwizardgxt3.server.CSVServlet + + + + CSVServlet + /tabulardataportlet/CSVServlet + + + + + WorkspaceLightService + org.gcube.portlets.user.workspace.lighttreegxt3.server.WorkspaceServiceImpl + + + + WorkspaceLightService + /tabulardataportlet/WorkspaceLightService + + + + + CSVImportServiceWorkspace + org.gcube.portlets.user.csvimportwizardgxt3.ws.server.ImportWizardWSServiceImpl + + + + CSVImportServiceWorkspace + /tabulardataportlet/CSVImportServiceWorkspace + +